View Single Post
  #7  
Old 10-08-2015, 11:04 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Using API to add products AND attributes

It depends on the attributes and whether you have these attributes in the database, or no.

Here are tables that X-Cart 5 uses to store attributes:
- xc_attributes - stores the list of all available attributes and their identifiers
- xc_attribute_translations - stores names of attributes, linked to the xc_attributes table
- xc_attribute_values_text - links products with values for their text attributes
- xc_attribute_values_text_translations - stores the actual values for text attributes, linked to xc_attribute_values_text
- xc_attribute_values_сheckbox - links products with values for their checkbox attributes
- xc_attribute_options - links regular attributes (the ones that look as a select box) with identifiers of possible values for these attributes
- xc_attribute_option_translations - stores actual text names for possible values of regular attributes, links to xc_attribute_options
- xc_attribute_values_select - links products with regular attributes and values selected for these attributes for these products (xc_attribute_options table)

If you use attribute groups, you may need to update extra tables.

So, you should update/create records in these tables by using a set of subsequent request.

You can find an example of doing a similar request to link an existing product with an existing category here:
http://kb.x-cart.com/display/XDD/REST+API+documentation#RESTAPIdocumentation-Assigningaproducttoacategory

It inserts a new link between xc_products and xc_categories table into the xc_product_categories table. You should do a similar thing for the tables that I listed above.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote