Jump to content

[SOLVED] SQL: Add categories to all shops


TRESSET

Recommended Posts

Good afternoon :)  I have a multistore and I have added some new categories. By default, the categories are added only to the main store, but not to the others. Now in the back office I must enter on each one, and assign it to the other stores.

 

I was wondering if there is a quick way to do it with SQL. In the `ps_category_shop` table I have the `id_category` and the `id_shop`. Attached picture.

 

In the picture, category 74 is assigned to shops 1 and 2. Category 76 is assigned to shops 1, 2 and 3. Category 77, 78, 79... are only assigned to the shop 1.

 

I would like all categories to be assigned to the three shops. How could I do this? And if they had all the same position in all the stores, I would be the happiest person in the world.

 

Prestashop should have more massive actions.

 

Thank you very much!!

post-1383362-0-40016300-1495106677_thumb.png

Edited by TRESSET (see edit history)
Link to comment
Share on other sites

well, it should be easy:

 

1) delete all association for shop != 1

delete from ps_category_shop where id_shop != 1;

2) copy association for shop1 => shop2

insert into ps_category_shop(id_shop, id_category, position) select 2, id_category, position from ps_category_shop  where id_shop = 1;
3) copy shop1 => shop3
insert into ps_category_shop(id_shop, id_category, position) select 3, id_category, position from ps_category_shop  where id_shop = 1;
 
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...