问题API PRESTASHOP 1.7

我目前有关于prestashop API的问题。

我正在尝试更新产品组合的数量。

<?php

$request = new HttpRequest();
$request->setUrl('https://myurl.com/api/combinations/15544');
$request->setMethod(HTTP_METH_PUT);

$request->setQueryData(array(
  'io_format' => 'JSON'
));

$request->setHeaders(array(
  'cache-control' => 'no-cache','Connection' => 'keep-alive','accept-Encoding' => 'gzip,deflate','Host' => 'myurl.com','Cache-Control' => 'no-cache','accept' => '*/*','User-Agent' => 'PostmanRuntime/7.19.0','Authorization' => 'Basic HIDDEN','Content-Type' => 'application/xml'
));

$request->setBody('<?xml version="1.0" encoding="UTF-8"?>
        <prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
        <combination>
            <id>15544</id>
            <quantity>105</quantity>
            <location></location>
            <ean13></ean13>
            <isbn></isbn>
            <upc></upc>
            <upplier_reference></upplier_reference>
            <wholesale_price></wholesale_price>
            <price></price>
            <weight></weight>
            <unit_price_impact></unit_price_impact>
            <minimal_quantity>1</minimal_quantity>
            <minimal_quantity>1</minimal_quantity>
            <id_product>195</id_product>
            <reference>E1903XLN</reference>
        </combination>
        </prestashop>');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

服务器的响应正确。

当我对这里的get感到不满时,会得到回报:

{
    "combination": {
        "id": 15544,"id_product": "195","location": "","ean13": "","isbn": "","upc": "","quantity": "105","reference": "E1903XLN","supplier_reference": "","wholesale_price": "0.000000","price": "0.000000","ecotax": "0.000000","weight": "0.000000","unit_price_impact": "0.000000","minimal_quantity": "1","low_stock_threshold": null,"low_stock_alert": "0","default_on": null,"available_date": "0000-00-00","associations": {
            "product_option_values": [
                {
                    "id": "28"
                },{
                    "id": "32"
                }
            ]
        }
    }
}

尽管如此,在后台办公室的prestashop中,我看不到更改:

Image of the BO

您有想法或解决方案吗? 非常感谢您的帮助

wuhao1972 回答:问题API PRESTASHOP 1.7

要为您的组合设置库存数量的更新,您需要与对象StockAvailable对话。

祝您有美好的一天:)!

本文链接:https://www.f2er.com/3114817.html

大家都在问