1

I have a customer attribute named "tescoclubcard_number", the attribute is not displayed in customer model whereas is displayed in collection.

Can anyone please let me know how i can save the customer attribute value. To load the customer data i have done below:

$custData = $order->getData();
$custEmail = $custData['customer_email'];
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$data = $customer->loadByEmail($custEmail);

in data i am not getting the attribute "tescoclubcard_number" whereas it is there in collection.

Please let me know how i can save it.

EDIT

Another problem i am facing is, when i store tescoclubcard_number value in session and complete the payment using sagepay server the session values are destroyed. Is there a way to keep sessions in tact and use them on success page?

3

You can get the customer attribute value by following:

$customerObj  = Mage::getModel('customer/customer')->load($customer_id);
$attr = $customerObj->getData('tescoclubcard_number');

check out: How to get the customer attribute value?

  • Hi, Thanks for your answer.. but the thing is that i need to set the tescoclubcard_number value and setData('tescoclubcard_number') = "123" is not working – Dexter Dec 29 '15 at 14:44
  • 1
    @Dexter after that, try $customerObj->save(); see reference: stackoverflow.com/questions/16845039/… – Fayyaz Khattak Dec 29 '15 at 14:54

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.