Step 1: go to app/code/core/Mage/customer/etc/config.xml and add the following code
<fieldsets><customer_account> <group_id><create>1</create><update>1</update></group_id> </customer_account></fieldsets>
Step : 2 Now go to register.phtml which resides app/design/frontend/your_interface/Your_theme/template/customer/form/Register.phtml and write the following code under the section where you wan't to put.
<li> <label for="customer_groups" class="required"><em>*</em><?php echo $this->__('Customer Groups') ?></label> <select name="customer_groups" id="customer_groups" title="<?php echo $this->__('Customer Groups') ?>" class="validate-group required-entry input-text"> <?php $cu_groups = Mage::helper('customer')->getGroups()->toOptionArray(); ?> <?php foreach($cu_groups as $cuGroups){ ?> <option value="<?php echo $cuGroups['value'] ?>"><?php echo $cuGroups['label'] ?></option> <?php } ?> </select> </li>
Step 3: open accountcontroller.php in app/code/core/mage/customer/controllers/accountcontroller.php and add the following code in the "initialize customer group id" part
<?php $customer->setGroupId($this->getRequest()->getPost('customer_groups')); ?>
now you can get the customer group field while registering account.
Hope it Helps.. Thanks....
No comments:
Post a Comment