0

I have used below code to update the custom column in customer_entity table, but the values are not updating in database.

$customer = Mage::getModel('customer/customer')->load($customerId);
                    $customer->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
                    $customer->setLoginActive(0);

                    $customer->save();

It seems to be the save() is Failing. I have checked by Clearing the var/cache folder too.

  • What you is you custom attribute of customer??? $customer = Mage::getModel('customer/customer')->load($order->getCustomerId()); $customer->setWebsiteId(Mage::app()->getWebsite()->getId()); $customer->setCustomAttribute('887475748'); try { $customer->save(); print('Saved: '.$customer->getStripeCustomerId()); } catch (Exception $e) { Mage::throwException($e->getMessage()); } – Dhrumin Jul 20 '16 at 11:57
  • I have login_active custom column in table, I am doing this from admin controller. – user2520 Jul 20 '16 at 12:14
  • You can do this code in controller action. First create customer object and then set custom value and save it. – Dhrumin Jul 21 '16 at 4:41
  • Yeah, I am using this in my custom controller action only Dhrumin, I am doing this for admin customer edit page. – user2520 Jul 21 '16 at 5:14
  • So it's not working???? please share your controller code. – Dhrumin Jul 25 '16 at 11:23
0

Finally, I fixed by created Customer attribute with same name and now i can able to save the attribute.

Your Answer

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