沃梦达 / 编程问答 / php问题 / 正文

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

Can no longer add registration fields in Magento 1.4.2.0(无法再在 Magento 1.4.2.0 中添加注册字段)

本文介绍了无法再在 Magento 1.4.2.0 中添加注册字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前已经将本教程用于 将注册字段添加到 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();

希望有所帮助.

这篇关于无法再在 Magento 1.4.2.0 中添加注册字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:无法再在 Magento 1.4.2.0 中添加注册字段

基础教程推荐