2017-03-15 11 views
0

PrestaShopの1.6.1.10PrestaShopの1.6プロダクト、カスタマーグループの割引を使用して

組み合わせと顧客グループの割引との製品を作成する場合は、製品ページには割引なしの価格を表示します。

ただし、商品をカートに追加すると割引が適用されます。

は、機能を追加し、私はフロント\ ProductController.php \コントローラで、次のコード変更

によって解決a product with combination and group discount

答えて

1

を参照してください:

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); 
関連する問題