简体   繁体   中英

Prestashop WebService API - Update order status

I have been trying for a long time to update the status of an order from php with the prestashop webService library.

First I have tried to download the order, modify the "current_state" attribute and upload it via edit, without positive result, I always get the error message "other error"

Now I have seen that you can add an entry in "order_histories" but I am also unable to make it work:

    $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);
     }

I keep getting the error code "other error", I have seen several examples, but I don't get it, any help is welcome: D

var_dumps

UPDATE: Debug info, i have 403 Forbidden, Access to this resource on the server is denied, All options marked in prestashop backoffice, webservice DEBUG

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

UPDATE:

I have managed to update the order status in 1 of the four stores that I have connected, I use the same code and three of them are in the same version of prestashop, 1.7.6.9.

I get the error code 403, the webservice permissions are in the 4 stores the same.

Any ideas? Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM