2015-10-22 74 views
0

Mage_Customer_Model_Customer上线336 - >Magento的客户自定义属性导入错误

public function getAttributes() 

    { 
     if ($this->_attributes === null) { 
      $this->_attributes = $this->_getResource() 
      ->loadAllAttributes($this) 
      ->getSortedAttributes(); 
     } 
     Mage::log($this->_attributes); 
     return $this->_attributes; 
    } 

当我试图找回我的客户属性我的自定义属性将丢失。 结果$此 - > _属性

[warning] => Mage_Customer_Model_Attribute Object 
    (... 
    ) 
[credit_limit] => Mage_Customer_Model_Attribute Object 
    (... 
    ) 

以上是我的自定义属性警告和CREDIT_LIMIT工作正常,但我最近添加的member_id阵列丢失。我在这里错过了什么吗?仅供参考我使用扩展http://www.magentocommerce.com/magento-connect/manage-customer-attributes.html来管理客户属性。 enter image description here

+0

他们都是相同的类型,相同的配置和设置相同的方式吗?很难知道为什么这个人在其他人做的时候可能不工作。你可以通过'Mage :: getModel('customer/customer') - > load(idhere) - > getMemberId()'来检索它吗? –

+0

@RobbieAverill它们以相同的方式设置,并且Mage :: getModel('customer/customer') - > load(idhere) - > getMemberId()返回A123的正确值。我可以编辑管理员中的所有内容,并且完美地工作,但是当我尝试通过csv导入这些值时,它不起作用。 – mikellez

+0

fyi当我试图记录$ this - > _ attributes ['member_id']时,它表示未定义索引 注意:未定义索引:member_id在/ home/weststar/public_html/webstore/app/code/core/Mage/Customer /模型/ Customer.php在线357 – mikellez

回答

0

我发现问题在于我忘了将属性添加到组中。

$setup->addAttributeToGroup(
    $entityTypeId, 
    $attributeSetId, 
    $attributeGroupId, 
    'member_id', 
    '100'); 

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

$setup->endSetup();