我有一个客户也需要这个,所以我编写了一个自定义模块,它覆盖了仅计算税前奖励的函数,允许它也计算价格+税。我刚刚在奖励配置区域添加了一个新选项,以允许计算包括税是或否。
不想经历描述如何创建自定义模块的过程(有很多资源),但执行计算的实际函数在这个文件中:code/core/enterprise/reward/model/action /OrderExtra.php
如果您想快速而肮脏地进行操作,请找到 getPoints 函数并将 $monetaryAmount 计算更改为(如果有 $quote):
$monetaryAmount = $quote->getBaseGrandTotal() - $address->getBaseShippingAmount();
和(如果没有 $quote)
$monetaryAmount = $this->getEntity()->getBaseTotalPaid() - $this->getEntity()->getBaseShippingAmount();
希望有帮助!
编辑: getPoints 函数的实际代码应如下所示:
if ($this->_quote) {
$quote = $this->_quote;
// known issue: no support for multishipping quote
$address = $quote->getIsVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress();
// use only money customer spend - shipping & tax
$monetaryAmount = $quote->getBaseGrandTotal() - $address->getBaseShippingAmount();
// *****CALCULATE POINTS INCLUDING TAX
$monetaryAmount -= $address->getBaseTaxAmount();
// set points to 0 if calcualtion is negative
$monetaryAmount = $monetaryAmount < 0 ? 0 : $monetaryAmount;
} else {
// use only money customer spend - shipping
$monetaryAmount = $this->getEntity()->getBaseTotalPaid() - $this->getEntity()->getBaseShippingAmount();
// *****CALCULATE POINTS INCLUDING TAX
$monetaryAmount -= $this->getEntity()->getBaseTaxAmount();
}