2

This is my first time asking a question on the forum whereas I've found many answers before I haven't been able to find an answer to the following:

I am working for an online store and have been working with configurable products, creating attributes and so on. The problem came up when I had created an attribute for a product and everything was fine until I deleted the attribute before disassociating it from the product itself. Now I have quite a few products that are crashing the store when I enable them as the old attribute code is still being associated with these products.

I was able to find on Stack that this is what is causing it and have found the errant attribute code. I tried recreating the old attribute but obviously it assigns a new code.

I used Magento store Manager CustomSQL to discover the attribute code but it wont let me change anything or delete.

My question: How can I delete the old attribute code from the database?

  • After deleting the attribute you should re-index, did that not clear it out? – SR_Magento Oct 17 '14 at 14:51
2

Thanks Fabian for your answer.

This is the solution I found:

It turns out that it was a problem with orphaned attributes. The deleted attribute's association to the products was still in the catalog_product_super_attribute database. Which was causing the crash.

Based on other answers to other questions in the forum this is the solution I found: The first 2 are from this link https://stackoverflow.com/questions/16942701/getid-on-a-non-object

The 3rd comes from this post https://stackoverflow.com/questions/5291572/in-magento-is-there-a-way-to-remove-attribute-from-configurable-product-after-a

  1. I used this SQL command

    select * from catalog_product_super_attribute where product_id=productid

    to identify the attributes associated with the products

  2. I then used

    select attribute_id,attribute_code from eav_attribute where attribute_id=ID or attribute_id=id

    to show the name associated with ID to verify I found the correct attribute.

  3. Lastly this command

    DELETE FROM catalog_product_super_attribute WHERE attribute_id =ID

    to remove the problem orphaned attribute ID

| improve this answer | |
  • if this is now working then feel free to accept this answer – David Manners Jan 23 '15 at 13:19
1

This sounds as you have a problem with your database.

Theoretically all entries in catalog_product_entity_* should be deleted, because they all have a foreign key on the eav_attribute.

You should check, whether theses foreign keys exists.

What you can try is query the different catalog_product_entity_* tables and check for entries which doesn't have any representation in eav_attribute, delete these entries.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.