在Magento结账时选择客户群

时间:2012-03-06 08:35:22

标签: php magento checkout

我正在寻找一种方法,让客户在结帐时使用选择框等选择客户群。没有找到关于这个主题的任何有用的文章。有人能指出我正确的方向吗?

感谢名单!

1 个答案:

答案 0 :(得分:1)

config.xml/app/code/core/Mage/Customer/etc/复制到app/code/local/Customer/etc/并修改如下(添加group_id节点):

<fieldset>
    ...
    <customer_account>
    <email><create>1</create><update>1</update></email>
    <group_id><create>1</create><update>1</update></group_id> 
    <!-- add above line -->
    </customer_account>
    ...
</fieldset>

register.phtml打开/app/design/frontend/[YOUR_TEMPLATE]/customer/form/并在您要显示的字段的某处添加以下代码块:

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