Home php CS-Cart. How to add goods through the API with the indication of...

CS-Cart. How to add goods through the API with the indication of the characteristics and variations?




There is a need to add goods through the CS-Cart API, found this documentation: Link

I tried simply adding a product pointing to him name, price, and ID of category. Everything turned out well.

Question: How to specify the product in advance created characteristics, and if there is no such characteristic yet, then create it? And how to add the same product with variations?

tried like this:

Product = Test & amp; Price = 100 & amp; category_ids [] = 367 & amp; Product_features [] = 551
But the characteristic did not apply

I will be grateful for your help!

Answer 1, Authority 100%

In the process of searching for an answer and add comments. Found a full version of the documentation that describes your case.

  1. Example Adding Products with characteristic

    curl -x post "http://example.com/api/products"
    -H "Content-Type: Application / JSON"
    -H "Authorization: Basic ******"
    -D '{"Product": "New Product", "Category_ids": "223", "main_categor": "223", "Price": "10", "Status": "A", "Product_features": { "23": {"Feature_Type": "T", "Value": "Test"}}} '
  1. Application example Product and group variations

    curl -x push "http://example.com/api/product_variation/:id"
    -H "Content-Type: Application / JSON"
    -H "Authorization: Basic ******"
    -D '{"Variation_Group_ID": 11}'

or creating a product and simultaneously adding it to a group of variations

curl -x post "http://example.com/api/product_variations_groups/dcode/product_variations"
-H "Content-Type: Application / JSON"
-H "Authorization: Basic ******"
-D '{"Product": "Pants", "Price": 150, "Product_features": {"549": 1199, "548": 1195}, "Category_ids": [224]}'

Here reference to the creation of Variation groups

I hope it will help you. Found documentation via repository

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions