查看Magento的代码并阅读wiki后,我能够完成它,我的新属性保存在配置文件的地址编辑表单中,但是当我在结帐表单中输入时没有保存,那是因为我需要覆盖一些 Magento 核心文件,第一步是将新属性添加到app\code\core\Mage\Customer\etc\config.xml
,我复制到app\code\core\Mycompany\Customer\etc\config.xml
,因为我的新属性代码是rfc,我找到了<fieldsets>
条目和
<customer_dataflow>
....
<rfc><billing>1</billing><shipping>1</shipping></rfc>
</customer_dataflow>
现在我需要将新属性添加到app\code\core\Mage\Customer\Model\Entity\Setup.php
我做了同样的覆盖,复制到我的本地命名空间,并在函数中getDefaultEntities()
找到
'customer_address'=>array(
....
'rfc' => array(
'label' => 'RFC',
'required' => false,
'sort_order' => 135,
),
)
现在,我也需要在 中做同样的事情app\code\core\Mage\Sales\etc\config.xml
,但现在应该是这样的
<sales_copy_order_billing_address>
.....
<rfc><to_order>*</to_order></rfc>
</sales_copy_order_billing_address>
<sales_copy_order_shipping_address>
......
<rfc><to_order>*</to_order></rfc>
</sales_copy_order_shipping_address>
<sales_convert_quote_address>
........
<rfc><to_order_address>*</to_order_address><to_customer_address>*</to_customer_address></rfc>
</sales_convert_quote_address>
<sales_convert_order_address>
.........
<rfc><to_quote_address>*</to_quote_address></rfc>
</sales_convert_order_address>
<customer_address>
.......
<rfc><to_quote_address>*</to_quote_address></rfc>
</customer_address>
希望它可以帮助别人