常量 FILTER_ACTION_ALL_NOCAP 在 Prestashop CartRule class 中意味着什么?

What the constant FILTER_ACTION_ALL_NOCAP means in Prestashop CartRule class?

在 Prestashop 的 CartRule class 中,定义了以下常量:

/* 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;

有谁知道使用 FILTER_ACTION_ALL_NOCAP 时过滤了哪些购物车规则?

谢谢。

它用于部分使用的购物车规则。当您使用 CartRule::FILTER_ACTION_ALL_NOCAP 过滤器从 CartRule class 调用函数 getContextualValue() 时,它 returns 购物车规则的总金额,而不仅仅是应在当前购物车(数量永远不能高于产品数量):

// 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);
}

验证订单后,检索购物车规则值:

$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)
);

并在必要时生成新的购物车规则。