Crazy-P Posted August 4, 2016 Share Posted August 4, 2016 Hei all on here I have used this thread: https://www.prestashop.com/forums/topic/262781-programmatically-adding-product/ with great success. However, the added products' quantity always remain 0? Everything works out perfectly: title, link_rewrite, price, image etc., just not the quantity. I use: $product->quantity = 1; In the database it remains 0 in psug_stock_available and psug_product. I know I can quickly update the quantity with sql, but I do prefer to use the standard methods via Prestashop. Thank you for your time. Sincerely, Patrick Link to comment Share on other sites More sharing options...
Crazy-P Posted August 6, 2016 Author Share Posted August 6, 2016 (edited) Okay. I figured out a way though I don't know if this is the proper way.For everyone else who encounter this problem then do as following: StockAvailable::setQuantity($id_product, $id_product_attribute, $quantity); //If you don't have a id_product_attribute, then just leave it as "null". Edited August 6, 2016 by Crazy-P (see edit history) 1 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