Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
619 views
in Technique[技术] by (71.8m points)

php - 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

question from:https://stackoverflow.com/questions/66048131/prestashop-webservice-api-update-order-status

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...