問題描述
我之前已經將本教程用于 將注冊字段添加到 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 中添加注冊字段的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!