diff --git a/classes/Cart.php b/classes/Cart.php index 5e15b6e53..5c49de027 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -2520,5 +2520,19 @@ class CartCore extends ObjectModel return false; } + + /** + * Return false is some product from the cart are out of stock + */ + public function isAllProductsInStock() + { + foreach ($this->getProducts() as $product) + { + elog($product); + if (isset($product['out_of_stock']) && (int)$product['out_of_stock']) + return false; + } + return true; + } } diff --git a/themes/prestashop/shopping-cart.tpl b/themes/prestashop/shopping-cart.tpl index 81498314d..767c9d02f 100644 --- a/themes/prestashop/shopping-cart.tpl +++ b/themes/prestashop/shopping-cart.tpl @@ -312,10 +312,12 @@ {/foreach} {/if} + {if !$cart->isAllProductsInStock()}
allow_seperated_package}checked="checked"{/if} /> - +
+ {/if}