From 01c2498f690cf2dae0e02b168ae2acd2209f0d74 Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Mon, 28 Nov 2011 16:47:50 +0000 Subject: [PATCH] // Change sentence "Allow seperated package" --- classes/Cart.php | 14 ++++++++++++++ themes/prestashop/shopping-cart.tpl | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) 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}

{l s='Vouchers'}