Reputation: 109
I am inserting products into Prestashop using the webservice in XML format and I managed to do this, but I have a problem when setting the supplier id. From the XML I can set a supplier id which is used as the default supplier, but if I modify the product from the admin interface, the supplier id is unset because on the left part there is a checkbox list with suppliers and no supplier is checked. If I check the supplier, on the right part there is the default supplier which is set correctly as the supplier with the id I just set.
So basically, I need a way to set the suppliers array from the webservice and I couldn't find a way to do this. I tried product_suppliers, but when I make a GET request to this endpoint, I get the products associated to that supplier and not the suppliers associated with that product.
I also tried to make a GET product request before setting multiple suppliers and right after, but nothing is changed.
Upvotes: 1
Views: 464
Reputation: 109
Solved it. If anybody needs this info in the future, Make a POST request to api/product_suppliers with the following XML to attach new supplier to a product
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<product_supplier>
<id_product></id_product>
<id_product_attribute></id_product_attribute>
<id_supplier></id_supplier>
</product_supplier>
</prestashop>
Upvotes: 1