In the CartRule class of Prestashop, are defined this constants:
/* Filters used when retrieving the cart rules applied to a cart of when calculating the value of a reduction */
const FILTER_ACTION_ALL = 1;
const FILTER_ACTION_SHIPPING = 2;
const FILTER_ACTION_REDUCTION = 3;
const FILTER_ACTION_GIFT = 4;
const FILTER_ACTION_ALL_NOCAP = 5;
Does anyone know what cart rules are filtered when using FILTER_ACTION_ALL_NOCAP?
Thank you.
It's used for cart rules with partial use. When you call function getContextualValue()
from CartRule
class with CartRule::FILTER_ACTION_ALL_NOCAP
filter, it returns the total cart rule amount, not only the amount that should be applied in the current cart (amount can never be higher than products amount):
// The reduction cannot exceed the products total, except when we do not want it to be limited (for the partial use calculation)
if ($filter != CartRule::FILTER_ACTION_ALL_NOCAP) {
$reduction_amount = min($reduction_amount, $this->reduction_tax ? $cart_amount_ti : $cart_amount_te);
}
When the order is validated, the cart rule value is retrieved:
$values = array(
'tax_incl' => $cart_rule['obj']->getContextualValue(true, $this->context, CartRule::FILTER_ACTION_ALL_NOCAP, $package),
'tax_excl' => $cart_rule['obj']->getContextualValue(false, $this->context, CartRule::FILTER_ACTION_ALL_NOCAP, $package)
);
And a new cart rule is generated if necessary.