感谢clockworkgeek 的回复。我通过使用一些额外的地址属性找到了解决方案,因为它更容易(尽管我不得不搜索很多)。
所以解决方案是..
<?php
//Attribute to add
$newAttributeName = "rfc"; //modify this with the name of your attribute
//a) Add EAV Attributes (modify as you needed)
$attribute = array(
'type' => 'varchar',
'label' => 'RFC',
'visible' => true,
'required' => false,
'user_defined' => true,
'searchable' => false,
'filterable' => false,
'comparable' => false,
);
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
//Add to customer
$setup->addAttribute('customer_address', $newAttributeName, $attribute);
/* this is not working for some reason. add the columns manually
//b) Add Quote attributes (one page step to step save field)
$setup = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
$setup->getConnection()->addColumn(
$setup->getTable('sales_flat_quote_address'),
$newAttributeName,
'text NULL DEFAULT NULL'
);
$setup->getConnection()->addColumn(
$setup->getTable('sales_flat_order_address'),
$newAttributeName,
'text NULL DEFAULT NULL'
);
*/
$eavConfig = Mage::getSingleton('eav/config');
$attribute = $eavConfig->getAttribute('customer_address', $newAttributeName);
$attribute->setData('used_in_forms', array('adminhtml_customer_address',
'adminhtml_checkout_address')); //'customer_register_address', 'customer_address_edit',
$attribute->save();
?>
然后根据这篇文章编辑文件。
Magento:在结帐时保存自定义地址属性