在Prestashop的CartRule类中,定义了这个常量:
/* 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时过滤了什么购物车规则?
谢谢。
答案 0 :(得分:1)
它用于部分使用的购物车规则。当您使用getContextualValue()
过滤器从CartRule
班级调用功能CartRule::FILTER_ACTION_ALL_NOCAP
时,它会返回购物车总规则金额,而不仅仅是应当在当前购物车中应用的金额(金额永远不会更高)比产品数量):
// 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)
);
如有必要,会生成新的购物车规则。