在Magento OnePage Checkout页面中添加的自定义字段并未保存在数据库中



我已将自定义下拉列表添加到Magento结帐过程的OnePage Checkout中,但是在单击"继续按钮"时,它不会在数据库中保存。甚至我已经在sales_flat_quote中创建了列,并在global键下添加了cookeout.xml中的字段。

但仍然不起作用..

我认为教程缺少under_in_forms信息。

创建客户属性时,您必须指定将显示属性的位置。

添加您的属性后:

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('customer', 'my_attribute', array(
    ...
));

您必须告诉Magento在哪里使用:

$eavConfig = Mage::getSingleton('eav/config');
$attribute = $eavConfig->getAttribute('customer', 'my_attribute');
$attribute->setData('used_in_forms', array('adminhtml_customer', 'customer_account_create', 'customer_account_edit', 'checkout_register'));
$attribute->save();

希望它有帮助。

相关内容

最新更新