Can no longer add registration fields in Magento 1.4.2.0

I have already used this tutorial to add registration fields to the Magento registration page .

It always worked, but since I upgraded to Magento 1.4.2.0, it no longer works. The attributes that I add are no longer displayed on the client information tab in the backend, as before, and are not saved. However, attributes are set to the database. I thought that maybe the config.xml part has changed, but I checked it against the main client and the attributes with the threshold shown the same way:

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

Something had to change since the last version 1.4.2, because at that time it worked fine. If anyone has any ideas, that would be very helpful, and I could finally sleep! Thanks in advance!

+3
source share
4 answers

I struggled with this for a long time until I realized. Starting with 1.4.2, the attributes displayed in the administrator client form should be in the customer_form_attribute table.
You can add them with an update in the configuration of your module using this code:

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

Hope this helps.

+4
source

Very helpful tips above, thanks David!

To save new attributes in frontend (register and edit) simply expand the second array of parameters $ attribute-> setData as follows:

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

After that, you will find 3 new entries in the customer_form_attribute table instead of one.

If you want to test this before and after this change, just paste

Mage:: log ('attrib:'. (string) $attribute- > getAttributeCode());

371 app/code/core/Mage/Customer/Model/Form.php, . ( 1.4.2.0)

+2

FYI each, they removed the "special code" in the community edition, which shows all the user attributes. I use an enterprise, and we were considering releasing communities because of savings. This is one of the obstacles that we have to overcome.

It does not answer the question, but explains why they removed it from the free version. The code to display them is completely missing from the topic.

0
source

Source: https://habr.com/ru/post/1782495/


All Articles