1. Home
  2. Prices
  3. Guided Tour
  4. New Shop
  5. Shop Review
  6. Ecommerce Marketing
  7. Portfolio
  8. Blog
  9. Contact
Ecommerce Fox

Ecommerce Web Design & Magento Blog

Welcome to our blog, this where you'll find news, reviews and tutorials on all things ecommerce and Magento. If you like what you see, join in with the discussion and be sure to subscribe.

Home > Magento > Customer Group Registration

Customer Group Registration

Posted on: 29th Jan 2010 By: Adam Leave a comment No Comments

A feature that is absent from the Magento frontend is the ability for a customer to choose which customer group they belong to during registration, no different to what is available to the admin when they choose to register new customers. This can be quite important in instances where you wish to apply different tax rules to different types of customer. For example you might have General Customers and VAT Exempt customers.

To enable this ability is actually extremely simple. Firstly, XML. Open config.xml in the layouts folder and add the following line of code into the customer account fieldset:

<fieldsets>
<customer_account>
<prefix><create>1</create><update>1</update><name>1</name></prefix>
<firstname><create>1</create><update>1</update><name>1</name></firstname>
<middlename><create>1</create><update>1</update><name>1</name></middlename>
<lastname><create>1</create><update>1</update><name>1</name></lastname>
<suffix><create>1</create><update>1</update><name>1</name></suffix>
<email><create>1</create><update>1</update></email>
<group_id><create>1</create><update>1</update></group_id>
<password><create>1</create></password>
<confirmation><create>1</create></confirmation>
<dob><create>1</create><update>1</update></dob>
<taxvat><create>1</create><update>1</update></taxvat>
</customer_account>
</fieldsets>

Now you need to add code to the frontend of the store, in the registration form. Open template/customer/form/register.phtml and add the following code somewhere in the form:

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

That’s all there is to it – customers can now choose which group they belong to during sign up.

  • Twitter
  • AIM
  • WordPress
  • LinkedIn
  • Facebook
  • StumbleUpon
  • Technorati Favorites
  • Delicious
  • Ping
  • Digg
  • Bebo
  • Reddit
  • MySpace
  • NewsVine
  • Google Bookmarks
  • Sphinn
  • Propeller

Post A Comment