0

I am a newbie, could you please explain the last step of this tutorial? How can I retrieve it? Adding custom attribute to Customer

Then to retrieve or edit you use:

$customer = Mage::getModel('customer/customer')->load($custid);
$customer->getCustomattribute();
$customer->setCustomattribute($yourjson);
0

this talks about setting and retrieving the value for the customer attribute you just added.

$customer = Mage::getModel('customer/customer')->load($custid);

retrieves the customer instance from the db.
And on this object you can call

 $customer->getCustomattribute();

and you will get the value of the custom attribute you just added.

To set a value for the custom attribute just call

$customer->setCustomattribute($yourjson);

If you want your new value to be persisted in the db you need to call $customer->save() after setting the value for your attribute.

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.