Prestashop 1.6使用custome group折扣时显示错误价格组合的产品

Prestashop 1.6使用custome group折扣时显示错误价格组合的产品,prestashop,prestashop-1.6,Prestashop,Prestashop 1.6,Prestashop 1.6.1.10 创建具有组合和客户群折扣的产品时,产品页面将显示不带折扣的价格 但是,当您将产品添加到购物车时,折扣将被应用 请参见我在controllers\front\ProductController.php中通过以下代码更改解决了问题 添加功能: protected function getGroupReduction() { $id_customer = (isset($this->context->customer) ? (int)$thi

Prestashop 1.6.1.10

创建具有组合和客户群折扣的产品时,产品页面将显示不带折扣的价格

但是,当您将产品添加到购物车时,折扣将被应用


请参见

我在controllers\front\ProductController.php中通过以下代码更改解决了问题

添加功能:

protected function getGroupReduction() {
    $id_customer = (isset($this->context->customer) ? (int)$this->context->customer->id : 0);
    $id_group = (int)Group::getCurrent()->id;
    $id_country = $id_customer ? (int)Customer::getCurrentCountry($id_customer) : (int)Tools::getCountry();

    $group_reduction = GroupReduction::getValueForProduct($this->product->id, $id_group);
    if ($group_reduction === false) {
        $group_reduction = Group::getReduction((int)$this->context->cookie->id_customer) / 100;
    }
    return $group_reduction;
}
替换第467行:

$combinations[$row['id_product_attribute']]['price'] = (float)Tools::convertPriceFull($row['price'], null, Context::getContext()->currency, false);
使用以下行:

            $group_reduction = $this->getGroupReduction();
            $price = $row['price'] - $row['price']* $group_reduction;
            $combinations[$row['id_product_attribute']]['price'] = (float)Tools::convertPriceFull($price, null, Context::getContext()->currency, false);