1

I've just upgraded a Magento site from 1.5.x to 1.9.3.5. Now, all my customer-related forms are failing form validation. For example, I can fully fill out my one-page-checkout Billing Address form, but I get the following error message:

Please enter the first name.
Please enter the last name.
Please enter the street.
Please enter the city.
Please enter the telephone number.
Please enter the zip/postal code.
Please enter the country. 

I've added a bunch of log statements to the core Magento code so I can see what the hell is going on. I've ruled out the common form_key issue-- it's passing that validation test-- and everything seems to work until saveBilling() in Onepage.php. I can see that the POST request to the server contains the address information, but I can't see much beyond that as the Magento function documentation is terrible and dumping the $address object to log results in a 10,000+ line dump that I have no hope of successfully searching through.

I know it's failing on line ~325 in Onepage.php, specifically these lines of code:

// validate billing address
if (($validateRes = $address->validate()) !== true) {
    return array('error' => 1, 'message' => $validateRes);
}

It is always returning the error message. Help!

2
  • I too am having trouble with the lines you quote that are inside Onepage.php . I cannot locate any validate() method/function inside of the sales-quote-address model. And this is where things seem to fail. Not sure what to do from this point... Nov 20, 2017 at 14:37
  • neither is the following method $address->implodeStreetAddress() hmmm Nov 20, 2017 at 14:42

1 Answer 1

0

I think the ajax billing address form submit is failing in your case. This form submit is happening through javascript.

This form submissions will be handled by the class method Mage_Checkout_OnepageController::saveBillingAction(). So you need to inspect in this file and confirm whether the post data coming there empty or not. You can do this by adding the below content in the saveBillingAction() method.

$post = $this->getRequest()->getPost();
Mage::log(print_r($post, true), null, 'billing.log', true);

This will create a new log file billing.log under var\log directory. Please see the output. If it is empty, then something wrong with the javascript file for sure.

The onestepcheckout js file that Magento uses to process all step is:

skin/frontend/base/default/js/opcheckout.js

Tip: Plese open your browser console and submit the billing address save action. You can see the request under Network section and you can definitely find more details in the console.

1
  • Thank you for taking the time to respond! When I log the POST data in the saveBillingAction step, I can see that the AJAX call is succeeding and that there is data in the POST request. I'm wondering if the variable names being posted are somehow different than the names that the Address model is expecting. How do I find what full variable names the model is expecting?
    – tkinst
    Oct 1, 2017 at 14:20

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.