douduikai0562
2018-02-09 07:26
浏览 63
已采纳

在Prestashop CartRule类中常量FILTER_ACTION_ALL_NOCAP的含义是什么?

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.

图片转代码服务由CSDN问答提供 功能建议

在Prestashop的CartRule类中,定义了这个常量:

 <  code> / *在计算减少的值时检索应用于购物车的购物车规则时使用的过滤器* / 
const FILTER_ACTION_ALL = 1;  
 ncst FILTER_ACTION_SHIPPING = 2; 
 ncst FILTER_ACTION_REDUCTION = 3; 
 ncst FILTER_ACTION_GIFT = 4; 
const FILTER_ACTION_ALL_NOCAP = 5; 
   
 
 

有谁知道什么购物车规则被过滤时 使用FILTER_ACTION_ALL_NOCAP?

谢谢。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doulan6150 2018-02-09 09:06
    已采纳

    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.

    打赏 评论

相关推荐 更多相似问题