I have followed every tutorial I have found and doesn't work. I am trying to add the customer groups on the customer registration page but its not working. I hope this question will help others also as all the previous questions based on this are too old. Please, check below my code:
app/code/core/mage/customer/etc/config.xml
<global>
..........
<customer_account>
<group_id>
<create>1</create>
<update>1</update>
</group_id>
</customer_account>
..........
</global>
app/code/core/mage/customer/controllers/AccountController.php
Replace this
$customer->getGroupId();
with
if($this->getRequest()->getPost('group_id'))
{
$customer->setGroupId($this->getRequest()->getPost('group_id'));
}
else
{
$customer->getGroupId();
}
app/design/frontend/base/default/template/persistent/customer/form/register.phtml
<div class="input-box">
<label for="group_id"><?php echo $this->__('Group') ?><span class="required">*</span></label><br/>
<select name="group_id" id="group_id" title="<?php echo $this->__('Group') ?>" class="validate-group required-entry input-text" />
<?php $groups = Mage::helper('customer')->getGroups()->toOptionArray(); ?>
<?php foreach($groups as $group){ ?>
<option value="<?php print $group['value'] ?>"><?php print $group['label'] ?></option>
<?php } ?>
</select>
</div>