I am trying to save life time savings as customer attribute. After every successful purchase, I am incrementing the value.

To create the attribute I have below install script

$installer = $this;

$installer->addAttribute("customer", "life_time_total_saving",  array(
    "type"     => "varchar",
    "backend"  => "",
    "label"    => "Life Time Savings",
    "input"    => "text",
    "source"   => "",
    "visible"  => true,
    "required" => false,
    "default" => "",
    "frontend" => "",
    "unique"     => false,
    "note"       => ""


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


        $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", 0)
        ->setData("sort_order", 100)




After running this script, I can able to see attribute created in eav_attribute but in customer object I cant find the same.

below is my script inside mycustomer dashboard.phtml

$customerData = Mage::getSingleton('customer/session')->getCustomer();
echo '<pre>'; print_r($customerData);

But the object printed does not have the field life_time_total_saving.

Whats wrong with my code?


Please make sure is_visible field value 1

 ->setData("is_visible", 1)
  • I have written a upgrade script with is_visible field but its not working – Butterfly Jan 26 '16 at 15:22
  • Thanks for your help. Since no value stored for the user, it is no reflecting on customer object. +1 for your help – Butterfly Jan 26 '16 at 15:48
  • you are welcome – Amit Bera Jan 26 '16 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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