コード例 #1
0
ファイル: blockbestsellers.php プロジェクト: Arikito/barbator
 protected function getBestSellers($params)
 {
     if (Configuration::get('PS_CATALOG_MODE')) {
         return false;
     }
     if ($this->context->controller->php_self == 'category') {
         $id_category = $this->context->controller->category->id_category;
         if (!($result = ProductSale::getBestSalesLightWithCategory((int) $params['cookie']->id_lang, 0, (int) Configuration::get('PS_BLOCK_BESTSELLERS_TO_DISPLAY'), null, $id_category))) {
             return Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY') ? array() : false;
         }
     } else {
         if (!($result = ProductSale::getBestSalesLight((int) $params['cookie']->id_lang, 0, (int) Configuration::get('PS_BLOCK_BESTSELLERS_TO_DISPLAY'), null))) {
             return Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY') ? array() : false;
         }
     }
     $currency = new Currency($params['cookie']->id_currency);
     $usetax = Product::getTaxCalculationMethod((int) $this->context->customer->id) != PS_TAX_EXC;
     foreach ($result as &$row) {
         $row['price'] = Tools::displayPrice(Product::getPriceStatic((int) $row['id_product'], $usetax), $currency);
     }
     return $result;
 }