Jump to content

[work around - not solved] Fatal Error on Payment Return - 1.4.0.17 upgrade from 1.3.7.0


Recommended Posts

I just upgraded from 1.3.7.0 to 1.4.0.17. There is a problem when I submit a test order at the last step (either OPC or 5-step process). If I select "Cheque" as the payment method it returns with "fatal error" in the middle of an otherwise normal shop page with the url in the address bar .../modules/cheque/validation.php

When I try this with PayPal, the PayPal transaction gets processed for the payment amount on PayPal, but no record in the BO because PayPal also results in "fatal error" when returning to the shop.

I did modify some files and my theme. I thought maybe it was my modification problem. I restored all the original 1.4.0.17 files and used the stock prestashop them - same problem.

Any ideas on how to troubleshoot and fix this?

Link to comment
Share on other sites

Hi, I don't know if it can help you, but I had fatal errors messages with paiement modules (paypal and cheque with prestashop v1.3.5). I solved the problem by removing the soColissimo carrier module. I had searched the solution for many weeks.... Good luck

Link to comment
Share on other sites

I enable debug in defines.inc.php

Here is the debug info on the screen. Can anyone tell what the problem is from this?

Array
(
   [0] => Array
       (
           [file] => /home/chnycus/public_html/shop14/classes/PaymentModule.php
           [line] => 101
           [function] => displayError
           [class] => ToolsCore
           [type] => ::
           [args] => Array
               (
               )

       )

   [1] => Array
       (
           [file] => /home/chnycus/public_html/shop14/modules/cheque/validation.php
           [line] => 50
           [function] => validateOrder
           [class] => PaymentModuleCore
           [object] => Cheque Object
               (
                   [_html:private] => 
                   [_postErrors:private] => Array
                       (
                       )

                   [chequeName] => CHNYC
                   [address] => Address Goes Here
                   [currentOrder] => 
                   [currencies] => 1
                   [currencies_mode] => checkbox
                   [id] => 46
                   [version] => 2.3
                   [name] => cheque
                   [displayName] => Check
                   [description] => Module for accepting payments by check.
                   [author] => PrestaShop
                   [tab] => payments_gateways
                   [active] => 1
                   [_lang:protected] => Array
                       (
                       )

                   [_path:protected] => /shop14/modules/cheque/
                   [warning] => 
                   [beforeUninstall] => 
                   [_errors] => 
                   [table:protected] => module
                   [identifier:protected] => id_module
                   [confirmUninstall] => Are you sure you want to delete your details ?
               )

           [type] => ->
           [args] => Array
               (
                   [0] => 80
                   [1] => 1
                   [2] => 5
                   [3] => Check
                   [4] => 
                   [5] => Array
                       (
                           [{cheque_name}] => CHNYC
                           [{cheque_address}] => Address Goes Here
                           [{cheque_address_html}] => Address Goes Here
                       )

                   [6] => 2
                   [7] => 
                   [8] => 7064c2f5742f5ab2adb7ab6ff108dae3
               )

       )

)

Link to comment
Share on other sites

Some more debug work - I commented out some lines in classes/payment.php near line 100 and made things work. Not sure what the impact is if this were used on a live shop.

    public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false)
   {
       global $cart;

       $cart = new Cart((int)($id_cart));
       // Does order already exists ?
       if (Validate::isLoadedObject($cart) AND $cart->OrderExists() === 0)
       {
       //    if ($secure_key !== false AND $secure_key != $cart->secure_key) - commented out for testing
       //        die(Tools::displayError());  - commented out for testing

Link to comment
Share on other sites

thanks for sharing the information.
I guess something went wrong with secure_key of cart/customer at the data migration.
Or maybe the secure key generating method is changed some way in 1.4


Is there a way that I could regenerate the secure keys for the migrated customers so that this problem could be fixed without commenting out the lines above? Perhaps a script that could be run through phpmyadmin
Link to comment
Share on other sites

I think PrestaShop is using MD5 (PHP) to generate secure key.
and there is also same function MD5() of MySQL to generate same hash.
maybe you can have try, I suggest test it at some test environment first, then apply it to your store database

For your reference, here is PHP code in PrestaShop to generate customer key.
You can find this in /classes/Customer.php

       $this->secure_key = md5(uniqid(rand(), true));

Link to comment
Share on other sites

See my post #8 above as a work around. I've done this mod to classes/payment.php near line 100 and it is working on a live shop. I posted the problem 30 March 2011 in the bug tracker, but it still hasn't been assigned to anyone.

Link to comment
Share on other sites

Hmm, I'm not happy with some updated shops to 1.4
I have also this bug, fatal error for old registered customers.

I have use the rhapsody work around.

I think it's solved right now.
But it's not the right solution I think ?

Link to comment
Share on other sites

public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false)


The above function has been changed from 1.4
A new parameter (the last one) $secure_key is added, This function is called from payment modules.
So if the payment module does not pass this parameter or pass parameter as false, it should be OK.

Link to comment
Share on other sites

I did some checking in the mysql database and it appears that many of the migrated customers have a blank in the secure_key filed in the table ps_customer

I'm thinking this is what is causing the fatal error. Anyone else seeing the same thing?

Link to comment
Share on other sites


I did some checking in the mysql database and it appears that many of the migrated customers have a blank in the secure_key filed in the table ps_customer


If that is the case, then you can solve the problem by copy secure_key from old database if you have backup copy.
Link to comment
Share on other sites

  • 3 weeks later...
this error is from core email templates, must replace the backup emails in your lang emails with the new templates

I think this is just one of the multiple cases the cause the fatal error.
During order validation, there are multiple scenarios will cause the same fatal error. It depends.

Here are some of them
- secure key
- email template
- generate invoice
......
Link to comment
Share on other sites

  • 2 months later...

same problem here using prestashop ver 1.4.1
I’ve placed some order for testing several times with paypal but the last page of order is always same blank page with this error msg ;


Fatal error: Cannot access empty property in /home/domain/public_html/classes/PaymentModule.php on line 494


BUT paypal payment go through so that I can see the listed order on ‘orders’ tap.

BUT there shows another error msg when I trying to generate invoice of that order ;



Fatal error: Cannot access empty property in /home/domain/public_html/classes/PDF.php on line 468


Any solutions or technical support of this issue?

Thx

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...