Jump to content

Prestashop API documentation


Recommended Posts

  • 1 month later...

Forget it. PrestaShop API is one of the last secrets of the planet. You have to read the entire code.

 

And do not forget. You must note changes in database structure and API with each new version. Otherwise, your code can collapse. Changes are sometimes really essential.

Link to comment
Share on other sites

  • 3 years later...

I create a product and i try to assign combinations (color/size) to him.

But only first combination is added successfully! and then i receive an internal server error (500)

that's what i use:
 


$combination =
'<?xml version="1.0" encoding="utf-8"?>
<prestashop>
<combination>
<id xmlns=""></id>
<id_product xmlns="">'
.$id.'</id_product>
<quantity xmlns="">'
. $quantity . '</quantity>
<supplier_reference xmlns="">Inditex</supplier_reference>
<price xmlns="">'
. $price . '</price>
<wholesale_price xmlns="">'
. $price . '</wholesale_price>
<minimal_quantity xmlns="">1</minimal_quantity>
<default_on xmlns="">1</default_on>

<associations xmlns="">
<product_option_values xmlns="">
<product_option_value><id>'
.$color_id.'</id></product_option_value>
<product_option_value><id>'
.$size_id.'</id></product_option_value>
</product_option_values>
</associations>
</combination>
</prestashop>'
;
$response = curlCall($url . '/api/combinations/products/'.$id, $combination, 'POST', $api_key);
$load_string = simplexml_load_string($response);
$combination_id = $load_string->combination->id;

That code is working fine only if the product has no combinations. (color_id and size_id are verified and i don't use same id's)
 

save me please :)

Link to comment
Share on other sites

×
×
  • Create New...