1

So for some reason my Magento install (1.5) stopped saving new customers state/region name, both inside admin and outside.

Magento's registration form has a dropdown select, with a name of "region_id" and a hidden text field named "region". I guess that some javascript is supposed to get the selected name and set the "region" field, but that doesn't work.

What I did was create a jQuery line that, on form submit, gets the region name and sets the "region" field to it. That works, somewhat. There are still customers who are registering without a region name, only the id.

Anyone ever had something similar?

4
  • do you use a custom template? have you made any changes to the registration process or the customer attributes? May 18, 2013 at 17:23
  • I use de default template, I know it's terrible, but it was an inherited project. There has been no change to customer attributes, and the only change I did to the template was adding the jquery script to give it a quick fix.
    – localhost
    May 18, 2013 at 22:54
  • Follow this guide and report back. May 19, 2013 at 0:52
  • Well, it's already in production. And it isn't a php error, because error reporting is on.
    – localhost
    May 19, 2013 at 15:20

1 Answer 1

2

There is a table customer_form_attribute which links the customer and customer address attributes to the forms in your website. There should be an entry in this table for the attribute region_id. Note: in the sample data this is attribute_id 13.

Without this entry the attribute will not be saved when the form is processed. The attribute will not be picked up when the extractData in the class Mage_Customer_Model_Form and so it will be ignored when extracting the data from the request into the $addressData.

/app/code/core/Mage/Customer/controllers/AddressController.php

$addressForm = Mage::getModel('customer/form');
$addressForm->setFormCode('customer_address_edit')
    ->setEntity($address);
$addressData    = $addressForm->extractData($this->getRequest());
$addressErrors  = $addressForm->validateData($addressData);
if ($addressErrors !== true) {
    $errors = $addressErrors;
}

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