I have created a new attribute for customers. Whenever customer will do an order at the event when he clicks on the 'Place Order' button, I'm saving some value for this attribute. But when I try to retrieve that attribute value in admin panel, it's NULL. Even the attribute is not showing when I try to get all attributes of that customer. How to resolve this? I want to access that attribute value in admin panel.

My Observer.php contains following code snippet to save that attribute.

$customer = Mage::getSingleton('customer/session')->getCustomer();
$newAdminIds = 4;

And the admin panel when I try to retrieve it.

$collection = Mage::getResourceModel('customer/customer_collection')
            ->addAttributeToFilter('sub_admin_ids', array('notnull' => true));

Above collection returns empty.

3 Answers 3


Probably you should try below

$customerId = Mage::getSingleton('customer/session')->getId();
$customer = Mage::getSingleton('customer/customer')->load($customerId);
$newAdminIds = 4;
  • In observer that customer attribute is saving, But I can't access it in admin panel.
    – Sukeshini
    Commented Mar 12, 2015 at 5:10
  • Can you see stored value of attribute in database table?
    – shabbir
    Commented Mar 12, 2015 at 5:15

New customers do not have a account the first time if they create it in the checkout. You should take the quote to order point of view.

Did you check:

  • If the attribute(s) is really created?
  • That sub_admin_ids sub_admin_id is set during save?

Place a observer on the sales_convert_quote_to_order. This is triggered when placing a order.

You could check if the customer should be created. $quote->getData('customer_is_guest') will return 0/null/false(not true ;-)).

Use $quote->getCustomer()->setData('custom_field', 'my_value') to set this field.


Let me start by saying Magento has a way with how they want things. You are most likely creating the attribute for the customer correctly however if it is set to null like you say it is it will NOT show up when you try and display it. I know, scary.

Quick fix to check if its there is:

$customer = Mage::getModel('customer/customer')->load($customerId);
$customer->setData('nameOfAttribute', 'valueYouWantForAttribute')
$customer = Mage::getModel('customer/customer')->load($customerId);


If this doesn't work I'll look further into it I had a similar problem before.

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.