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

  • 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 – Jon Holland Dec 6 '17 at 12:25
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 :)

  • 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) – Jon Holland Nov 28 '17 at 13:54
  • have made that clearer in my Q. – Jon Holland Nov 28 '17 at 14:05
  • I installed phpstorm and no, the methods are not overwritten. – Jon Holland Nov 28 '17 at 14:22
  • I just edit my post, let me know if that helps – Konrad Siamro Nov 28 '17 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 – Jon Holland Nov 28 '17 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.

  • 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... – Jon Holland Nov 30 '17 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, privacy policy and cookie policy

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