Jump to content

SQL/module to add accessories?


Recommended Posts

Hi,

 

I have a LOT of products in my store, and many of them are in "groups" (ie. people that buy one tend to need others in the same group). I'm making these connections using the "accessories" field for each product. That fine when there are only a couple of items to relate to one another, but if I have 15 items that I need to link, it's very tedious to add 14 accessories to each of those items (14 because i add everything in the group except the one i'm editing).

 

I've found that the table ps_accessory stores the product IDs to make these connections, so I'm hoping someone with better SQL skills than mine can come up with something I can run?

 

Basically I think it would just be an INSERT statement. If there are 15 items to associate to each other, it would add each product ID in that range 15 times into the id_product_1 field, then in the id_product_2 field, put the ID of every other product in the range except the one that matches id_product_1. I hope that's not too confusing!!

 

If this could be made into a module somehow, that would be even better (maybe on the product listing screen in the BO, select the checkboxes of the items to link together, then add an 'Associate Selected' button next to 'Delete Selected'. Don't know how difficult a module is though.

 

Thanks for reading all of that, I hope you can help!

Link to comment
Share on other sites

  • 1 year later...
×
×
  • Create New...