diff --git a/core/lib/Thelia/Condition/Implementation/MatchForXArticlesIncludeQuantity.php b/core/lib/Thelia/Condition/Implementation/MatchForXArticlesIncludeQuantity.php
new file mode 100644
index 0000000000..6f44acf744
--- /dev/null
+++ b/core/lib/Thelia/Condition/Implementation/MatchForXArticlesIncludeQuantity.php
@@ -0,0 +1,83 @@
+
+ */
+class MatchForXArticlesIncludeQuantity extends MatchForXArticles
+{
+ /**
+ * @inheritdoc
+ */
+ public function getServiceId()
+ {
+ return 'thelia.condition.match_for_x_articles_include_quantity';
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getName()
+ {
+ return $this->translator->trans('Cart item include quantity count');
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function isMatching()
+ {
+ return $this->conditionValidator->variableOpComparison(
+ $this->facade->getNbArticlesInCartIncludeQuantity(),
+ $this->operators[self::CART_QUANTITY],
+ $this->values[self::CART_QUANTITY]
+ );
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function drawBackOfficeInputs()
+ {
+ $labelQuantity = $this->facade->getTranslator()->trans('Cart item include quantity count is');
+
+ return $this->drawBackOfficeBaseInputsText($labelQuantity, self::CART_QUANTITY);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getSummary()
+ {
+ $i18nOperator = Operators::getI18n(
+ $this->translator,
+ $this->operators[self::CART_QUANTITY]
+ );
+
+ $toolTip = $this->translator->trans(
+ 'If cart item (include quantity) count is %operator% %quantity%',
+ array(
+ '%operator%' => $i18nOperator,
+ '%quantity%' => $this->values[self::CART_QUANTITY]
+ )
+ );
+
+ return $toolTip;
+ }
+
+}
diff --git a/core/lib/Thelia/Config/I18n/en_US.php b/core/lib/Thelia/Config/I18n/en_US.php
index 8bf118e38f..f0c2e4c40a 100644
--- a/core/lib/Thelia/Config/I18n/en_US.php
+++ b/core/lib/Thelia/Config/I18n/en_US.php
@@ -85,9 +85,11 @@
'Cart contains categories condition' => 'Cart contains categories condition',
'Cart contains specific products' => 'Cart contains specific products',
'Cart item count' => 'Cart item count',
+ 'Cart item include quantity count' => 'Cart item include quantity count',
'Cart item count is' => 'Cart item count is',
'Cart total amount' => 'Cart total amount',
'Cart total amount is' => 'Cart total amount is',
+ 'Cart item include quantity count is' => 'Cart item include quantity count is',
'Catalog' => 'Catalog',
'Catalog configuration' => 'Catalog configuration',
'Categories' => 'Categories',
@@ -233,6 +235,7 @@
'ISO Alpha-3 code' => 'ISO Alpha-3 code',
'If a translation is missing or incomplete :' => 'If a translation is missing or incomplete :',
'If cart item count is %operator% %quantity%' => 'If cart item count is %operator% %quantity%',
+ 'If cart item (include quantity) count is %operator% %quantity%' => 'If cart item (include quantity) count is %operator% %quantity%',
'If cart total amount is %operator% %amount% %currency%' => 'If cart total amount is %operator% %amount% %currency%',
'If checked, this hook will be used by a hook block. If not, by hook function.' => 'If checked, this hook will be used by a hook block. If not, by hook function.',
'Image' => 'Image',
diff --git a/core/lib/Thelia/Config/I18n/fr_FR.php b/core/lib/Thelia/Config/I18n/fr_FR.php
index c4840a70dc..17e52a27b4 100644
--- a/core/lib/Thelia/Config/I18n/fr_FR.php
+++ b/core/lib/Thelia/Config/I18n/fr_FR.php
@@ -85,7 +85,9 @@
'Cart contains categories condition' => 'Valable si le panier contient/ne contient pas des produits appartenant à certaines catégories',
'Cart contains specific products' => 'Valable si le panier contient certains produits',
'Cart item count' => 'Nombre d\'articles dans le panier',
+ 'Cart item include quantity count' => 'Nombre d\'articles quantité incluse dans le panier',
'Cart item count is' => 'Le nombre d\'articles dans le panier est',
+ 'Cart item include quantity count is' => 'Le nombre d\'articles quantité incluse dans le panier est',
'Cart total amount' => 'Montant total du panier',
'Cart total amount is' => 'Le total du panier est',
'Catalog' => 'Catalogue',
@@ -233,6 +235,7 @@
'ISO Alpha-3 code' => 'Code ISO Alpha-3',
'If a translation is missing or incomplete :' => 'Si une traduction est manquante ou incomplète :',
'If cart item count is %operator% %quantity%' => 'Le nombre d\'articles dans le panier est %operator% %quantity% ',
+ 'If cart item (include quantity) count is %operator% %quantity%' => 'Le nombre d\'articles (quantité incluse) dans le panier est %operator% %quantity% ',
'If cart total amount is %operator% %amount% %currency%' => 'Si le total du panier est %operator% %amount% %currency% ',
'If checked, this hook will be used by a hook block. If not, by hook function.' => 'Indique que ce point d\'accroche utilise un bloc Smarty hookBlock. sinon une fonction Smarty hook.',
'Image' => 'Image',
diff --git a/core/lib/Thelia/Config/Resources/coupon.xml b/core/lib/Thelia/Config/Resources/coupon.xml
index 06e8f7bb61..960c61815f 100644
--- a/core/lib/Thelia/Config/Resources/coupon.xml
+++ b/core/lib/Thelia/Config/Resources/coupon.xml
@@ -95,6 +95,11 @@
+
+
+
+
+
diff --git a/core/lib/Thelia/Coupon/BaseFacade.php b/core/lib/Thelia/Coupon/BaseFacade.php
index 594249be76..d74bc0c000 100644
--- a/core/lib/Thelia/Coupon/BaseFacade.php
+++ b/core/lib/Thelia/Coupon/BaseFacade.php
@@ -177,6 +177,18 @@ public function getNbArticlesInCart()
return count($this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getCartItems());
}
+ public function getNbArticlesInCartIncludeQuantity()
+ {
+ $cartItems = $this->getCart()->getCartItems();
+ $quantity = 0;
+
+ foreach ($cartItems as $cartItem) {
+ $quantity += $cartItem->getQuantity();
+ }
+
+ return $quantity;
+ }
+
/**
* Return all Coupon given during the Checkout
*
diff --git a/core/lib/Thelia/Coupon/FacadeInterface.php b/core/lib/Thelia/Coupon/FacadeInterface.php
index 8c4ac8d14c..e75a11de86 100644
--- a/core/lib/Thelia/Coupon/FacadeInterface.php
+++ b/core/lib/Thelia/Coupon/FacadeInterface.php
@@ -108,6 +108,13 @@ public function getCheckoutPostagePrice();
*/
public function getNbArticlesInCart();
+ /**
+ * Return the number of Products include quantity in the Cart
+ *
+ * @return int
+ */
+ public function getNbArticlesInCartIncludeQuantity();
+
/**
* Return all Coupon given during the Checkout
*