zion Posted February 10, 2021 Share Posted February 10, 2021 Hello! 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 = intval($idPedido); $resources->id_employee = 1; $resources->id_order_state = intval($estadoID); var_dump( $resources ); $opt = [ 'resource' => 'order_histories', 'postXml' => $xml->asXML() ]; $createdXml = $webService->add($opt); var_dump( $createdXml ); }catch (PrestaShopWebserviceException $e){ $this->controlErrores($e); } var_dumps: Link to comment Share on other sites More sharing options...
zion Posted February 14, 2021 Author Share Posted February 14, 2021 Debug info, i have 403 Forbidden, Access to this resource on the server is denied! All options marked in prestashop backoffice, webservice options. Link to comment Share on other sites More sharing options...
zion Posted February 22, 2021 Author Share Posted February 22, 2021 (edited) Hello, I have managed to update an order status by adding an entry to the status history. The code that I used is: $webService = webService::webServiceTienda($tienda); try{ $opt = [ 'resource' => 'order_histories?schema=blank' ]; $xml = $webService->get($opt); $resources = $xml->order_history->children(); $resources->id_order = intval($idPedido); $resources->id_order_state = intval($id_estado); $resources->id_employee = 1; $opt = [ 'resource' => 'order_histories', 'postXml' => $xml->asXML(), ]; $createdXml = $webService->add($opt); }catch (PrestaShopWebserviceException $e){ webService::controlErroresPedidos($e, $tienda); } I have 3 stores connected in the program and two of them throw me the error 403 Is it supposed to be a server problem? Does the hosting have to fix it? The funny thing is that two of these websites are on the same hosting, different server but same hosting. HTTP / 1.1 403 Forbidden <p> Access to this resource on the server is denied! </p> EDIT: I have spoken with my host and the problem was with the PHP security module. They have added some rule and now it works perfect Edited February 23, 2021 by zion (see edit history) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now