2012-08-08 2 views
0

안녕하세요 고객에게 맞춤 속성을 추가해야합니다. 그래서 난이 관련된 파일과 디렉토리 트리 있으며, 핵심 고객 모듈을 확장했습니다Magento - 확장 핵심 고객 모듈에 사용자 정의 속성 추가

//app/code/local/Nauba/etc/config.xml 

<?xml version="1.0"?> 
<config> 
<modules> 
    <Nauba_Customer> 
     <version>0.0.1</version> 
    </Nauba_Customer> 
</modules> 

<global> 
    <models> 
     <customer> 
      <rewrite> 
       <customer>Nauba_Customer_Model_Customer</customer> 
      </rewrite> 
     </customer> 
    </models>  
</global> 
</config> 


// app/code/local/Nauba/Customer/Model/Customer.php 

class Nauba_Customer_Model_Customer extends Mage_Customer_Model_Customer 
{ 
    function _construct() 
    { 
     parent::__construct(); 
    } 
} 




// app/etc/modules/Nauba_Customer.xml 

<?xml version="1.0"?> 
<config> 
<modules> 
    <Nauba_Customer> 
     <active>true</active> 
     <codePool>local</codePool> 
    </Nauba_Customer> 
</modules> 
</config> 






//app/code/local/Nauba/Customer/sql/nauba_customer_setup/mysql4-upgrade-1.6.2.0.2-1.6.2.0.3.php 

$installer = $this; 
$installer->startSetup(); 
/** 
* Adding custom attributes to customer 
*/ 

$installer->addAttribute('customer', 'elite_invitation', array(
    'label'    => 'ID prodotto invito Elite', 
    'type'    => 'varchar', 
    'visible'   => true, 
    'visible_on_front' => false, 
    'required'   => false, 
    'backend'   => '', 
    'frontend'   => '', 
    'input'    => 'text', 
    'global'   => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE 
)); 


$installer->endSetup(); 

이제 모듈이 활성화되고 새로운 사용자 정의 모델 대신 핵심 Mage_Customer의 사용되지만 실행되지 않습니다 업그레이드 SQL. 무엇이 잘못 되었는가?

고맙습니다 루크

+0

에서 XML로 "자원"정의해야합니다? – Kalpesh

+0

@KalpeshMehta가 Mage :: log (var_export ($ customer, true)) 템플릿을 넣고 클래스가 Nauba_Customer_Model_Customer 인 것을 확인하면 – Luke

+0

괜찮습니다. 이제 @Jerzy가 제안한대로 config.xml에 resources 노드를 포함 시키십시오. – Kalpesh

답변

1

당신은 당신이 새로운 모델 대신 Mage_Customer 사용됩니다 말할 수있는 방법 글로벌

<resources> 
     <nauba_customer_setup> 
     <setup> 
      <module>your module name</module> 
     </setup> 
     </nauba_customer_setup> 
    </resources> 
+0

고맙습니다. 이제 내 설정이 실행되지만 백엔드 고객 계정 정보 섹션에서 내 속성을 볼 수 없습니다. 나는 다른 모듈의 다른 업그레이드를 찾고 있는데, 나는 로컬에서 유용한 것을 찾고있다. 그러나 나는 여전히 아무것도 찾지 못했다 ... 어떤 도움이 필요합니까? – Luke