cancel
Showing results for 
Search instead for 
Did you mean: 

Set all categories to use Config Settings for 'Default Product Listing Sort By' option via SQL

SOLVED

Set all categories to use Config Settings for 'Default Product Listing Sort By' option via SQL

I want to set all of my Magento 2 categories to 'Use Config Settings' for the 'Default Product Listing Sort By' within the Category Display Settings.

 

I don't want to do this manually as there are thousands of them.

 

What SQL command do I need to run to achieve this?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Set all categories to use Config Settings for 'Default Product Listing Sort By' option via SQL

Try this :

 

SELECT * FROM `catalog_category_entity_varchar` WHERE `attribute_id` = 68;

 

DELETE  FROM `catalog_category_entity_varchar` WHERE `attribute_id` = 68;

 

Where, 68 is attribute_id of 'default_sort_by' in my case, you can find it using below query:

 

SELECT `attribute_code`,`attribute_id` FROM `eav_attribute` WHERE `attribute_code` = 'default_sort_by';

 

View solution in original post

2 REPLIES 2

Re: Set all categories to use Config Settings for 'Default Product Listing Sort By' option via SQL

Try this :

 

SELECT * FROM `catalog_category_entity_varchar` WHERE `attribute_id` = 68;

 

DELETE  FROM `catalog_category_entity_varchar` WHERE `attribute_id` = 68;

 

Where, 68 is attribute_id of 'default_sort_by' in my case, you can find it using below query:

 

SELECT `attribute_code`,`attribute_id` FROM `eav_attribute` WHERE `attribute_code` = 'default_sort_by';

 

Re: Set all categories to use Config Settings for 'Default Product Listing Sort By' option via SQL

Excellent. Thanks for that. I would never have found that.