简体   繁体   中英

Magento 1.9 Group Selection at Registration / Account edit page

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

Update:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM