How to Restore a Product Attribute Deleted in Magento E-Commerce
by David Dwyer on 15/05/2015 706 Reads
Introduction: About this Tutorial
While this scenario may seem unlikely, we've encountered multiple instances when a client comes to us for help after unknowingly deleting product attributes.
What you may not know though is that there is a safety net and the good news is that Magneto e-Commerce stores your product attribute values even if the attribute was deleted from the current attribute set. The solution, laid out below, can help you get your magneto e-Commerce store back up and running smoothly.
Not sure how to tackle this yourself? Inspire IT Services can help via our Developer SOS service (Ed: bit like the A-Team in that if no-one else is available to help, then we can).
We’ve found that when you delete an attribute in Magento, all data associated with that attribute will be erased. Additionally, the values of each product for that attribute could also be erased.
To restore this information, you’ll need to explore the specific tables of the Magento database, which are listed below.
Magento includes a system of customisable attributes for specific system “entities.” These entities are the categories, the clients, the products, and so on. For example a pen (Entity) might have blue ink (Attribute), or an Phone (Entity) might be an iPhone (Attribute) or Android (attribute) with Memory 16Gb (Attribute) or 32Gb (Attribute), etc. In essence Attributes explain/describe more about the Entity.
Within the administration, Magento allows you to add attributes for your products e.g. Collar Sizes (14”, 15”, 16”, 17”, 17.5”, 18”, 18.5”…) of a Shirt . If you want to add attributes for the other entities (such as clients or categories), you will need to install a module for that. We found several options you can install at Magento Connect, Magento's original marketplace for extensions that expand functionality of an e-Commerce site.
The configuration of attributes and their values are stored in various tables of the Magento database. This tool gives us great power in case we mistakenly delete an attribute. Otherwise, this mistake - deleting an attribute - can cause a huge headache.
Tables in Magento are:
To restore your attribute, you must make a copy of the database. You will load it into a test database to find where your attribute appears.
To obtain which attribute that was deleted, we can compare the tables "eav_attribute" of the two databases, and the registry of the Magento backup.
Once the missing data is found, restoring the current database is your goal.
Once the "attribute_id" of the deleted attribute is identified, compare each of the tables by filtering by the attribute "attribute_id". Then, export these results and put them in the current Magento database.
For example, if your deleted attribute were “118," for the first table you would execute the following query.
select * from eav_attribute where attribute_id = 118
Tables such as "catalog_product_entity_datetime", "catalog_product_entity_int" and others contain the values for each product. It may be that when you are transferring them the system issues failures, because some products have already been deleted.
In addition, for an attribute, only one of these tables has values associated with it, depending on the type of data it is. For example, if it is an integer type attribute, only the "catalog_product_entity_int" table will have values.
Once finished, you must update the indexes from the Magento administration panel. See “Update Magento indexes.”
Common Concerns in Magento
Frequently voiced concerns in Magento include how to:
• Reset Magento admin passwords
We can advise on all of these topics, and more.
At Inspire IT Services, we create striking, high-impact e-Commerce websites.
Inspire’s highly experienced software engineers often work with the highly popular Magento platform. We can explore development and data restoration for a variety of e-Commerce platforms, including Magento, to ensure your web platform operates smoothly.
e-commerce, Magento 1.9.x, Magento 2.x.x, Magento e-commerce, Online Stores