TRESSET Posted May 18, 2017 Share Posted May 18, 2017 (edited) 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!! Edited May 19, 2017 by TRESSET (see edit history) Link to comment Share on other sites More sharing options...
DataKick Posted May 18, 2017 Share Posted May 18, 2017 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; 1 2 Link to comment Share on other sites More sharing options...
TRESSET Posted May 19, 2017 Author Share Posted May 19, 2017 Oh, thank you very much for your answer!! I'm going to try to use your code, and I'll take a look at your module. Thank you again! Link to comment Share on other sites More sharing options...
TRESSET Posted May 19, 2017 Author Share Posted May 19, 2017 The code works perfect, thank you very much again!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now