0

(Magento CE V1.7.0.2)

I have a problem with the customer data collection, I can't have any "telephone" number.

I must remove the line

->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left') 

from _prepareCollection() function of Grid.php for the customer table list or I have an error report with:

"Attribute type not valid" /magento/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(652): Mage::exception('Mage_Eav', 'Type d'attribut...') 

How can I rebuild default EAV attribute or perhaps someone has modified a file?

4
  • To check if the attribute is really missing (this is what the error message suggests), have a look at your database and check if the table eav_attribute contains an entry with attribute_code='telephone' and entity_type_id=2. Commented Sep 4, 2015 at 15:28
  • Here is the line : evoweb.fr/divers/eav_attribute_telephone.jpg and the "entity_type_id" is at 1 Should I modify it ? Commented Sep 11, 2015 at 13:27
  • Yes, this is the row that would have type 2 by default ("1" is for customers, "2" is for customer addresses). If you need a telephone attribute for the customer as well, copy the row (by default this does not exist). Commented Sep 11, 2015 at 13:45
  • All is working good now. Thank you a lot for your help !!! Commented Sep 14, 2015 at 10:48

1 Answer 1

0

With the additional information from the comments: The telephone attribute should look like this:

mysql> select * from eav_attribute where attribute_code='telephone'; +--------------+----------------+----------------+-----------------+---------------+--------------+---------------+----------------+----------------+----------------+----------------+--------------+-------------+-----------------+---------------+-----------+------+ | attribute_id | entity_type_id | attribute_code | attribute_model | backend_model | backend_type | backend_table | frontend_model | frontend_input | frontend_label | frontend_class | source_model | is_required | is_user_defined | default_value | is_unique | note | +--------------+----------------+----------------+-----------------+---------------+--------------+---------------+----------------+----------------+----------------+----------------+--------------+-------------+-----------------+---------------+-----------+------+ | 31 | 2 | telephone | NULL | NULL | varchar | NULL | NULL | text | Telephone | NULL | NULL | 0 | 0 | NULL | 0 | NULL | +--------------+----------------+----------------+-----------------+---------------+--------------+---------------+----------------+----------------+----------------+----------------+--------------+-------------+-----------------+---------------+-----------+------+ 

In your case somebody/something has changed the entity type id from 2 to 1, to associate the phone number to the customer instead of the customer address.

But Magento expects the address attribute to exist, so you need to restore the original attribute. If you need the customer to have a telephone number as well, you can duplicate the row and keep it with entity_type_id 1 and 2, both. It is possible to have the same attribute code for different entity types.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.