Prestashop WebService API - 更新订单状态

时间:2021-02-04 14:57:05

标签: php api web-services prestashop prestashop-1.7

我一直在尝试使用 prestashop webService 库更新来自 php 的订单状态。

首先我尝试下载订单,修改“current_state”属性并通过编辑上传,但没有积极的结果,我总是收到错误消息“其他错误”

现在我已经看到您可以在“order_history”中添加一个条目,但我也无法使其工作:

    $estadoID = (int)$_POST['estadosSelect'];
    $idPedido = $_GET['id'];
    $tienda = $_GET['tienda'];
    $webService = $this->webServiceTienda($tienda);

     try{


            $opt = [
                'resource' => 'order_histories?schema=blank'
            ];
            $xml = $webService->get($opt);
            $resources = $xml->children()->children();
            var_dump( $resources );

            $resources->id_order = $idPedido;
            $resources->id_employee = 0;
            $resources->id_order_state = $estadoID;
            var_dump( $resources );

            $opt = [
                'resource' => 'order_histories',
                'postXml' => $xml->asXML()
            ];
            $createdXml = $webService->add($opt);

            var_dump( $createdXml );

     }catch (PrestaShopWebserviceException $e){
         $this->controlErrores($e);
     }

我一直收到错误代码“其他错误”,我看过几个例子,但我不明白,欢迎任何帮助:D

var_dumps

1 个答案:

答案 0 :(得分:0)

更新:调试信息,我有 403 Forbidden,拒绝访问服务器上的此资​​源! 在 prestashop 后台、网络服务中标记的所有选项 DEBUG

https://i.stack.imgur.com/1qKDd.png

更新:

我已成功更新了已连接的四家商店中的一家商店的订单状态,我使用相同的代码,其中三家使用相同版本的 prestashop,1.7.6.9。

我得到错误代码 403,webservice 权限在 4 个商店中相同。

有什么想法吗? 谢谢

相关问题