1

Am having trouble with the onepage checkout on an installation of Magento 1.9.0.1. Where the response of /checkout/onepage/saveBilling is blank. Form details are being passed through but the script effectively bombs out at a key point.

In

OnepageController.php

$result = $this->getOnepage()->saveBilling($data, $customerAddressId);

just ends here. I have added a lot of Mage::log() into the Checkout/Model/Type/Onepage.php saveBilling function and it seemingly gets all the way to the

return array(); 

  public function saveBilling($data, $customerAddressId)
  {
   ...
  Mage::log("this logs ok and data seems to be set prior",null,"mymag.log");
  return array();    // this seems to cause the process to stop
  Mage::log("Should have already returned an array() and not get here - this does not log",null."mymag.log");
  }

However back in the Onepagecontroller.php

a Mage::log() after the function call does not run

Mage::log("about to call saveBilling - this log works",null,"mymag.log");
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
Mage::log("this does not log...WHY!?!",null,"mymag.log");

Have spent ages trying to get this to work....help please

1
  • seemingly I need to add my bounty to an answer although no actual answer hit the nail on the head. Still wondering what to do Commented Dec 6, 2017 at 12:25

3 Answers 3

0
+50

Im thinking that there is some module overriding saveBilling method.
Thats why logs doesnt works. You may be in wrong method.

Are you using PHPstorm? Magicento?
PHPStorm shows if any method is overide. It looks like: file:///home/s-ksiamro/Obrazy/Zrzut%20ekranu%20z%202017-11-28%2014-27-27.png
at the left you can see:

file:///home/s-ksiamro/Obrazy/Zrzut%20ekranu%20z%202017-11-28%2014-26-16.png

point with white arrow (left one) says that current method is override. Click there to move.
point with red arrow (right one) says that current function is overriding different. You can also click there to move.

EDIT1:

try to enable PHP logs to index.php file:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

Then go to checkout page and see results.
Also use Browser console to check for errors. Also check logs:
- var/log/system.log
- var/log/exceptions.log

It should help with debugging.
However better idea is to install and configure xdebug. Then debugging code step by step - very useful :)

15
  • Well I thought that too but a log works two lines higher in the controller, before the $result = $this->getOnepage()->saveBilling($data, $customerAddressId), but not after so I know that method is being called. I do have commercebug (Alan Storm's thingy) Commented Nov 28, 2017 at 13:54
  • have made that clearer in my Q. Commented Nov 28, 2017 at 14:05
  • I installed phpstorm and no, the methods are not overwritten. Commented Nov 28, 2017 at 14:22
  • I just edit my post, let me know if that helps Commented Nov 28, 2017 at 15:27
  • thanks for your continued efforts. I do have them enabled already. I am reaching the conclusion that it might be a database write issue as I have now discovered that customer/account/createpost/ also fails the same way at the point of $customer->save() . will keep digging Commented Nov 28, 2017 at 15:30
0

Have you added formkey in your custom templates after patched??

you need to add that in templates/checkout/onepage/login.phtml

    <form id="login-form" action="<?php echo $this->getPostAction() ?>" method="post">
        <fieldset>
            <?php echo $this->getBlockHtml('formkey'); ?>
.....

And in billing.phtml, shipping.phtml & payment.phtml inside the form.

Without the formkey ajax request to saveBilling request will not work.

1
  • yes, formkeys all present in the form and the passed form data. Good thought though. It does all seem to be working now though. Disabling the APC cache and clearing out all session data seems to have done something that works... Commented Nov 30, 2017 at 13:37
0

In the end it turned out that a server php module was not installed on the live server. The module was php-mbstring.x86_64 which deals with some of the string validation and processing for the addresses. However, being called via Ajax made tracking this down incredibly difficult

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.