// When viewing an order, a warning is now displayed if one/some product(s) are out of stock - #PSTEST-821

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14801 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
bMancone
2012-04-23 08:26:10 +00:00
parent 9ea9bd183c
commit 53821dd3ad
2 changed files with 12 additions and 0 deletions
@@ -1205,9 +1205,20 @@ class AdminOrdersControllerCore extends AdminController
$payment_methods[] = $module->displayName;
}
// display warning if there are products out of stock
$display_out_of_stock_warning = false;
$current_order_state = $order->getCurrentOrderState();
if ($current_order_state->delivery != 1 && $current_order_state->shipped != 1)
$display_out_of_stock_warning = true;
// products current stock (from stock_available)
foreach ($products as &$product)
{
$product['current_stock'] = StockAvailable::getQuantityAvailableByProduct($product['product_id'], $product['product_attribute_id'], $product['id_shop']);
// if the current stock requires a warning
if ($product['current_stock'] == 0 && $display_out_of_stock_warning)
$this->displayWarning($this->l('This product is out of stock: ').' '.$product['product_name']);
}
// Smarty assign
$this->tpl_view_vars = array(