2011-08-18 4 views
0

Magento CE 1.5.1.0Magento 고객 체크 박스 속성을 사용자 정의 백엔드로 저장하려면 어떻게해야합니까?

Magento 모듈의 설치 파일에 새로운 고객 속성을 만들려고합니다. 텍스트 입력에 대해서는 정상적으로 작동하지만 관리자 백엔드의 고객 정보 페이지에있는 고객 "계정 정보"섹션에 확인란을 추가하고 싶습니다. 프런트 엔드에 표시되거나 고객이 수정할 수 없어야합니다. 난 그냥 부울 값을 원한다.

나는 정확한 위치에 백엔드에 나타나는 속성을 가지고 있으며 선택되지 않은 것은 좋지만 기본값은 "저장하고 계속 편집하십시오"버튼 (또는 "고객 저장")을 클릭 할 때입니다. 기본 관리 대시 보드로 리디렉션됩니다. 내가 다시 고객을 관리 할 때 나는 체크 박스를 체크하는 것이 저장되지 않았 음을보고, 다시 디폴트이다.

나는 현재 (이 질문에 대한 요나단의 날의 대답에서 촬영 : Adding attributes to customer entity) 한 코드는 :

언급 한 바와 같이
$installer = $this; 
$installer->startSetup(); 

$setup = new Mage_Eav_Model_Entity_Setup('core_setup'); 

$entityTypeId  = $setup->getEntityTypeId('customer'); 
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId); 
$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId); 

$setup->addAttribute('customer', 'ignore_ip_notifications', array(
    'input'   => 'checkbox', 
    'type'   => 'int', 
    'label'   => 'Ignore IP Notifications', 
    'visible'  => 1, 
    'user_defined' => 0, 
    'required'  => 0, 
    'source'  => 'eav/entity_attribute_source_boolean' 
)); 

$setup->addAttributeToGroup(
$entityTypeId, 
$attributeSetId, 
$attributeGroupId, 
'ignore_ip_notifications', 
'998' //overwritten sort_order 
); 

$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'ignore_ip_notifications'); 
$oAttribute->setData('used_in_forms', array('adminhtml_customer')); 
$oAttribute->setData('sort_order', 998); 
$oAttribute->save(); 

$installer->endSetup(); 

, 속성이 예상대로 나타납니다 아니라 저장보다, 대시 보드로 리디렉션이있다.

도움이 될 것입니다.

IB

답변

0

나는 100 % 확실하지 않다,하지만이 같은뿐만 아니라 백엔드에 대해 정의 필드 셋,해야 할 수 있습니다

<fieldsets> 
      <customer_account> 
       <attribute_code> 
        <create>1</create> 
        <update>1</update> 
       </attribute_code> 
      <customer_account> 
</fieldsets> 
관련 문제