rifaia Posted May 10, 2016 Share Posted May 10, 2016 Hi, I am new to Prestashop. Currently i am able to access my store through webservice and do all the CRUD operations successfully with the help of this official tutorial. I need a custom option of receiving the product (or) product list with the quantity of stock_availables in the product itself, without the need to query again with the stock_available id of the product. Thanks in Advance. Link to comment Share on other sites More sharing options...
rifaia Posted May 18, 2016 Author Share Posted May 18, 2016 Anyone have idea or suggestions? Please write. Thanks Link to comment Share on other sites More sharing options...
rifaia Posted May 19, 2016 Author Share Posted May 19, 2016 After some trial and error, i found the below way to get the product quantity in the product itself on webservice if you don't have combinations. Go to file /classes/Product.php Search around line 387 for 'quantity' => array( 'getter' => 'false', 'setter' => false ), and change it to 'quantity' => array( 'getter' => 'getMyStockforWebService', 'setter' => false ), Then add the following method. public function getMyStockforWebService(){ return StockAvailable::getQuantityAvailableByProduct($this->id, 0); } This might help someone Link to comment Share on other sites More sharing options...
SLHuang Posted April 26, 2019 Share Posted April 26, 2019 It do really help me Link to comment Share on other sites More sharing options...
yeye412 Posted February 6, 2020 Share Posted February 6, 2020 Thank you Rifaia.. it helped me! Thank you so much! 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