Support

Home Forums Event Espresso Premium iDeal payment PHP colliding with another iDeal method/gateway

iDeal payment PHP colliding with another iDeal method/gateway

Posted: December 10, 2012 at 12:49 pm

Viewing 28 reply threads


W.S. Chan

December 10, 2012 at 12:49 pm

Hello. I have a question.

I have talked with the developer of the WooCommerce iDeal plugin, as I suspected it was giving a problem when buying something in the WooCommerce webshop part of a website I am developing.

However, it now seems the problem is within the Event Espresso iDeal gateway/PHP module. Here is the comment I received from the WooCommerce developer:

This is something that the Event Espresso iDEAL module author has to fix then, unfortunately. The error indicates that it tries to load an iDEAL_payment class when the WooCommerce one has already been loaded. This is not allowed in PHP (since both classes have the same name) and that triggers your fatal error.

The Event Espresso iDEAL module needs to implement a similar check for the existing class instance, just like I did in the 1.6.3 version for our plugin, before it tries to add this class. In fact, the module shouldn’t even be loading outside Event Espresso screens, since it has nothing to do there really.

Can anyone help me to check/adjust how to separate these two iDeal plug-ins, so each stays within their own directory/PHP stuff? I suspect this must be able to work. One is for the shop part, one is for the Event Espresso part.

The error message I get is as follows (I can provide you the actual website URL if useful/needed for checking?): Fatal error: Cannot redeclare class iDEAL_Payment in /home/–mywebsite-–|.com/public_html/wp-content/plugins/event-espresso/gateways/ideal/ideal.class.php on line 14

Thanks for your help!
Best regards, Bart

  • This topic was modified 11 years, 11 months ago by W.S. Chan.


Dean

December 11, 2012 at 12:51 am

Hi Bart,

I will pass this onto the devs to look into, as I suspect its a relatively easy fix to resolve but I would rather have their input on this one.

We will get back to you.


W.S. Chan

December 11, 2012 at 2:46 pm

Thanks, Dean. I hope this could be fixed soon indeed (I don’t mean to urge you guys on, but my customer would like to start using the website asap). Appreciate your help in this matter!


W.S. Chan

December 13, 2012 at 3:07 am

Good morning. Is there any update on this matter, please? My customer wants to host a charity event and wants to start registering clients this week. Sorry to bother, is there any way I can assist or help to solve this matter as soon as possible? Thanks!


Dean

December 13, 2012 at 3:24 am

Hi,

This ticket has been marked as high priority and is being actively worked on, but there is no update on when it will be completed yet.

I will let you know as soon as I do!


W.S. Chan

December 17, 2012 at 2:06 pm

Hi guys. Sorry to bother you again, but my customer is getting rather anxious to have his website delivered to him. Is there any fix or news about this? Usually I do not mean to sound so impatient, but this is rather getting urgent for me now… Thanks!


Josh

  • Support Staff

December 18, 2012 at 9:56 am

Hi there,

You can apply the fix to the gateway files that you have installed right now. There are four files that will require a few modifications:

First, /gateways/PaymentGateway.php line 9:

