Jump to content

Create one Combination in sql


lier
 Share

Recommended Posts

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? 

Share this post


Link to post
Share on other sites

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 by Paul C (see edit history)

Share this post


Link to post
Share on other sites

 

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.

Share this post


Link to post
Share on other sites

  • 5 years later...

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More