// By default virtual product don't need to have stock to be sold

This commit is contained in:
mDeflotte committed 2011-12-22 13:29:18 +00:00
1 parent 8c49687cf3
commit 03457d09cd
1 file changed
+7
@@ -1397,6 +1397,13 @@ class AdminProductsControllerCore extends AdminController
Hook::exec('addProduct', array('product' => $object)); Hook::exec('addProduct', array('product' => $object));
Search::indexation(false, $object->id); Search::indexation(false, $object->id);
} }
// If the product is virtual, set out_of_stock = 1 (allow sales when out of stock)
if (Tools::getValue('type_product') == 2)
StockAvailable::setProductOutOfStock($object->id, 1);
else
StockAvailable::setProductOutOfStock($object->id, 2);
// Save and preview // Save and preview
if (Tools::isSubmit('submitAddProductAndPreview')) if (Tools::isSubmit('submitAddProductAndPreview'))
{ {