Jump to content

Add attributes to product


josepcarlet

Recommended Posts

Hi,

 

I have an attributes group id (4), and a attribute id (26).

 

How can I add this attribute to a product (371)?

 

I can update the attributes doing:

 

$id_size = 24;
$product_id = 371;
[size=4]$p = new Product($product_id, TRUE, null, 1);[/size]
$p->updateAttribute($id_size, 99998, 9977, 0, 111, 0, NULL, 'RRREFFFX', NULL, NULL);

 

But I can't associate a new attribute value for a product.

 

 

Regards.

Link to comment
Share on other sites

  • 2 weeks later...

I don't know how it should be done with the PS functions and classes.

 

I implemented it in the order_edit part of my script (http://www.prestasho...t-product-edit/). You could check that's source code to get an idea.

 

The database construction is a bit complicated with a lot of tables involved (ps_product_attribute, ps_product_attribute_combination, ps_product_attribute_image, ps_attribute, ps_attribute_group, ps_attribute_group_lang, ps_attribute_impact, ps_attribute_lang). So it may take you some study time to understand it.

Edited by musicmaster (see edit history)
Link to comment
Share on other sites

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
×
×
  • Create New...