1. Home
  2. Prices
  3. Guided Tour
  4. New Shop
  5. Shop Review
  6. Ecommerce Marketing
  7. Ecommerce TV
  8. Magento Developers
  9. Portfolio
  10. Blog
  11. Contact
Home > Magento > Customer Group Registration

Customer Group Registration

Posted on: 29th Jan 2010 By: Adam Moss Leave a comment 3 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 from app > code > core > Mage > Customer > etc > config.xml 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

3 Responses to “Customer Group Registration”

  1. CodeSoda

    Ello,

    Im using ver. 1.3.2.4 and I cannot locate a config.xml in the layout folder, is there another xml that I can place this onto? The 2nd part of your post I can get to show, but it doesn’t submit with the customer sign up form, and I’m assuming it may have to be something with the xml (although im not sure why you have all “1″ on the values, i possible could you explain a little more?)

  2. CodeSoda

    actually i was able to get this to work correctly, instead of looking for a config.xml in teh layouts, i added it to app\code\code\Mage\Customer\etc\config.xml

    under line 96, just an fyi for anyone else, btw thanks for the info

  3. Adam Moss

    CodeSoda, thanks for your correction. I have updated the post with the correct file location.

Post A Comment