2014-10-31 6 views
0

안녕하세요 저는이 튜토리얼 http://sabujcse.wordpress.com/2010/03/09/selecting-customer-group-during-registration-in-magento/을 따라 왔으며 등록 프로세스에 대한 기능을 성공적으로 추가했습니다.Magento 1.9 등록/계정 편집 페이지에서 그룹 선택

그런 다음 계정 수정 페이지 (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> 
+0

은 $ 모델 -> setCustomerGroupId ()에 의해 그룹을 설정해보십시오이 확장을 설치하여이 문제를 해결

; 개별적으로 –

+0

고마워요. Mohit - 좀 더 자세히 설명해 주시겠습니까? 어디에서이 코드를 배치하고 $ 모델 변수는 무엇입니까? – Anthony

+0

안녕하세요 anthony .. 아래 내 대답을 확인하십시오. –

답변

0
  • 먼저 체크 컨트롤러의 동작은, 어떤 형태로 제출되고있다.
  • 해당 컨트롤러의 작업을 app/code/local 폴더로 덮어 씁니다.
  • 붙여 넣기 $ customer-> setCustomerGroupId(); 그 작업 함수에서 $ customer-> save() 전에.

지금은 분명해야한다고 생각합니다.