Daaaaad Posted October 21, 2019 Share Posted October 21, 2019 (edited) Hello everyone ! We are synchronizing our shop with an ERP using the PrestaShop's webservice. We would like the ERP to set the product quantities (via the API) frequently but take the "reserved quantities" (already ordered products) into account. Example : Physical stock = 100 Reserved quantities = 2 Available quantities = 98 We receive 50 new products : Physical stock = 150 Reserved quantities = 2 Available quantities = 148 The ERP do not know how much products have been sold. How to achieve that? Use stock movements? We are using PrestaShop 1.7.5. Thank you 😀 Edited October 21, 2019 by Daaaaad (see edit history) Link to comment Share on other sites More sharing options...
rhume Posted October 21, 2019 Share Posted October 21, 2019 Hello neighbor! What ERP do you use? With Dolibarr, this function is achievable .... I think. Link to comment Share on other sites More sharing options...
Daaaaad Posted October 21, 2019 Author Share Posted October 21, 2019 Hi @rhume 😀 That's a custom ERP, designed by another company in windev 🤔 I'm searching how to achieve that using the webservice... Link to comment Share on other sites More sharing options...
a17000 Posted October 22, 2019 Share Posted October 22, 2019 Hi, Can you create a PHP on the prestashop's server ? If yes you can use object StockAvailable::getQuantityAvailableByProduct and StockAvailable::setQuantity Beware to stock movement ... Else you can use Webservice, look : $xml = $webService->get(array('url' => PS_SHOP_PATH . '/api/products')); $opt['resource'] = 'products'; $opt['id'] = $id_ps_produit; $xml = $webService->get($opt); foreach ($xml->product->associations->stock_availables->stock_available as $stock) { $xml2 = $webService->get(array('url' => PS_SHOP_PATH . '/api/stock_availables?schema=synopsis')); etc... Link to comment Share on other sites More sharing options...
Daaaaad Posted October 31, 2019 Author Share Posted October 31, 2019 Hello @a17000, Thank you but neither StockAvailable::getQuantityAvailableByProduct nor StockAvailable::setQuantity are taking "reserved_quantity" into account 😔 As I said above, I would like to update the physical stock quantities but keep "reserved_quantity" reserved and recalculate the available quantities... David. Link to comment Share on other sites More sharing options...
artursg Posted April 25 Share Posted April 25 Hello, Did you find the solution via Webservice for this? 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