Thursday, July 7, 2011

How to add group in register form

in magento 1.5+ go to the
app\design\frontend\base\default\template\customer\form\register.phtml
add following code in the page

<div class="input-box">

<label for="group_id" class="required"><?php echo $this->__('Group') ?><em>*</em></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>

<br /><p class="required" style="float:left;">Retailer group require admin authentication </p>

</div>


also change some code in app\code\core\Mage\Customer\controllers\AccountController.php

now replace $customer->getGroupId(); with

if($this->getRequest()->getPost('group_id'))
{
$customer->setGroupId($this->getRequest()->getPost('group_id'));
}
else
{
$customer->getGroupId();
}

17 comments:

  1. ooooh maaaan... how easy is that? and i was ripping out my hair! thanks mate!

    ReplyDelete
  2. hi, i have add the code on register page and all the Groups going to display but same problem occur when i have apply this code:
    f($this->getRequest()->getPost('group_id'))
    {
    $customer->setGroupId($this->getRequest()->getPost('group_id'));
    }
    else
    {
    $customer->getGroupId();
    }

    the group value is not saved in database.. waiting for your response

    ReplyDelete
    Replies
    1. Please check the following link hope it will help
      http://sapnandu-magento.blogspot.com/2014/01/add-customer-group-in-registration-page.html

      Delete
  3. Instead of editing magento core files how can i override base class & add the fields on the registration page?????? please Help.....

    ReplyDelete
  4. localhost/magento/shoe
    localhost/magento/furniture
    localhost/magento/computer

    I have created store for individual website.

    I know the login option of the 3 website will be the same.I dont have to make different login box.

    just for example:

    When I go :localhost/magento/shoe
    there will be a login option.
    Any customer go to that site and he can registered as well he can entered into the the shoe website.


    Similar way for next two the same case will occur.
    So here we dont need to make different login boxes.

    Upto that section i have done.

    Now there is requirement to have a Retail Shop:
    Under localhost/magento(Which is the main domain) there will a section for retailer to create an account and to login into his account.
    This retailer has the option to control above all 3 website as mentioned above.

    I want another login option for this retail shop.
    How can i do that.Please guide me

    If you still have doubt then please let me know... Thanks in advance

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Group value will be stored in db but not displayed in backend.Pls help me.

    ReplyDelete
  7. Group value will be stored in db but not displayed in backend.Pls help me.Nice to work frond end only

    ReplyDelete
  8. You can simply observe the event: customer_save_before. If you want a ready made solution you can use 'Customer Group Selector' - It allows customers to select their required customer group at registration & checkout, using group dropdown or group code.:
    http://www.magepsycho.com/customer-group-selector-switcher.html

    ReplyDelete
  9. The blog was absolutely fantastic! Lot of great information which can be helpful in some or the other way. Keep updating the blog, looking forward for more contents...Great job, keep it up..
    magento development company in bangalore 

    ReplyDelete
  10. Nice post content is impressive to read ,Thanks for proving some helpful information.Hope you will keep on sharing articles.
    This provides good insight. You might also be interested to know more about generating more leads and getting the right intelligence to engage prospects. Techno Data Group implements new lead gen ideas and strategies for generating more leads and targeting the right leads and accounts.
    TECHNO DATA GROUP

    ReplyDelete
  11. If you don’t want to take a chance with your tie and money then hiring a professional agency for the iPhone app development India is the best alternatives. These professional agencies ensure that the clients get the value for money.

    ReplyDelete
  12. Share more new stuff like this!
    Opt out for the best and affordable Magento Development Company
    who provide responsive design for all gadgets, speed performance for the best user experience so that they can easily find products and do check-out. We are the best provider website design services for all business industry.

    ReplyDelete
  13. Laravel Development Company not only help large business enterprises but also to start-ups. Unisoft Informatics is the Top Laravel Development Company that provide essential features of Laravel platform.

    ReplyDelete
  14. Shopify is the best and affordable eCommerce platform for development. Unisoft Informatics is the best Shopify Design Company that provides the fully-featured online store with all major features which are essential for the online store.

    ReplyDelete
  15. Virtual Employee is very trendy in this Corona outbreak. Because employees are unable to come to their workplace. IOGOOS has a team of Virtual employees for IT services related to Website Renovation or redevelopment services. We help your business to make online by creating a website.
    Virtual Employee

    ReplyDelete