我已使用以下文件成功创建了新的客户属性:
config.xml中
<?xml version="1.0"?>
<config>
<modules>
<LReward_CustomerAddCustomAttr>
<version>0.1.1</version>
</LReward_CustomerAddCustomAttr>
</modules>
<global>
<resources>
<CustomerAddCustomAttr_setup>
<setup>
<module>LReward_CustomerAddCustomAttr</module>
<class>LReward_CustomerAddCustomAttr_Model_Resource_Eav_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</CustomerAddCustomAttr_setup>
<CustomerAddCustomAttr_write>
<connection>
<use>core_write</use>
</connection>
</CustomerAddCustomAttr_write>
<CustomerAddCustomAttr_read>
<connection>
<use>core_read</use>
</connection>
</CustomerAddCustomAttr_read>
</resources>
</global>
</config>
mysql4安装-0.1.0.php
<?php
$installer = $this;
$installer->startSetup();
$setup = Mage::getModel('customer/entity_setup', 'core_setup');
$setup->addAttribute('customer', 'reward_points', array(
'type' => 'varchar',
'input' => 'text',
'label' => 'Reward points',
'global' => 1,
'visible' => 0,
'required' => 0,
'user_defined' => 0,
'default' => '0',
'visible_on_front' => 0,
'source' => NULL,
));
$installer->endSetup();
Setup.php
<?php
class LReward_CustomerAddCustomAttr_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup {
}
这会创建一个名为&#34; reward_points&#34;。
的新客户属性我现在想添加另一个,但我似乎无法做到。我认为创建一个具有相同内容但具有新addAttribute值的新模块可以工作,但它没有。
如何添加其他新客户属性?
答案 0 :(得分:0)