Friday, 20 September 2013

Magento Add ‘Customer Group’ to Registration Form

Step -1
customer/form/register.phtml Add


<div>
<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>

Step-2

Mage\Customer\controllers\AccountController.php
line no 287 add
$customer->setGroupId($this->getRequest()->getPost(‘group_id’));

Step-3

Mage\Customer\etc\config.xml
Add customer_account node
<group_id><create>1</create><update>1</update></group_id>


No comments:

Post a Comment