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 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题