tom29 Posted November 15, 2017 Share Posted November 15, 2017 Hello, I'm writting an external script to add stock movements to Prestashop using the addProduct function of the StockManagerCore class. I'm using Prestashop 1.6.1.17. <?php include(dirname(__FILE__).'/../config/config.inc.php'); include(dirname(__FILE__) . '/../init.php'); $id_warehouse = 1; $id_product = 1; $id_product_attribute = 3; $warehouse = new Warehouse($id_warehouse); $quantity = 10; $id_stock_mvt_reason = 3; $price_te = 1.0; $employee = 10; $stock_manager = StockManagerFactory::getManager(); if ($stock_manager->addProduct($id_product, $id_product_attribute, $warehouse, $quantity, $id_stock_mvt_reason, $price_te, true, $employee)) { echo " It works! "; StockAvailable::synchronize($id_product); } else { echo " It doesn't work! "; } ?> I don't understand why the method addProduct doesn't work. I have none the messages "It Works" or "It doesn't work", except if I put a nonexistent warehouse, in this case I have the "It doesn't work" message. I can use successfully other methods of the class as getProductPhysicalQuantities for example. Anyone has an idea of what is wrong? Thanks, Thomas 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