Beispiel #1
0
 protected function getBestSellers($params)
 {
     if (Configuration::get('PS_CATALOG_MODE')) {
         return false;
     }
     if (!($result = ProductSale::getBestSalesLight((int) $params['cookie']->id_lang, 0, (int) Configuration::get('PS_BLOCK_BESTSELLERS_TO_DISPLAY')))) {
         return Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY') ? array() : false;
     }
     $controller = new FrontControllerCore();
     $controller->addColorsToProductList($result);
     $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;
 }
Beispiel #2
0
 public function _cacheProducts()
 {
     if (!isset(HomeFeatured::$cache_products)) {
         $category = new Category((int) Configuration::get('HOME_FEATURED_CAT'), (int) Context::getContext()->language->id);
         $nb = (int) Configuration::get('HOME_FEATURED_NBR');
         if (Configuration::get('HOME_FEATURED_RANDOMIZE')) {
             HomeFeatured::$cache_products = $category->getProducts((int) Context::getContext()->language->id, 1, $nb ? $nb : 8, null, null, false, true, true, $nb ? $nb : 8);
         } else {
             HomeFeatured::$cache_products = $category->getProducts((int) Context::getContext()->language->id, 1, $nb ? $nb : 8, 'position');
         }
         $controller = new FrontControllerCore();
         $controller->addColorsToProductList(HomeFeatured::$cache_products);
     }
     if (HomeFeatured::$cache_products === false || empty(HomeFeatured::$cache_products)) {
         return false;
     }
 }