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.