I have a question for my magento version, I create a module to add a custom field in Customer Registration Form and Checkout Registration Form.


<?xml version="1.0"?>

install code:

$installer = $this;

$installer->addAttribute("customer", "cod_univoco",  array(
    "type"     => "varchar",
    "backend"  => "",
    "label"    => "Codice Univoco",
    "input"    => "text",
    "source"   => "",
    "visible"  => true,
    "required" => false,
    "default" => "",
    "frontend" => "",
    "unique"     => false,
    "note"       => ""


        $attribute   = Mage::getSingleton("eav/config")->getAttribute("customer", "cod_univoco");


        $attribute->setData("used_in_forms", $used_in_forms)
        ->setData("is_used_for_customer_segment", true)
        ->setData("is_system", 0)
        ->setData("is_user_defined", 1)
        ->setData("is_visible", 1)
        ->setData("sort_order", 100)


Then I edited the files "register.phtml" to show the field in registration form, the file "form/edit.phtml" to show the field in edit form in customer account section and the file "billing.phtml" to show the field in checkout registration form.

The module works fine for the customer registration form and the edit form, the problem is in the checkout form, the field appear but if I insert a value that value is not saved.

What can I do? Thanks

1 Answer 1


The file billing.phtml is for the billing address. Customer and customer address are two different models. Your value does not get saved because it is not part of the address attributes. Upon saving the billing form a async call gets made with the serialized form as payload. So if you add a additional field in the template its data should get transferred to the backend if you use a name like billing[something]. In the Onepage controller the data from billing[] gets saved to the billing address model.

So if you do want to keep your attribute at the customer attributes you could extend one of Mage_Checkout_OnepageController::saveBillingAction or Mage_Checkout_Model_Type_Onepage::saveBilling to look for the name of your attribute in the data and save it to the customer instead. The controller seems to be the better place for that.

  • I understand thanks. I try to extend model Mage_Checkout_OnepageController::saveBillingAction or Mage_Checkout_Model_Type_Onepage::saveBilling I'm new enough to magento and I still have to study how to do it in the right way. I try this to my test site, thanks.
    – DanMar
    Feb 23, 2019 at 20:34

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.