lier Posted August 26, 2015 Share Posted August 26, 2015 Hi, I would like create combination for products in Mysql. Name, like ID i have created. And now I want add combination to product. I change: _product_attribute and _product_attribute_combination. for example. Id product is 15616 in _product_attribute 73 - 15616 - 0.000000 - 0.000000 - 0.000000 - 0 - 0.000000 - 0.000000 - 1 - 36 - 0000-00-00 _product_attribute_combination 60 - 73 and 60 is id atribute - and i have create this atribute, and his name. But in product dont show this combination. I dont know, i must change more tables? Link to comment Share on other sites More sharing options...
Paul C Posted August 26, 2015 Share Posted August 26, 2015 (edited) You shouldn't use sql but instead use the objects themselves. That way you don't have to worry about the database structure or whether it changes between versions. EDIT: You'll also need to handle setting a default attribute for each product or your pricing will likely be screwed up Edited August 26, 2015 by Paul C (see edit history) Link to comment Share on other sites More sharing options...
lier Posted August 26, 2015 Author Share Posted August 26, 2015 Thanks Paul, but I have 5600 product and I have to add combination for every one. And script is easier way Link to comment Share on other sites More sharing options...
musicmaster Posted August 26, 2015 Share Posted August 26, 2015 You forget ps_product_attribute_shop 2 Link to comment Share on other sites More sharing options...
lier Posted August 26, 2015 Author Share Posted August 26, 2015 Thanks Im change _product_attribute_shop and yehaaaa.. Thanks Link to comment Share on other sites More sharing options...
Paul C Posted August 26, 2015 Share Posted August 26, 2015 Thanks Paul, but I have 5600 product and I have to add combination for every one. And script is easier way There's absolutely no reason not to write your script using the Prestashop objects rather than raw sql. I regularly import 1,000s of products, including images and attributes that way. Never had to worry about changes to the Prestashop database structure as a result By modifying the database directly with sql you're only saving a little time writing the script, but every upgrade you apply to that store in the future will require you to check if that part of the database is affected and modify your script if it has. Rinse and repeat. Link to comment Share on other sites More sharing options...
DevWL Posted June 17, 2021 Share Posted June 17, 2021 Hi It would be very kind if someone provide a code example on how to use object to insert product in to database. 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