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

在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.

  • 写回答

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序