Merge branch 'ticket/r13013-bug-regle-panier'

This commit is contained in:
Rodney Figaro 2017-04-13 18:05:46 +02:00
commit 5eb9da95b9

View File

@ -599,7 +599,7 @@ class CartRule extends CartRuleCore
// @Override [ticket 12906]
// same as getCustomerCartRules but ordered by priority (if same priority, ordered by id)
//
public static function getCustomerCartRulesByPriority($id_lang, $id_customer, $active = false, $includeGeneric = true, $inStock = false, Cart $cart = null)
public static function getCustomerCartRulesByPriority($id_lang, $id_customer, $active = false, $includeGeneric = true, $inStock = false, Cart $cart = null, $exclude_with_voucher=false)
{
if (!CartRule::isFeatureActive())
return array();
@ -616,11 +616,11 @@ class CartRule extends CartRuleCore
AND cr.date_from < "'.date('Y-m-d H:i:s').'"
AND cr.date_to > "'.date('Y-m-d H:i:s').'"
'.($active ? 'AND cr.`active` = 1' : '').'
'.($inStock ? 'AND cr.`quantity` > 0' : '')."
'.($inStock ? 'AND cr.`quantity` > 0' : '').'
'.($exclude_with_voucher ? ' AND TRIM(cr.`code`) = \'\'' : '')."
ORDER BY cr.`priority`, cr.`id_cart_rule`"
);
// Remove cart rule that does not match the customer groups
$customerGroups = Customer::getGroupsStatic($id_customer);
@ -730,7 +730,7 @@ class CartRule extends CartRuleCore
//
static function getEligibilityAndMinimumAmount(Context $context)
{
$all_cart_rules = CartRule::getCustomerCartRulesByPriority($context->language->id, $context->customer->id, true, true, true);
$all_cart_rules = CartRule::getCustomerCartRulesByPriority($context->language->id, $context->customer->id, true, true, true, null, true);
$notEligible = false;
$previous_priority = 1;