2

I want to add customer group dropdown option to customer registration

I had added below observer code for it. I added dropdown of all customer group in registration form with name (for example cgroupuser), but my code is not working:

class Customere_Group_Model_Observer
{
    public function customerRegisterSuccess(Varien_Event_Observer $observer)
    {       
        try {

            $customer = $observer->getEvent()->getCustomer();
            $customer->setData('group_id', $_POST['cgroupuser']); // or whatever the group id should be
            $customer->save();

        } catch ( Exception $e ) {}
    }
}

What am I missing? If I put static val $_POST['cgroupuser'] it works fine.

1 Answer 1

1

sauravm,Plese use Mage::app()->getRequest()->getParam('cgroupuser') instead of $_POST['cgroupuser']

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.