【问题标题】:Added custom field in Magento onepage checkout page is not saved in databaseMagento 单页结帐页面中添加的自定义字段未保存在数据库中
【发布时间】:2018-04-25 09:27:00
【问题描述】:

我已将自定义下拉菜单添加到 Magento Checkout Process 的 OnePage Checkout 但是当单击继续按钮时,它不会保存在数据库中。即使我在 sales_flat_quote 中创建了列,并在全局键下的 checkout.xml 中添加了字段。

但还是不行……

【问题讨论】:

  • 指定您要添加的内容?

标签: magento


【解决方案1】:

我认为本教程缺少 used_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();

希望对你有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-18
    • 1970-01-01
    • 2013-03-09
    • 2012-09-11
    • 2019-04-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多