Ikoshop Posted 4 hours ago Share Posted 4 hours ago (edited) When creating or updating a product, the amount entered in Quantity is not stored in ps_product.quantity in the database but instead in the stock_available.quantity table linked to the id_product However, when Product::getProducts() is called, it returns products with the prpduct.quantity value rather than the stock_available.quantity value. This seems kind of useless. Is there an accepted way of either a) getting the quantity of stock_available with getProducts() b) using another existing method to return the actual stock c) enabling something on prestashop so that the ps_product table is automatically synchronised with the stock_available table? Edited 2 hours ago by Ikoshop solved (see edit history) Link to comment Share on other sites More sharing options...
Ikoshop Posted 3 hours ago Author Share Posted 3 hours ago I found an answer for b) $all_products=Product::getProducts($this->lang, 0, 0, 'id_product', 'ASC', false,true,null); foreach ($all_products as $prod) { $prod['quantity']= StockAvailable::getQuantityAvailableByProduct($prod['id_product'],null,null); } and re-add the items to the array 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