0
votes

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>
2
Try setting group by $model->setCustomerGroupId(<groupId>); individually - Mohit Kumar Arora
Thanks Mohit -- Could you please give me some more detail? Where would I place this code and What is the $model variable? - Anthony
Hi Anthony.. Please check my answer below. - Mohit Kumar Arora

2 Answers

0
votes
  • 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.

0
votes