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.

benmarks
  • 16,675
  • 4
  • 41
  • 108
mcoder
  • 713
  • 2
  • 15
  • 37

1 Answers1

1

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

Amit Bera
  • 77,456
  • 20
  • 123
  • 237