zorrobsas Posted September 15, 2017 Share Posted September 15, 2017 Hi, I'm having problems with the override of stockAvailable function getQuantityAvailableByProduct. I take quantity from a webservice, the GET it done correctly and I see the quantity in the product but when I clickt in add to cart Nothing happens. I know I'm killing something but I do not know it's class StockAvailable extends StockAvailableCore { public static function getQuantityAvailableByProduct($id_product = null, $id_product_attribute = null, $id_shop = null) { .... $ch=curl_init($url); .... $stock = json_decode($ch); $cantidadStock = (int)$stock->stock; curl_close($ch); ... return $cantidadStock; } } Link to comment Share on other sites More sharing options...
zorrobsas Posted September 18, 2017 Author Share Posted September 18, 2017 (edited) someone? Edited September 18, 2017 by zorrobsas (see edit history) Link to comment Share on other sites More sharing options...
GKentaurus Posted September 18, 2017 Share Posted September 18, 2017 (edited) Hi ZorrobsasTry to make an override for all functions and modify only that you need to edit. I mean... Copy the StockAvailable.php original class file Paste into the override/classes/stock/ folder Modify the class and extend from the core Edit the function that you need In some cases, it works. I hope this can be useful. Edited September 18, 2017 by GKentaurus (see edit history) Link to comment Share on other sites More sharing options...
zorrobsas Posted September 21, 2017 Author Share Posted September 21, 2017 (edited) Hi, I found the error. It did not work for me in one of the loop that calls the function for idproduct at zero. Who can help me? class StockAvailable extends StockAvailableCore { public static function getQuantityAvailableByProduct($id_product = null, $id_product_attribute = null, $id_shop = null) { PrestaShopLogger::addLog(' Class over', 1, null, 'over', (int)$id_product, true); return 1000; } } Hi, I found the error. It did not work for me in one of the loop that calls the function for idproduct at zero. Who can help me? Edited September 21, 2017 by zorrobsas (see edit history) Link to comment Share on other sites More sharing options...
Sergio Araos Posted November 21, 2022 Share Posted November 21, 2022 Hi! I know this is an old post, but, how do you fix this problem? Can you sahre your class file? 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