I need to add two fields for Customer in customer's registration. I managed to do it and its working fine for customer registration. But it is not getting saved in case of onepage checkout (if customer is trying to register himself at the time of checkout).

Below is my Code

Code for app\code\local\ComName\ModuleName\etc\config.xml:

<?xml version="1.0"?>

Code for app\code\local\ComName\ModuleName\Helper\Data.php:

class ComName_ModuleName_Helper_Data extends Mage_Core_Helper_Abstract


Code for app\code\local\ComName\ModuleName\sql\customerattribute1417600661_setup\mysql4-install-0.1.0.php:

$installer = $this;
$installer->addAttribute("customer", "dri_license",  array(
    "type"     => "varchar",
    "backend"  => "",
    "label"    => "Driving License",
    "input"    => "text",
    "source"   => "",
    "visible"  => true,
    "required" => false,
    "default" => "",
    "frontend" => "",
    "unique"     => false,
    "note"       => ""
        $attribute   = Mage::getSingleton("eav/config")->getAttribute("customer", "dri_license");
        $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)

I have added fields in billing.phtml

Please help me if anyone have any idea on what i missing

2 Answers 2


I'd say that you need to change your XML like this:


And also - add the field to the quote in your setup file like this:

$installer = $this;

$connection = $installer->getConnection();
$quote_table_name = $installer->getTable('sales/quote');
$connection->addColumn($quote_table_name, 'new_attribute', array(
    'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
    'length' => 255,
    'nullable' => false,
    'comment' => 'New Attribute',


(You can, of course use the alter table call, but I like this method better.)

Magento is first copying the fields from your request to the quote and then it's copying them back to the customer when the customer is being created.

Also, be sure that you have your new attribute ("new_attribute" in the example above) in the customer_form_attribute table for the checkout_register form_code

Hope that helps.


I think the part you are missing is the conversion from quote to customer that happens when you complete the checkout process.

This can be done with a small section of xml.


This you copy your attribute from the customer part of the quote to the actual customer model when the quote is converted to an order.

The magic happens in the function Mage_Checkout_Model_Type_Onepage::_prepareNewCustomerQuote here you can see the call to the function Mage::helper('core')->copyFieldset('checkout_onepage_quote', 'to_customer', $quote, $customer);

Your Answer

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

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