Jump to content

How to use an override to update stock levels on class file Product.php


ThreeWest

Recommended Posts

Hello,

 

I've been reading the Prestashop help documents for using overrides to add functionality. It seems simple but I have some questions. 

 

I have written a private function that makes an xml-rpc call to our warehouse computer. It returns the stock levels for an item based off of the SKU/reference code in real time. Then I take that stock level response and update the database table for that product with the stock level. 

 

I need to integrate this code into the shop so that it runs as soon as a customer opens the page for a product so that the stock levels are always up to date. 

 

I'm trying to understand what I need to do this and have a few questions:

 

If I add it as an override for /classes/product.php, how do I get the function to execute on the frontend?

 

How do I get it to run before the stock level is displayed?

 

I see a depreciated function for getting the stock levels in product.php, is this the one I should be extending? 

 

Thank you.

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...