From 74f49422547ef3f647fd9c7e40594e8efbbf0e85 Mon Sep 17 00:00:00 2001 From: PrestaEdit Date: Mon, 26 Nov 2012 22:42:57 +0100 Subject: [PATCH 1/3] // If default group of customer don't display tax, do not use them --- classes/Product.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/classes/Product.php b/classes/Product.php index ff4e1f8a1..763e103ac 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -2439,6 +2439,9 @@ class ProductCore extends ObjectModel && Configuration::get('VATNUMBER_MANAGEMENT')) $usetax = false; + if($usetax != false && Group::getPriceDisplayMethod($id_group)) + $usetax = false; + if (is_null($id_customer) && Validate::isLoadedObject($context->customer)) $id_customer = $context->customer->id; From 53b14756311cf401fae429b90ef278db3c959ed7 Mon Sep 17 00:00:00 2001 From: Jonathan Danse Date: Tue, 27 Nov 2012 10:09:22 +0100 Subject: [PATCH 2/3] // remove test in Product --- classes/Product.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/classes/Product.php b/classes/Product.php index 763e103ac..ff4e1f8a1 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -2439,9 +2439,6 @@ class ProductCore extends ObjectModel && Configuration::get('VATNUMBER_MANAGEMENT')) $usetax = false; - if($usetax != false && Group::getPriceDisplayMethod($id_group)) - $usetax = false; - if (is_null($id_customer) && Validate::isLoadedObject($context->customer)) $id_customer = $context->customer->id; From 41f7a8678fb58df353efb9b6719de87c9371cc41 Mon Sep 17 00:00:00 2001 From: Jonathan Danse Date: Tue, 27 Nov 2012 10:24:46 +0100 Subject: [PATCH 3/3] // add $usetax in block BestSellers --- modules/blockbestsellers/blockbestsellers.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/blockbestsellers/blockbestsellers.php b/modules/blockbestsellers/blockbestsellers.php index ea8eb2bb2..4f00dcc91 100644 --- a/modules/blockbestsellers/blockbestsellers.php +++ b/modules/blockbestsellers/blockbestsellers.php @@ -99,6 +99,16 @@ class BlockBestSellers extends Module return; $currency = new Currency($params['cookie']->id_currency); + + $id_group = $this->context->customer->id_default_group; + if(Group::getPriceDisplayMethod($id_group) == PS_TAX_EXC) + $usetax = false; + else + if(Configuration::get('PS_TAX_DISPLAY') == PS_TAX_EXC) + $usetax = false; + else + $usetax = true; + $bestsellers = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 0, 5); if (!$bestsellers && !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY')) @@ -108,7 +118,7 @@ class BlockBestSellers extends Module if ($bestsellers) foreach ($bestsellers as $bestseller) { - $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int)($bestseller['id_product'])), $currency); + $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int)($bestseller['id_product']), $usetax), $currency); $best_sellers[] = $bestseller; } @@ -119,7 +129,7 @@ class BlockBestSellers extends Module )); return $this->display(__FILE__, 'blockbestsellers.tpl'); } - + public function hookLeftColumn($params) { return $this->hookRightColumn($params); @@ -155,6 +165,4 @@ class BlockBestSellers extends Module 'homeSize' => Image::getSize('home_default'))); return $this->display(__FILE__, 'blockbestsellers-home.tpl'); } -} - - +} \ No newline at end of file