if (!class_exists('PaymentGateway')) {

change to:

if (!class_exists('Espresso_PaymentGateway')) {

same file, line 11:

abstract class PaymentGateway {

change to:

abstract class Espresso_PaymentGateway {

Second, within the ideal gateway folder: line 13 of /gateways/ideal/ideal.class.php:

class iDEAL_Payment

change to:

class Espresso_iDEAL_Payment

Third, in /gateways/ideal/ideal_vars.php, line 12:

$iDEAL = new iDEAL_Payment($partner_id);

change to:

$iDEAL = new Espresso_iDEAL_Payment($partner_id);

Fourth, in /gateways/ideal/report.php, line 13:

$iDEAL = new iDEAL_Payment($partner_id);

change to:

$iDEAL = new Espresso_iDEAL_Payment($partner_id);

So in a nutshell, we’re adding a prefix of “Espresso” to each of the classes so that the other plugins that are using the identical classes in their gateway will not conflict.


W.S. Chan

December 18, 2012 at 11:04 am

Hi Josh,

If I apply those fixes you mentioned, something else happens now.

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/jakobsmanagement.com/public_html/wp-content/plugins/event-espresso/gateways/process_payments.php on line 30
De betaling kon niet aangemaakt worden.

Foutmelding: De opgegeven betalings gegevens zijn onjuist of incompleet. (Error: payment data provided are incorrect or incomplete.)

(Warning: payment data are in incorrect or incomplete).

So, a different error now, will we be able to fix that array part? Thanks for your help so far!

Bart.


W.S. Chan

December 18, 2012 at 11:08 am

Seems it has something to do with a temporary file/data? This is at least what I see in line 30:
$payment_data = array_merge($payment_data, $temp_data);


W.S. Chan

December 18, 2012 at 2:13 pm

I have changed back the files again so that I can at least deliver the website to the client, even though half of it isn’t working as planned yet. SIGH I am getting quite tired of this, about to give up, guys.


Josh

  • Support Staff

December 18, 2012 at 3:06 pm

Hi there,

I am so sorry for the trouble that you are having. I ran a few tests with the iDeal gateway and can recommend trying the above code changes with one exception this time: You can leave Paymentgateway.php as is. Can you try making these changes to the iDEAL gateway?

Line 13 of /gateways/ideal/ideal.class.php:

class iDEAL_Payment

change to:

class Espresso_iDEAL_Payment

In /gateways/ideal/ideal_vars.php, line 12:

$iDEAL = new iDEAL_Payment($partner_id);

change to:

$iDEAL = new Espresso_iDEAL_Payment($partner_id);

In /gateways/ideal/report.php, line 13:

$iDEAL = new iDEAL_Payment($partner_id);

change to:

$iDEAL = new Espresso_iDEAL_Payment($partner_id);


W.S. Chan

December 19, 2012 at 12:58 am

Then I get:

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/jakobsmanagement.com/public_html/wp-content/plugins/event-espresso/gateways/process_payments.php on line 30
De betaling kon niet aangemaakt worden.

Foutmelding: De opgegeven betalings gegevens zijn onjuist of incompleet.


W.S. Chan

December 19, 2012 at 1:08 am

OK, guys, I don’t know what to do anymore. Is there or is there not any way this is going to work? My customer is getting crazy now each time I tell him “we are working on a solution with the software company”.

Either I need to have some priority support now, or else this customer is going to walk on me and I loose this job. If so, then I want to have a refund. It is a total mess now!

I do not mean to sound angry, but I am very frustrated now and have no idea anymore what to do. I followed all the instructions, but it seems things are getting worse and worse. Now, nothing works anymore regarding iDeal in the EE or WooCommerce part. What should I do??


W.S. Chan

December 19, 2012 at 1:12 am

Warning: Cannot modify header information – headers already sent by (output started at /home/jakobsmanagement.com/public_html/wp-content/plugins/event-espresso/gateways/ideal/ideal.class.php:1) in /home/jakobsmanagement.com/public_html/wp-content/plugins/event-espresso/gateways/ideal/ideal_vars.php on line 30


Dean

December 19, 2012 at 1:42 am

Hi,

I am really sorry that this is occurring, we are trying to to help resolve this as best we can.

2 things if it’s ok.

1) Have you got debugging turned on? If so, please turn it off and test again.

2) if the debugging doesn’t assist, please provide us with login information so we can take a closer look

Please send both WP and FTP details via https://eventespresso.com/contact/

Choose the “I am sending login info as requested” option and fill out the form

Please make sure you add the forum post link to aid us in case another team member picks up the email.

NOTE: login details need to be Admin level.


W.S. Chan

December 19, 2012 at 2:54 am

Hello Dean.

I have just sent the requested information. Please note I have disabled the WooCommerce iDeal plug-in for the moment, so that the customer can at least start using his website. He is hosting a charity event on 24th of December in support of a nation wide charity event on radio and tv here (it’s called Serious Request) and he wants to have his attendees start registering through the website now.
Should you have any questions, please let me know.
Bart.


Dean

December 19, 2012 at 5:34 am

Hi, We have your details now, thanks for that. Im going to pass this on to Josh when he gets online, he knows a lot more about the gateway workings than I do, so you will be in better hands there.


W.S. Chan

December 19, 2012 at 6:30 am

OK, great. I forgot to mention I can be found on Twitter (BartRoelands) in case you need me straight away to answer anything.


Josh

  • Support Staff

December 19, 2012 at 12:54 pm

Hi there,

Can you verify whether the Event Espresso Ideal gateway works as expected if the WooCommerce ideal module is deactived? I’m not able to reproducing the errors you are reporting on my test site with the WooCommerce ideal module installed. I’ll keep working on my site to see if I can reproduce these issues. I’m hesitant to change anything on a live site without being able to narrow down the cause of the issue.

I logged into the site and it appears you have the gateway set up in live mode. Is it possible for you to switch to test mode for a time and run a test registration?


Josh

  • Support Staff

December 19, 2012 at 1:25 pm

I’ve uploaded the modified iDeal gateway that I’ve found to be working as expected with the WooCommerce IDeal gateway to dropbox.

You can download a copy of it here.

You can install this on your server by unzipping it and uploading to /wp-content/uploads/espresso/gateways. After uploading, you may need to reset the Event Espresso gateway settings by deactivating and reactivating the IDeal gateway.


W.S. Chan

December 19, 2012 at 1:59 pm

Hi Josh. I am going to try this and see how things work then. Will let you know as soon as I have some results. Appreciate the help a lot, guys!


W.S. Chan

December 19, 2012 at 2:28 pm

I have uploaded those files. I have then disabled and then re-enabled the iDeal plug-in for EE. If I now go to the shop part and order a product, I can choose iDeal through Mollie as payment method. The next thing I see is the page loading and then:

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/jakobsmanagement.com/public_html/wp-content/plugins/event-espresso/gateways/process_payments.php on line 30
De betaling kon niet aangemaakt worden.

Foutmelding: De opgegeven betalings gegevens zijn onjuist of incompleet.

The Event Espresso gateway works fine if the WooCommerce ideal plug-in is disabled. But as soon as I enable it, then the shop part does not work anymore because it suddenly produces Espresso errors then.


Josh

  • Support Staff

December 19, 2012 at 3:46 pm

That last part sheds more light on what is going on. I was under the impression you were seeing the errors while paying for an event registration. If you have the WooCommerce IDeal plugin enabled, do you get any errors when you run a test registration using the new gateway files I uploaded to Dropbox?


W.S. Chan

December 19, 2012 at 6:35 pm

With the new gateway files uploaded, I have no problems registering for an even with EE and it takes me to the Mollie iDeal page of the appropriate bank indeed. So, that seems to work with WooCommerce iDeal plug-in enabled.


W.S. Chan

December 20, 2012 at 10:22 pm

Good morning. Any new information today? I hope to be able to finish the website before X-Mas, so that my customer will be satisfied and I can move on to other projects. Appreciate your help so far a lot and hope we can resolve this issue soon. Thank you!


Josh

  • Support Staff

December 21, 2012 at 3:43 pm

Hi there,

We are still working on this. We’re looking through the gateway code for both plugins to find any other conflicts.


Josh

  • Support Staff

December 24, 2012 at 12:13 pm

This is an update: The developer who is working on the ticket has added a check for the attendee ID so that the espresso process payment does not get called within the woocommerce ideal gateway flow.

In /gateways/process_payments.php, there is a function that is named deal_with_ideal that starts on line 182.
What we’re doing is adding a check for the attendee ID before calling the espresso_process_ideal function. Here is the updated version of that function:

function deal_with_ideal() {
    if (!empty($_POST['bank_id'])) {
        $active_gateways = get_option('event_espresso_active_gateways', array());
        if (!empty($active_gateways['ideal'])) {
            foreach ($active_gateways as $gateway => $path) {
                event_espresso_require_gateway($gateway . "/init.php");
            }
            $payment_data['attendee_id'] = apply_filters('filter_hook_espresso_transactions_get_attendee_id', '');
            if(!empty($payment_data['attendee_id'])){//only process the payment if we can associate it with an attendee
             espresso_process_ideal($payment_data); 
             }
        }
    }
}

Please note: I tested this code running the current version of Event Espresso with the modified IDeal gateway and the Woocommerce plugin +Ideal gateway installed and was able to run through a WooCommerce product purchase without a conflict.

I hope this helps! 🙂


W.S. Chan

December 24, 2012 at 12:56 pm

Hi Josh!

Thanks for this update. I would love to try and I am going to the admin.php log-in page, but once I entered username and password, the screen goes blank (thus: no admin side of the website)?


W.S. Chan

December 24, 2012 at 1:08 pm

Sorry, for some reason, now I seem to be logged in. Weird. Am going to try it now.

Viewing 28 reply threads

The support post ‘iDeal payment PHP colliding with another iDeal method/gateway’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso