Magento 1.9在注册/帐户编辑页面选择组

时间:2014-10-31 01:03:41

标签: php magento magento-1.9.1

您好我一直在关注本教程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>

2 个答案:

答案 0 :(得分:0)

  • 首先检查控制台的操作,表单正在提交给他。
  • 将控制器的操作覆盖到app / code / local文件夹中。
  • 粘贴$ customer-&gt; setCustomerGroupId();在$ action-&gt;在该动作函数中保存()之前。

我希望现在应该清楚。

答案 1 :(得分:0)

更新

我通过安装此扩展程序http://cjmcreativedesigns.com/customer-group-at-registration.html

解决了这个问题