0

I am using this event in the customer create account page: controller_action_predispatch_customer_account_create

I am trying to load a customer attribute here and I want to change its value. I tried smth like this:

$observer->getEvent()->getAttributeText('customer_attribute_code'); 

But it is null. Is there a way to load a customer attribute and change its value using an observer ? thx

  • Try loading the value as below: $controller = $observer->getControllerAction(); $controller->getRequest()->getPostValue(); – mp196 Oct 17 '16 at 13:14
  • I got this: Fatal Error: Call to undefined method Mage_Core_Controller_Request_Http::getPostValue() – Attila Naghi Oct 17 '16 at 13:15
  • i guess you should be using event as controller_action_predispatch_customer_account_createpost – mp196 Oct 17 '16 at 13:17
  • should i use an event before the page load ? cuz i want to change a customer attribute value, so when the user clicks on the registration page will get the customer attribute value what i set in the observer – Attila Naghi Oct 17 '16 at 13:20
  • Its a custom customer attribute, which was added . It is not relevant which one :) – Attila Naghi Oct 17 '16 at 13:34

Your Answer

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

Browse other questions tagged or ask your own question.