Know More About Your Customers - Adding Custom Signup Attributes
15 Jun 2009, by Denis Margetic
65 Comments · Posted in Magento

    Magento provides a simple user account signup page. However, some online stores might want to collect relevant customer information for more targeted and personal interactions with their customers. Some examples of details that could be collected include shoe size, clothing size or favourite colour.

    Adding your custom fields on the signup form is not difficult, but it is not trivial either, since one cannot use the Magento backend for the task. As an example of how it can be done, I will demonstrate the addition of a new custom field to the signup form asking new users to enter their favourite ice cream flavour.

    1. We need to make a module to extend the functionality of the customer model. Start by adding the module xml file to the app/etc/modules/ directory. You need to decide on a module name. In this example we will use the Fontis scope, and call the module 'Customer'. Therefore we need to create a file named Fontis_Customer.xml and add the following content:

    2. Adding the above file means that Magento is now aware of a new custom module. Now, we need to create the module itself, which must be located in the app/code/local/Fontis/Customer directory. Inside this directory, create an etc directory and copying the following file inside:


      Edit the file and change :



    3. This file contains two different <fieldsets> - one in <config><admin> and one in <config><global>. At the end of the second one, in the <config><global><fieldsets><customer_account> scope, add:


      In this example flavour is the chosen attribute code. The attribute code that you choose here will be important in all the following steps.

    4. Now we need to add the attribute to the Customer Entity Setup Model. To do this, copy the getDefaultEntities method from app/code/core/Mage/Customer/Model/Entity/Setup.php file to a new file, Model/Entity/Setup.php in our module. Put the method inside the following class:

      class Fontis_Customer_Model_Entity_Setup extends Mage_Customer_Model_Entity_Setup

      Then add the following code at the end of the attributes array inside the customer arrray:

      'flavour' => array(
      	'label'		=> 'Ice Cream Flavour',
      	'visible'	=> true,
      	'required'	=> true,

      In this case the new attribute is set as compulsory by adding

      'required' => true,
      to the end of that array. If you want the attribute to be optional, remove the required lines.

    5. The new attribute needs to be added to the Magento database. The best way to do this is to tell Magento to insert it for you. You can either create your own script that uses the Magento code or you can just drop the following code into one of your template files:

      $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
      $setup->addAttribute('customer', 'flavour', array(
      	'label'		=> 'Ice Cream Flavour',
      	'type'		=> 'varchar',
      	'input'		=> 'text',
      	'visible'	=> true,
      	'required'	=> true,
      	'position'	=> 1,

      A handy place to add the above code is the /template/customer/form/register.phtml file since it needs to be edited to add a custom field for the new attribute. Make sure the above code is enclosed with


      To add the attribute (ie. run this code) view the register new customer page. Once you have viewed the page this code can be removed.

      In this example the attribute type is set to varchar and the input is set to text. This needs to be modified to match the requirements of each specific attribute.

    6. At this point, the attribute is installed and it will show up in the backend. We need to modify the frontend, so that the customers can enter values for the custom attribute. There are two fairly similar phtml files:

      /template/customer/form/register.phtml /template/customer/form/edit.phtml

      As a minimum, you need to add a new text box in the register.phtml file, since that is what customers see on the register page. You can add the same text box in the edit.phtml file so that customers can make changes to the original entry that they have made on sign-up. Make sure that the ID and name of the new input text box match the attribute code chosen in step 3. In this case it is 'flavour'. The following shows the sample code that adds a new text box with a label:

    Address details

    If you only want to add fields for address details you are in luck. Those fields are already setup in the template/customer/form/register.phtml file, but they are disabled by an inactive if statement that so far has not actually been linked to anything else in Magento. Therefore to enable the address related fields you simply need to comment out or delete the following statements:

    getShowAddressFields()): ?>



    Note that there are two occurrences of this if statement. One is around the area where the customer actually inputs their data and the other is at the bottom of the file. The first statement shows all the areas for the customer to enter their data and the second statement is around some JavaScript code that sets up the State/Province select.

    Removing phone number field

    One final issue relates to the telephone number field. By default it is considered a required field and that is hard-coded in the input validation function. If you do not want the telephone field to be mandatory (or any other field for that matter), you need to remove the relevant statement from:


    This is the code that needs to be removed from public function validate():

    if (!Zend_Validate::is($this->getTelephone(), 'NotEmpty')) {
        $errors[] = $helper->__('Please enter telephone.');

    In order to make sure that your Magento installation still works properly after you do an upgrade, rather than changing the core file, the safest option is to copy the above file into the following file structure:


    Since files in /local don't get affected when you run upgrades, it means your signup form will work as expected after an upgrade.

    Magento Compatibility

    Post originally written for Magento version:
    Tested with Magento version(s):

    Update: Due to a change in core Magento files the technique for adding custom customer attributes had to be modified. This blog post has been updated accordingly, and current instructions have been tested with Magento -- 16/10/2009


    Charlie - 15 Jul 2009 3:52:15 AM
    Thanks so much for this article Denis. I think I've followed all the steps here, and I've added my input field to the right spot, but I'm not seeing the custom field show up either in the database or in the administration section. After modifying these files, is there anything that needs to be done to sort of apply these changes in Magento?
    Jean-Philippe - 21 Jul 2009 10:58:30 PM
    Very nice tutorial !
    Is there a way to add a customer attribute and make this modification upgrade-proof ?
    In /app/etc/local.xml it's written that this file should not be modified.

    Thanks a lot.
    Adam Moss - 12 Sep 2009 1:05:00 AM
    Hi Denis,

    Have you managed to get this working on the latest Magento yet? I really need to get this as an option but I'm stuck at the moment.
    Jamie - 7 Oct 2009 7:47:18 PM
    I think I love you. I appreciate Magento is built on an MVC, however it seems to be a little less straightforward than say CodeIgniter and consequently, adding custom fields has been a bit of a nightmare!! Thank you for this fantastic tutorial!
    Denis Margetic - 16 Oct 2009 1:40:00 PM
    Apologies for the long delay, but we have finally been able to work out the issues with adding custom attributes. The instructions have changed substantially. If you are still interested, give it a go and let us know if you encounter any further difficulties.
    Denis Margetic - 16 Oct 2009 1:57:24 PM
    We have devised a new technique that works on Magento Please try it out and let us know if there are any problems.
    Federico - 23 Oct 2009 12:21:38 AM
    What about the function getFlavour() that you use int point 6???
    I suppose it'll grab the data from the DB for fill the textfield. but how?
    because if you put it in the edit.phtml you'll get an error cause there is no getFlavour function...

    thanks a lot.

    Anonymous - 25 Oct 2009 10:39:47 AM
    I'm having the same problem as Federico... I'm getting the following error: Call to a member function getFlavour() when I try to run edit account.

    Anonymous - 25 Oct 2009 10:42:46 AM
    Thanks so much for the tutorial. It has provided a lot of insight into the inner workings of magento. However, I can't seem to get edit.phtml to work. I get the following error: Call to a member function getFlavour(). Any ideas?
    Anonymous - 25 Oct 2009 1:46:00 PM
    Figured out my problem from before...

    I was putting <?php echo $this->htmlEscape($this->getFormData()->getFlavour()) ?>

    when I should have put <?php echo $this->htmlEscape($this->getCustomer()->getFlavour()) ?>

    Tyler Sklazeski - 3 Nov 2009 5:06:46 AM
    Curious if anyone has figured out adding this into the one page checkout procedure? I think based on what i've read itwould involve adding fields under billings etc in config.xml and then name of the input field in billings.phtml would change to billings[flavour] in this case -- this is key as most of your customers aren't going to be going to register a account seperate of the checkout process and would be great to figure out.. that being said tutorial worked great, cheers!
    steward - 8 Nov 2009 11:44:16 PM
    If I do this, and you do this, which customer module will Magento choose?
    Are the field lists from different Setups merged at some point?
    You add ice cream flavour, another mod adds shoe size...
    What would we see in the back end... ?

    Although copying the files to local namespace prevents an update from destroying your mod, what if the update has new customer fields?

    Good info posted here thank you.
    Daniel - 15 Nov 2009 10:19:26 AM
    Hi on every tutorial about the attributes i see how to add a new attribute - did every body know how i can update an existing customer_address attribute for example "region" or "country" ???

    For the frontend it is easy to modify the validation of this fields, but i search for a global solution.
    Anonymous - 10 Dec 2009 12:18:40 PM
    Thanks for the tutorial. I am currently running Magento ver. and do not plan on upgrading anytime soon due to numerous custom core code changes I have made. I have created a module from the information above, but I can only see the data from the custom created field via mysql database. I can see it is enabled in my System>Config.>Advanced section, but it's not feeding the feild data into the customer's account info.

    What code do I need to change to make this module show up in my backend for version there an old post I can look at before this one was updated?

    many thanks in advance,
    Anonymous - 11 Dec 2009 11:51:11 AM
    First off, thanks for this tutorial. I went through and i can see the module is working when I look in my SQL database, but do not see any info on the backend being stored/displayed uner the customer info section. I am running magento version, and due to numerous changes I have made to keep magento up and running, I do not plan on upgrading for a while.(4 prior upgrades and every time bad news)

    I see this has been updated for; Do you have a old tutorial for the code changes needed to see the custom stored field data on the back end? Or any suggestions on what code changes are needed? It's getting a little old looking the info up via SQLdatabase everytime. :)

    many thanks,
    Jsqure - 14 Dec 2009 7:03:41 PM
    Very nice tutorial ! Its working well.
    Fred - 17 Dec 2009 11:04:33 PM
    Great post Denis !

    I installed the module by following your instructions step by step and it works well.

    As Tyler suggested, I tried to insert custom field data in the DB from the onepage checkout by editing the billing.phtml file.
    But I had no success although the module was working when creating accounts through the register page.

    Does anyone have an idea on the way to solve this problem ?

    Thanks a lot.

    Prakash - 6 Jan 2010 11:59:28 PM
    Hi Denis,

    This works perfect. Thank you.

    I wanted to make this field to be saved from one page checkout.
    How do I do it?
    Alex - 7 Jan 2010 6:05:27 AM
    Can you be so kind to be more clear at point 4?

    I got setup.php with the followinf line:

    class Mage_Customer_Model_Entity_Setup extends Mage_Eav_Model_Entity_Setup

    public function getDefaultEntities()
    return array(
    'customer' => array(
    'entity_model' =>'customer/customer',
    'table' => 'customer/entity',
    'increment_model' => 'eav/entity_increment_numeric',
    'increment_per_store' => false,
    'attributes' => array(......................................................................

    You say "Put the method inside the following class:", so means at the end of the file to do the following:

    class Fontis_Customer_Model_Entity_Setup extends Mage_Customer_Model_Entity_Setup

    public function getDefaultEntities()
    return array(

    'flavour' => array(
    'label' => 'Ice Cream Flavour',
    'visible' => true,
    'required' => true,




    The comma after the first closing ) should be cancelled?

    Thank you
    Will H. - 12 Jan 2010 9:47:27 AM
    I've done everything listed here but the values just won't take in the database. The field appears on both public and admin, but can only be edited in the admin. Any clues?
    Guillaume - 13 Jan 2010 10:14:37 PM
    What about a checkbox input ? I'm not able to get it to work with a checkbox, I got no errors, but it doesn't save the input. I just changed 'input' => 'text' to "checkbox" and changed the output html in both register and edit forms.

    I can't find any example of checkbox in the eav_attribute table.

    Any help please ?
    Guillaume - 13 Jan 2010 10:43:04 PM
    To complete what I was saying :

    Actually, it's when I want to uncheck the input (which isn't posted in the form, only posted when
    checked), that way, the value for the user is always "on".
    Spi - 14 Jan 2010 12:29:16 AM

    From the backend, no problem to save content of new attribute but impossible to save it from the front-end ?

    Have you any idea ?

    (I got attribute manager extension installed.)


    Spi - 14 Jan 2010 2:23:23 AM
    I use this :

    <?php $customer = Mage::getSingleton('customer/session')->getCustomer(); ?>
    <?php echo $customer->getResource()->getAttribute('flavour')->getFrontend()->getValue($customer); ?>

    It works !

    But unfortunatly, it's impossible to register modification from front end.

    Perhaps can you help me ?

    Jennifer - 15 Jan 2010 12:09:11 AM
    Great post! Is there a way to add this as a drop down menu?
    Doug McCaughan - 20 Jan 2010 7:30:23 AM
    So how do we add a dropdown menu (select box) to the create an account form/process?

    Say on my Create an account I want to show a select with 11 possible job types and have the user indicate their job category as part of the signup process. Using the process above, how do values for the options and the text for the options get created?

    What about checkboxes? Values and text?

    What you wrote above is incredibly helpful! Thank you. It would be complete by showing examples of how to create some other form elements.
    Doug McCaughan - 20 Jan 2010 10:40:32 AM
    For clarification, I've phrased the question a little differently and with examples here:
    Brian - 22 Jan 2010 10:28:54 AM
    Same thing for me. The fields show up on both the frontend and in the admin panel. When a new account is created none of the data entered into the new fields is saved however. If I go into the admin panel and manually put in the information for the customer it does save correctly there though. For some reason on the frontend its just not saving any of the information for the new fields to the database.
    Brian - 22 Jan 2010 12:47:58 PM
    Found the problem and why it probably only affects certain users. If you go here:

    It says this in part of the document:

    Note2: It seems that currently, if you use upper case characters in module names (expecting to show word starts since neither - nor _ is allowed)... the install will fail or rather the module will not work. Suggestion: use a single upper case character, at the beginning of the name.

    The problem I had was that I named the module like ModuleName_WholesaleCustomer

    When I did that everything appeared to work, but on the frontend it was not taking in the new data that people were filling out. So by changing the above to:


    and all the values within the files to match the problem is now fixed! Everything works great now! So the just remember that you can only use a capital letter on the first letter, everything else must be lowercase!
    Spi - 1 Feb 2010 9:06:20 PM
    Same problem for me...
    alandubs - 5 Feb 2010 3:32:11 AM
    Thanks for this article. I used it to add some more checkboxes to customer preferences.
    At first it wasn't saving anything and I had to modify the controller (newsletter/controllers/ManageController.php) to save the values. Somewhere I read that you don't have to do this, but I found that I did. It was quite simple in my case, just find the action which is saving, in my case saveAction and set the extra fields.

    ->setIsSubscribed((boolean)$this->getRequest()->getParam('is_subscribed', false))
    ->setNewfield((boolean)$this->getRequest()->getParam('newfield', false))

    Of course you have to point the form action to the new controller too ;)
    Jeremy Champion - 5 Feb 2010 4:49:00 PM
    Hi Will H, Brian and Spi,

    Basically, when a customer saves the account create or edit form, Magento goes through a list of all the attributes that it knows it needs to save on the customer. It matches this attributes with fields on the form, and saves everything. Therefore, if the saving isn't working, there are two main things to check. Firstly, check that the name and id fields of your form elements are correct. If they are, then the other possible problem is that you have not added your new attribute to the list correctly. This is detailed in step 3 which shows how to add it to the list. It's also possible that you haven't created your module properly, which would be causing your attribute not to be in the list. For a quick check that your module is correct, rather than editing the config file that you copied into the local scope, you can try adding your attribute to the original file in the core scope. This is not a long-term solution, but is a quick and dirty way of determining whether the local module loading is the source of the problem.
    Jeremy Champion - 5 Feb 2010 4:53:00 PM
    I don't quite understand what you are trying to achieve with that piece of code, could you elaborate on where the code is placed and what it is supposed to do?
    Jeremy Champion - 5 Feb 2010 5:02:00 PM
    It is possible, though unfortunately, the checkout isn't really designed to take extra fields. What happens is the new customer isn't actually created until you submit the order. So, between when the customer enters their address details and when the customer object is actually created the data they enter needs to be stored somewhere temporarily. One way to address this is by making some database changes to add columns to one or two of the order tables. We'll see if we can address this in a future post.
    Jeremy Champion - 5 Feb 2010 5:10:00 PM
    You are quite correct pointing out the namespace issues between different modules. Magento's behaviour when it comes to this is fairly straightforward. If something in core is overridden by a something in local, the local one takes preference. The problem becomes that if two modules in local override the same thing in core, only one of them will actually be used. It seems that when this situation arises, Magento gives preference to whichever module name is first <i>alphabetically</i>. For example if <code>Fontis_Australia</code> and <code>Fontis_Customer</code> were both to override the same <code>Core_Customer</code> config file, the <code>Fontis_Australia module</code> would be used and the <code>Fontis_Customer</code> would not.

    To avoid this, the trick is to override the least amount of code that you can, and avoid repeating core code in your own modules whenever possible. Yes, if a new version of Magento comes out with a new custom customer attribute this attribute won't be loaded, but to make it loaded you just have to put the relevant lines of code from the core config file into your local config file.
    Jeremy Champion - 5 Feb 2010 5:16:00 PM
    If you look at step 5 of the post, we use $setup->addAttribute() to add the attribute to the database. You can use that same function to modify existing attributes as well. Just put in the attribute code that you want to edit and you can then make the changes to it that you want with the parameters in the array.
    Jeremy Champion - 5 Feb 2010 5:26:00 PM
    If the customers information is being saved but is not showing up in the admin panel, then there are two possible causes. One is that step 5 where you run the $setup->addAttribute() method didn't work correctly. The other problem could be that you did run this code, and it worked, but the attribute wasn't made visible. In this case you can safely run the code again but specify 'visible' => true as one of the array parameters.
    Jeremy Champion - 5 Feb 2010 5:32:00 PM
    As I replied to Tyler's message, it takes more than just editing the phtml file to get the attributes to save on a customer. This is probably worthy of a blog post on its own, which I may be able to address in the future.
    Jeremy Champion - 5 Feb 2010 5:34:00 PM
    The code should work as is. The comma isn't required and it would be a bit neater to remove it, but functionally it shouldn't make any difference.
    Brady - 10 Feb 2010 11:00:47 AM
    Wow - great post! This works flawless (so far, at least).

    Two questions:

    1) Is there any way to include a product drop-down (for Product Registration purposes)

    2) Is there a way to have a date/calendar pop-up similar to the date selection feature in the Admin section, so users can select a date and have it stored in the database?

    Thank you!

    Brady - 10 Feb 2010 11:06:20 AM
    Another question - Would would be the "proper" way to adjust the input-box widths on the registration form? Apply a CSS class and set the width in CSS?

    Denis Margetic - 10 Feb 2010 12:07:46 PM
    Applying a CSS class and setting the width using CSS is the commonly accepted method.
    Jeremy Champion - 22 Feb 2010 10:23:00 AM
    <p>Unfortunately, this is a bit more complicated than it looks, and in fact using other form elements for attributes on customers (and products and most anything else) probably warrants its own blog post that hopefully I can address in the future. In brief, to create a select box for a customer attribute you need to use the source_model attribute of the attribute. Have a look at the way the attribute is handled for the [code]is_anchor[/code] attribute on categories. You can use the same source model for any checkboxes that you want as well. The source file for the attribute is [code]app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Boolean.php[/code]. There are also customer specific source models in the [code]app/code/core/Mage/Customer/Model/Customer/Attribute/Source/[/code] and the [code]app/code/core/Mage/Customer/Model/Entity/Address/Attribute/Source/[/code] directories. You also might need to make some backend models so that the attributes display correctly in the backend. The backend models are displayed in the Backend directories 'next to' the Source directories.</p>
    Jeremy Champion - 22 Feb 2010 12:42:00 PM
    <p>As I replied to Brian, to use a drop down for your attributes, you need to use the [code]source_model[/code] attribute of your attributes to be able to use a drop down. For your particular case (having the drop down populated by products) I'd make the attributes type int which will store the products id. Then, in the custom source model you create use a collection to select the list of products (You might find Chris' post on the <a href="">efficient use of collections</a> helpful for this) and iterate across the list of products producing an array that is in the same format as the one in the Boolean source file.</p>

    <p>As for the calendar, the best thing I can suggest is that you look at how the calendar has been achieved in other frontend areas. Briefly, you need to include the calendar block into your page (which has a number of definitions in it), include the calendar JavaScript and the relevant skin CSS files into the page, create an image for the user to click on and then in JavaScript instantiate the calendar.</p>
    Joost - 18 Mar 2010 3:38:56 AM
    In the edit template the code should be slightly different:

    <div class="input-box">
    <label for="flavour"><?php echo $this->__('Favourite Ice Cream Flavour') ?><span class="required">*</span></label><br />
    <input type="text" name="flavour" id="flavour" value="<?php echo $this->htmlEscape($this->getCustomer()->getFlavour()) ?>" title="<?php echo $this->__('Flavour') ?>" class="required-entry input-text" />

    getFormData has become getCustomer!
    ELminister - 18 Mar 2010 4:31:52 PM
    dont forget to add your new fields in app\code\core\Mage\Customer\etc\config.xml under <customer_account>
    rask - 21 Apr 2010 8:25:31 PM
    Same problem for me... somene can help us?
    I can save new attribute on admin, not in register form...
    vrnet - 26 Apr 2010 5:01:00 AM
    This post deals with a thing that didn't get any real answer in this thread : using checkboxes for custom registration fields

    This will display a checkbox on the frontend and a "Yes/No" select in the backend.
    Let's say we want to know if the customer likes (or not) the chocolate flavour.

    At step 3.


    At step 4.

    'chocolate' => array(
    'label' => 'Do you like chocolate',
    'type' => 'int',
    'input' => 'select',
    'visible' => true,
    'required' => true, // or false
    'source' => 'eav/entity_attribute_source_boolean',

    At step 5.

    $setup->addAttribute('customer', 'chocolate', array(
    'label' => 'Do you like chocolate',
    'type' => 'int',
    'input' => 'select',
    'visible' => true,
    'required' => true, // or false
    'position' => 1,
    'source' => 'eav/entity_attribute_source_boolean',

    At step 6.

    For register.phtml, add

    <div class="input-box">
    <label for="chocolate"><?php echo $this->__('Do you like chocoalte') ?><span class="required">*</span></label><br />
    <input type="checkbox" name="chocolate" id="chocolate" value="1" title="<?php echo $this->__('Do you like chocolate') ?>" class="class="required-entry checkbox" />

    For edit.phtml, add

    <div class="input-box">
    <label for="chocolate"><?php echo $this->__('Do you like chocoalte') ?><span class="required">*</span></label><br />
    <input type="checkbox" name="chocolate" id="chocolate" value="1" title="<?php echo $this->__('Do you like chocolate') ?>" <?php if($this->getCustomer()->getChocolate()==1): ?> checked="checked"<?php endif; ?> class="class="required-entry checkbox" />

    We also need to modify the AccountController.php file (best practice is to override it to prevent from loosing modification on core updates)

    Around line 583, change

    foreach ($fields as $code=>$node) {
    if ($node->is('update') && isset($data[$code])) {
    $customer->setData($code, $data[$code]);

    $errors = $customer->validate();


    foreach ($fields as $code=>$node) {
    if ($node->is('update') && isset($data[$code])) {
    $customer->setData($code, $data[$code]);

    $customer->setChocolate((boolean)$this->getRequest()->getParam('chocolate', false));

    $errors = $customer->validate();

    An we're done. Tested on Magento
    vrnet - 26 Apr 2010 5:47:00 AM
    Here is another how-to dealing with the way to add our custom registration field to the checkout process and pushing it to the customer account on order validation.

    The hack is to add the "Flavour" field to the billing address step of the Onepage Checkout.

    For this, we need to override the Sales module.

    First, follow steps 1. and 2. but reading/using/writing "Sales" instead of "Customer"

    Then, in app/local/.../Sales/etc/config.xml, around line 153 :




    Then we need to modify the Sales/Model/Convert/Quote.php file (best practice is to override it in order not to lose our changes on core updates)

    Modify the public function addressToOrder() (around line 66) like this :

    public function addressToOrder(Mage_Sales_Model_Quote_Address $address, $order=null)
    if (!($order instanceof Mage_Sales_Model_Order)) {
    $order = $this->toOrder($address->getQuote());

    if(!Mage::helper('customer')->isLoggedIn()) {
    $quote = $address->getQuote();
    $customer = $quote->getCustomer();
    $flavour = $address->getFlavour();

    Mage::helper('core')->copyFieldset('sales_convert_quote_address', 'to_order', $address, $order);

    Mage::dispatchEvent('sales_convert_quote_address_to_order', array('address'=>$address, 'order'=>$order));
    return $order;

    At last, we need to add the "Flavour" field to the billing step of the One Step Checkout.

    Add the following lines to your theme's checkout/onepage/billing.phtml file where you want the "Flavour" field to appear :

    <?php if(!$this->helper('customer')->isLoggedIn()) : ?>
    <div class="field">
    <label for="billing:flavour"><?php echo $this->__('Favourite Ice Cream Flavour') ?></label>
    <div class="input-box">
    <input type="text" id="billing:flavour" name="billing[flavour]" value="" title="<?php echo $this->__('Favourite Ice Cream Flavour') ?>" class="input-text" />
    <?php endif; ?>

    Please note that the goal of this how-to is to add a customer-account-wide "Flavour" field rather than an address-wide field (like a "mobile phone" field would be). So, once the "Flavour" field has been set at the customer's first order, it will not be available at checkout for further orders. This explains the use of "isLoggedIn()".

    My favourite Ice Cream flavour is Ben & Jerry's chocolate and macadamia nuts!
    Tested on Magento
    Anonymous - 26 Apr 2010 11:21:42 PM
    Thanks frome a french guy !!
    seeal - 14 May 2010 1:58:49 AM
    yes this fixed :D!!!
    nesh - 23 Jun 2010 2:24:00 AM
    Thanks for sharing, works great on 1.4.

    Only thing I'm still missing is how to set new attributes to show as dropboxes in admin - like country dropbox for example.
    Didier berlioz - 13 Aug 2010 7:25:27 PM
    alandubs, did you do that to add the ability to let new customer subscribe to more than one newsletter? If yes, could you give more details on how you did it?

    MageLearner - 21 Aug 2010 12:12:07 AM
    I have followed your instructions to add this as a checkout step but the flavour does not appear in the admin, what am I missing? Also is it possible to show Flavour in a customers order email?
    bAjA - 1 Sep 2010 6:11:28 AM
    Works perfectly for me with version - thank you very much... I have one question - do you know how I could now display these variables in an email template ?
    Ali - 13 Sep 2010 8:16:20 PM
    I am having a problem with this in,
    I have double checked everything but I still cannot get it working on the front end.
    The input boxes show up and I can add/edit the value from the admin side, but whenever a customer registers it doesn't add the value to the database.

    Does anyone know what this problem may be caused by?

    Anonymous - 6 Oct 2010 6:03:00 PM
    did you manage to solve your problem in 1.4? because i have the same problem :(
    gino0o0o - 9 Oct 2010 4:17:11 AM
    I tried the code, but it don't work under Magento 1.4.1...the custom address field was saved only from the account page...

    Thundar - 3 Nov 2010 9:10:39 PM
    I get the same problem stated by many. It didn't saved the new field by adding or editing a customer in the frontend. Everythink worked from the backend. Somehow was used the config.xml from Mage/Customer instead of the new one created. I just added the new field on the Mage's one, even if this is not a great solution.
    mrfroasty - 10 Nov 2010 2:02:56 AM
    Usefull post, many thanks!
    Denys - 4 Dec 2010 5:21:00 PM
    In "register.phtml" I entered:

    <code lang="php">
    <label for="flavour">
    <?php echo $this->__('Flavour') ?>
    <span class="required">*</span>
    <br />
    <input type="text" name="flavour" id="flavour" value="<?php echo $this->htmlEscape($this->getFormData()->getFlavour()) ?>" title="<?php echo $this->__('Flavour') ?>" class="required-entry input-text" />


    In "edit.phtml" I entered:

    <code lang="php">
    <label for="flavour"><?php echo $this->__('Flavour') ?>
    <span class="required">*</span
    <div class="input-box">
    <input type="text" name="flavour" id="flavour" value="<?php echo $this->htmlEscape($this->getCustomer()->getFlavour()) ?>" title="<?php echo $this->__('Flavour') ?>" class="required-entry input-text" />

    Works on Magento!!!! Finally!!! Now I can go to sleep!

    Sorry my horrible english... : (
    Freddy - 6 Dec 2010 10:35:39 PM
    Great Post - Thank you very much!!

    I basically had the same issue that the elements werent stored when inserted via register or edit i.e. the Frontend. The issue was just that my module wasnt properly setup.
    Justin - 30 Dec 2010 2:25:41 AM
    This is a great tutorial! However it no longer works on Magento :( Does anyone have any ideas on how to get this to work with
    Edward - 18 Feb 2011 10:29:00 PM
    Thanks so much Denis, just what I needed, I had it all working other than that, and this has fixed it.

    JoeP - 19 Feb 2011 3:32:45 AM

    This is a beautifully written tutorial and I've followed it through with no obvious errors for magento ...


    At step five, upon running the php to add the variable to the db... it says that the variable should now be visible in the back end (I presume this means the customer management pages)... and it isn't...

    Furthermore, upon following the tutorial through and registering a new customer with the new variable (existing customer code)... there is still nothing visible in the backend... yet again, no obvious errors.

    Did I miss something?
    Comments are closed for this post