1

I have a product attribute that is currently produces varchar(255) as a Type in catalog_product flat tables. How do I change it to being type int(11) programatically? Do I just remove an attribute and re-add it via setup script or there is another way?

  • Which your Magento version? – Khoa TruongDinh Jul 22 '16 at 16:27
  • Magento ver. 1.14 – ifrm Jul 22 '16 at 16:31
0
  1. Create new attribute
  2. Insert new values or copy values from old attribute
  3. Delete old attribute
  4. (Optional) If you like rename old attribute.
  • 1
    it sounds very inefficient – ifrm Jul 22 '16 at 16:15
0

Although technically you could directly modify the attribute in the eav_attribute table, the real problem is that the combination product - attribute - value is actually in catalog_product_entity_varchar. So, change attribute type, implicates that all the stored in catalog_product_entity_varchar as varchar(255) would have to be moved to catalog_product_entity_int and converted to int(11). Therefore, there is as such an automatic and enjoyable way to do this, except, indeed, delete and recreate it.

To keep all information already captured in each product, you should perhaps try to export the data, delete the attribute, create it again with the same name, and then re-import the CSV.

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.