0

Hi I have been following this tutorial http://sabujcse.wordpress.com/2010/03/09/selecting-customer-group-during-registration-in-magento/ and Have managed to sucessfully add the functionality for the registration process.

I then reused the code for the edit account page (edit.phtml) and altered it slightly. However when the form is submitted teh group is not updated

What Am I missing?

Current Group<br/>
<?php 
    $TypeID = Mage::getSingleton('customer/session')->getCustomerGroupId();
    //Get customer Group name
    $type = Mage::getModel('customer/group')->load($TypeID);
    $customerType = $type->getCode();
    echo $customerType;
?>

<div class="input-box">
    <label for="group_id"><?php echo $this->__('Which Best Describes You') ?><span class="required">*</span></label><br/>
    <select name="group_id" id="group_id" title="<?php echo $this->__('Group') ?>" selected="" class="validate-group required-entry input-text" />
            <?php $groups = Mage::helper('customer')->getGroups()->toOptionArray(); ?>
            <?php foreach($groups as $group){ ?>
            <option <?php if ($customerType == $group['label']) { echo "selected"; } ?> value="<?php print $group['value'] ?>"><?php print $group['label'] ?></option>

            <?php } ?>
     </select>
 </div>
Anthony
  • 7
  • 3

2 Answers2

0
  • First check controller's action, to which the form is being submitted.
  • Override that controller's action into app/code/local folder.
  • Paste $customer->setCustomerGroupId(); before $customer->save() in that action function.

I hope it should be clear now.

Mohit Kumar Arora
  • 2,204
  • 2
  • 21
  • 29
0

Update:

I solved the issue by installing this extension http://cjmcreativedesigns.com/customer-group-at-registration.html

Anthony
  • 7
  • 3