0

嗨,我一直在关注本教程http://sabujcse.wordpress.com/2010/03/09/selecting-customer-group-during-registration-in-magento/并成功地为注册过程添加了功能。

然后,我重用了编辑帐户页面 (edit.phtml) 的代码,并对其稍作修改。但是,当提交表单时,组不会更新

我错过了什么?

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>
4

2 回答 2

0
  • 首先检查控制器的操作,表单正在提交到该操作。
  • 将该控制器的操作覆盖到 app/code/local 文件夹中。
  • 粘贴 $customer->setCustomerGroupId(); 在该操作函数中的 $customer->save() 之前。

我希望现在应该清楚了。

于 2014-10-31T10:41:39.130 回答
0

更新:

我通过安装这个扩展解决了这个问题http://cjmcreativedesigns.com/customer-group-at-registration.html

于 2014-11-03T03:52:01.067 回答