Search the Community
Showing results for tags 'put method'.
-
I activated the webservice to synchronize the price of a product with the program that manages the warehouse via API. With the Postman program I make a test by sending a put with this text: response 200 OK On prestashop the price is modified but all the values present in the product are canceled and consequently the product becomes inactive.
-
- webservice
- service
-
(and 5 more)
Tagged with:
-
Hi, I found out there is a method to do stock update on multiple product with only one request. Maybe some of you already now the way but I didnt found it when I was searsching for. Solution : 1) Create a web request to "http://your.shop.url/api/stock_availables/1&display=[id,quantity]&io_format=JSON" with your optional credentials. 2) Use method="PUT" and ContentType="application/xml" 3) Add the following XML content : "<prestashop>\n" + " <stock_available>\n" + " <id>" + id_prod1 + "</id>\n" + " <id_product>" + id_prod1 + "</id_product>\n" + " <id_product_attribute>0</id_product_attribute>\n" + " <id_shop>1</id_shop>\n" + " <id_shop_group>0</id_shop_group>\n" + " <quantity>" + quantite1 + "</quantity>\n" + " <depends_on_stock>0</depends_on_stock>\n" + " <out_of_stock>" + (quantite1 == 0 ? 2 : 0) + "</out_of_stock>\n" + " <location></location>\n" + " </stock_available>\n" + " <stock_available>\n" + " <id>" + id_prod2 + "</id>\n" + " <id_product>" + id_prod2 + "</id_product>\n" + " <id_product_attribute>0</id_product_attribute>\n" + " <id_shop>1</id_shop>\n" + " <id_shop_group>0</id_shop_group>\n" + " <quantity>" + quantite2 + "</quantity>\n" + " <depends_on_stock>0</depends_on_stock>\n" + " <out_of_stock>" + (quantite2 == 0 ? 2 : 0) + "</out_of_stock>\n" + " <location></location>\n" + " </stock_available>\n" + "</prestashop>"; Or create it with a loop : private static string RequestXML(List<MyJson.Produit> list) { var xml = "<prestashop>\n"; foreach (var prod in list) { xml += " <stock_available>\n" + " <id>" + prod.web_id + "</id>\n" + " <id_product>" + prod.web_id + "</id_product>\n" + " <id_product_attribute>0</id_product_attribute>\n" + " <id_shop>1</id_shop>\n" + " <id_shop_group>0</id_shop_group>\n" + " <quantity>" + prod.quantite_commande + "</quantity>\n" + " <depends_on_stock>0</depends_on_stock>\n" + " <out_of_stock>" + (prod.quantite_commande == 0 ? 2 : 0) + "</out_of_stock>\n" + " <location></location>\n" + " </stock_available>\n"; } return xml+"</prestashop>"; } 4) Send the request and wait for response. 5) Split the string response and check if every product's stock as been updated. Performance : Using one request per product's stock 5 stock updated per second Using one request for all the product's stock : From <1second to up to 10 seconds depending on the numbrer of stocks to update With a good server and good connection. Before that, I was sending 250+ requests in 90 seconds to sync web stock with real stock in the shop. I really hope this will help someone.
- 1 reply
-
- 1
-
- webservice
- webservices
-
(and 7 more)
Tagged with:
-
hello please i find this bug while adding a product to an existing cart "The requested method is not implemented by the server". how can i resolve it ?? thanks
-
Hello please i find this bug while adding a product to an existing cart "The requested method is not implemented by the server". how can i resolve it ?? thanks
-
Bonjour Svp j'ai rencontré ce bug "The requested method is not implemented by the server." lors de l'update de la carte pour ajouter un nouveau produit comment je peux résoudre ce problème ?