您好我一直在關注這個教程http://sabujcse.wordpress.com/2010/03/09/selecting-customer-group-during-registration-in-magento/並設法成功地進行註冊過程中添加的功能。Magento的1.9組選擇在登記時/帳戶編輯頁面
我然後再用於編輯帳戶頁面(edit.phtml)的代碼,並稍微改變它。然而,當被提交表單TEH組未更新
我在想什麼?
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>
嘗試通過$模型 - > setCustomerGroupId()設置組解決的問題;個別 –
2014-10-31 03:43:53
謝謝Mohit - 請給我更多的細節?我將在哪裏放置這個代碼和什麼是$ model變量? – Anthony 2014-10-31 04:03:30
嗨安東尼..請檢查下面的答案。 – 2014-10-31 10:42:07