无法再在 Magento 1.4.2.0 中添加注册字段

2021-12-19 00:00:00 e-commerce php magento magento-1.4

我之前已经将本教程用于 将注册字段添加到 Magento 注册页面.

I have used this tutorial before for adding registration fields to the Magento registration page.

它一直有效,但自从我升级到 Magento 1.4.2.0 后,它就不再有效了.我添加的属性不再像以前那样显示在后端的客户信息选项卡下,并且不会被保存.不过,这些属性可以很好地安装到数据库中.我想可能 config.xml 部分已经更改,但我针对核心客户进行了检查,并且属性仍然以相同的方式显示:

It has always worked, but since I have upgraded to Magento 1.4.2.0 it no longer does. The attributes I add no longer show up under the customers information tab in the backend like it did before and are not getting saved. The attributes install into the database fine though. I thought maybe the config.xml part had changed but I checked it against the core customer one and the attributes are sill shown the same way:

<flavour><create>1</create><update>1</update></flavour>

自上次 1.4.2 测试版以来肯定发生了一些变化,因为它当时运行良好.如果有人有任何想法,将不胜感激,我终于可以睡一觉了!提前致谢!

Something must have changed since the last 1.4.2 beta because it worked fine then. If someone has any ideas it would be greatly appreciated and I could finally get some sleep! Thanks in advance!

推荐答案

我一直在为这个问题苦苦挣扎,直到我弄明白了.从 1.4.2 开始,要在管理员客户表单中显示的属性必须在表 customer_form_attribute 中.
您可以使用以下代码在模块设置中通过升级添加它们:

I have been struggling with this one quite some time untill I figured it out. Since 1.4.2, the attributes to show in the admin's customer's form have to be in table customer_form_attribute.
You can add them with an upgrade in your module's setup, with this code:

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

希望有所帮助.

相关文章