10

I have many categories and instead of applying new settings to all categories one by one, i would like to know if this is possible to apply new settings to all categories at once?

Thanks!

3 Answers 3

13

There is no way of doing this from the UI.
The way I usually do it, is to update the values in the database. It's not the recommended approach but it works.
Let's say you want to update the is_anchor attribute to '1' for all categories.

SELECT * FROM eav_attribute where attribute_code = 'is_anchor'

The query above should give you the is_anchor attribute. I the record that results I see that the attribute id is 51 (could be different for you). and the backend_type is int. This means that the values for the attribute are in the table catalog_category_entity_int.

UPDATE `catalog_category_entity_int` set value = 1 where attribute_id = 51 and parent_id <> 0;

This query will set the value 1 for the attribute is_anchor (id 51), for all the categories except the 'root of all roots', the category with parent = 0.
After I run the query, I reindex the flat categories and that's it.

5
  • perfecto! exactly what i was looking for :D May 7, 2013 at 21:02
  • 7
    Updated SQL query for newer versions of Magento (I didn't have parent_id column for example). UPDATE catalog_category_entity_int set value = 1 where attribute_id = (SELECT attribute_id FROM eav_attribute where attribute_code = 'is_anchor');
    – Jasuten
    Jun 13, 2014 at 6:23
  • @Marius not work in my case i try UPDATE catalog_category_int set value = 1 where attribute_id = 51 and parent_id <> 0; but error:#1146 - Table 'magento1.catalog_category_int' doesn't exist
    – Dinesh
    Nov 29, 2015 at 18:42
  • 1
    @Dinesh this means there is something wrong with your magento instance.
    – Marius
    Nov 29, 2015 at 20:02
  • @Marius how to find & fix it, any help
    – Dinesh
    Nov 30, 2015 at 6:08
2

I am not sure which settings you are changing in your category, but if it is on the list of options on this page, then using the Magento REST API is probably your best option.

1

First identify the attribute id of the is_anchor attribute:

SELECT * FROM eav_attribute where attribute_code = 'is_anchor';

we Get attribute id 51 in my database. Now run the following query

UPDATE catalog_category_entity_int set value = 1 where attribute_id = 51;

replace 51 with your own attribute id. And just rebuild these indexes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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