moonmosaic Posted April 7, 2015 Share Posted April 7, 2015 I have a category called added gifts. I would like to associate this category to every product so the added on gifts appear under each product as accessories. I want to do this because it seems visitors do not check out the "added on gifts" category at all.I know I can manually add all my added gifts to each of my products but this looks very time consuming. Has anyone done this before? I am running the 1.6 version. Thanks for all the answers in advance! Link to comment Share on other sites More sharing options...
Paulito Posted April 7, 2015 Share Posted April 7, 2015 Hello I think their is a bulk add accessories module around, I have not tried and it is not free. Paul Link to comment Share on other sites More sharing options...
PascalVG Posted April 7, 2015 Share Posted April 7, 2015 (edited) You could probably do some SQL statement: Careful! Hacking in the database can corrupt the database and render it unusable. ALWAYS Make Backup first! Go to your cPanel and get into your database (phpMyAdmin, choose your database) go to SQL tab and insert this statement: insert into ps_category_product(id_category, id_product, position) select XXX, id_product, 0 from `ps_product` Where you replace XXX with the ID number of the Gifts Category Then press the GO button. If everything is all right, it says something that it succeeded and added/changed X rows or so. N.B. This statement will fail if you already have used the gifts category for any product. If you did, either remove this gift category for those products, or maybe make a new gifts category and use that one and deactivate the old one.. What it does, it will insert an association between the product (id_product) and the gift category (id_category XXX) in the link table. As said, be careful and backup your database before you do this! My 2 cents, pascal Edited April 7, 2015 by PascalVG (see edit history) 1 Link to comment Share on other sites More sharing options...
moonmosaic Posted April 9, 2015 Author Share Posted April 9, 2015 Thanks Pascal, This command inserted all the products in the other categories into the add-on gift category where xxx was the gift category. So it kinda did the opposite of what I need. I am not an sql expert so how should I word this command so the xxx gift category and all of its products are inserted as an accessory category for each product in the other categories? So when a customer is looking at an item the gift category items are displayed also. Maybe this? select ps_category_product(id_category, id_product, position) insert into xxx id_product, 0 from `ps_product` a or is it an invalid command? Thanks! Thanks! 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