Jump to content

Recommended Posts

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 by Daaaaad (see edit history)

Share this post


Link to post
Share on other sites

Hello neighbor!

What ERP do you use?   With Dolibarr, this function is achievable .... I think.

Share this post


Link to post
Share on other sites

Hi @rhume 😀

That's a custom ERP, designed by another company in windev 🤔

I'm searching how to achieve that using the webservice...

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More