Skip to main content
edited tags
Link
Fabian Schmengler
  • 66.1k
  • 25
  • 188
  • 422
Source Link
Sukeshini
  • 10k
  • 18
  • 73
  • 126

Customer attribute is NULL?

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;
$customer->setSubAdminIds($newAdminIds)->save();

And the admin panel when I try to retrieve it.

$collection = Mage::getResourceModel('customer/customer_collection')
            ->addNameToSelect()
            ->addAttributeToSelect('email')
            ->addAttributeToSelect('created_at')
            ->addAttributeToSelect('group_id')
            ->addAttributeToSelect('sub_admin_id')
            ->addAttributeToFilter('sub_admin_ids', array('notnull' => true));

Above collection returns empty.