Merge pull request #49 from PrestaEdit/PSCFV-5879

[-] FO: Fix PSCFV-5879: If default group of customer don't display tax, do not use them
This commit is contained in:
Rémi Gaillard
2012-11-27 06:48:10 -08:00
+13 -5
View File
@@ -99,6 +99,16 @@ class BlockBestSellers extends Module
return; return;
$currency = new Currency($params['cookie']->id_currency); $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); $bestsellers = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 0, 5);
if (!$bestsellers && !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY')) if (!$bestsellers && !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY'))
@@ -108,7 +118,7 @@ class BlockBestSellers extends Module
if ($bestsellers) if ($bestsellers)
foreach ($bestsellers as $bestseller) 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; $best_sellers[] = $bestseller;
} }
@@ -119,7 +129,7 @@ class BlockBestSellers extends Module
)); ));
return $this->display(__FILE__, 'blockbestsellers.tpl'); return $this->display(__FILE__, 'blockbestsellers.tpl');
} }
public function hookLeftColumn($params) public function hookLeftColumn($params)
{ {
return $this->hookRightColumn($params); return $this->hookRightColumn($params);
@@ -155,6 +165,4 @@ class BlockBestSellers extends Module
'homeSize' => Image::getSize('home_default'))); 'homeSize' => Image::getSize('home_default')));
return $this->display(__FILE__, 'blockbestsellers-home.tpl'); return $this->display(__FILE__, 'blockbestsellers-home.tpl');
} }
} }