I have followed a tutorial and created a custom customer attribute which I have added to the registration form from the file: persistent/customer/form/register.phtml

I have this code to process the new attribute:

    <label for="job_title" class="required"><em>*</em><?php echo $this->__('Job Title') ?></label>
    <div class="input-box">
        <input type="text" name="job_title" id="job_title" value="<?php echo $this->escapeHtml($this->getFormData()->getJobTitle()) ?>" title="<?php echo $this->__('Job Title') ?>" class="input-text required-entry" />

This works fine and updates the attribute when the form is submitted. I am however trying to do the same on the onepage checkout registration form. I have edited the file: onepage/billing.phtml

and added the same code, however this breaks the checkout. I believe the error to be caused by this line:

<?php echo $this->escapeHtml($this->getFormData()->getJobTitle()) ?>

I am unsure how to check the right functions for this to work. I have looked at the sql file for the module which created the modules and checked that this attribute can be used in the relevant forms:


    $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);


How can I get this custom customer attribute to display on the onepage registration form? This is a Customer and not Customer Address attribute. Any help is much appreciated.


Below is the code which I have used in the module.

This is the script which is in the sql directory of the module (here there are other custom attributes which I created but this is the code for the "job_title" attribute:

$installer = $this;

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

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



$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);


The "Helper" directory has this code in a file called "Data.php":

class Mymodule_Customerattributes_Helper_Data extends Mage_Core_Helper_Abstract

The "config.xml" file has this:

<?xml version="1.0"?>

Some names such as the module name has been changed as it contained my employer's company name. The structure is the same though.

Thank you.

2 Answers 2


When you say this is Customer attribute, then this will get the values of logged in customer only, if this what you want, you should use the following code in onepage checkout files:


This code will first get the customer from the quote then will get the related value for Job title. Use the name of the input field as:

<input type="text" name="billing[job_title]" id="job_title" value="<?php echo $this->escapeHtml($this->getQuote()->getCustomer()->getJobTitle()) ?>" title="<?php echo $this->__('Job Title') ?>" class="input-text required-entry" />

and in the config.xml, add the following code in global tag:


not tested but the fieldsets part should do the job.

  • Thanks for the help, I tried this code and while it lets me finish the checkout the "Job Title" attribute isn't updating. Just to confirm the "attribute_code" in the "eav_attribute" table in the database for this is "job_title". Do you have any other suggestions to check?
    – HannaMan
    Jul 25, 2014 at 11:52
  • if its a customer attribute, I will assume it static. Is the quote and / or sales table was altered to include job_title as a column?
    – MTM
    Jul 25, 2014 at 12:02
  • Usually magneto customer attributes are stored in the EAV structure, tables customer_entity_*
    – Amasty
    Jul 25, 2014 at 13:14
  • Which tables should I specifically check? When I done the tutorial it only mentioned about them being stored in "eav_attribute". The table "customer_eav_attribute" does have a reference to this attribute's id.
    – HannaMan
    Jul 25, 2014 at 13:23
  • can you please updated your question by posting the code that was used to create this attribute?
    – MTM
    Jul 25, 2014 at 13:38

You can use this module https://www.magecheckout.com/magento-customer-attributes.html to add new customer attributes

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.