当前位置: 首页>>代码示例>>PHP>>正文


PHP ProductSale::getBestSalesLight方法代码示例

本文整理汇总了PHP中ProductSale::getBestSalesLight方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductSale::getBestSalesLight方法的具体用法?PHP ProductSale::getBestSalesLight怎么用?PHP ProductSale::getBestSalesLight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProductSale的用法示例。


在下文中一共展示了ProductSale::getBestSalesLight方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hookRightColumn

 function hookRightColumn($params)
 {
     global $smarty, $category_path;
     $category_path_ids = array();
     foreach ($category_path as $cat) {
         $category_path_ids[] = $cat['id_category'];
     }
     $currency = new Currency(intval($params['cookie']->id_currency));
     $bestsellers = ProductSale::getBestSalesLight(intval($params['cookie']->id_lang), 0, 25);
     $best_sellers = array();
     $nr = 0;
     foreach ($bestsellers as $bestseller) {
         if ($nr >= 5) {
             break;
         }
         $display = false;
         foreach (Product::getIndexedCategories($bestseller['id_product']) as $row) {
             if (in_array($row['id_category'], $category_path_ids)) {
                 $display = true;
                 break;
             }
         }
         if ($display) {
             $bestseller['price'] = Tools::displayPrice(Product::getPriceStaticLC(intval($bestseller['id_product'])), $currency, false, false);
             $best_sellers[] = $bestseller;
             $nr += 1;
         }
     }
     $smarty->assign(array('best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium'), 'static_token' => Tools::getToken(false)));
     return $this->display(__FILE__, 'blockbestsellers.tpl');
 }
开发者ID:redb,项目名称:prestashop,代码行数:31,代码来源:blockbestsellers.php

示例2: renderContent

 public function renderContent($setting)
 {
     $t = array('list_type' => '', 'limit' => 12, 'image_width' => '200', 'image_height' => '200');
     $products = array();
     $setting = array_merge($t, $setting);
     switch ($setting['list_type']) {
         case 'newest':
             $products = Product::getNewProducts($this->lang_id, 0, (int) $setting['limit']);
             break;
         case 'featured':
             $category = new Category(Context::getContext()->shop->getCategory(), $this->lang_id);
             $nb = (int) $setting['limit'];
             $products = $category->getProducts((int) $this->lang_id, 1, $nb ? $nb : 8);
             break;
         case 'bestseller':
             $products = ProductSale::getBestSalesLight((int) $this->lang_id, 0, (int) $setting['limit']);
             break;
         case 'special':
             $products = Product::getPricesDrop($this->lang_id, 0, (int) $setting['limit']);
             break;
     }
     $setting['products'] = $products;
     $output = array('type' => 'productlist', 'data' => $setting);
     return $output;
 }
开发者ID:vuduykhuong1412,项目名称:GitHub,代码行数:25,代码来源:productlist.php

示例3: hookRightColumn

 function hookRightColumn($params)
 {
     global $smarty;
     $currency = new Currency(intval($params['cookie']->id_currency));
     $bestsellers = ProductSale::getBestSalesLight(intval($params['cookie']->id_lang), 0, 5);
     $best_sellers = array();
     foreach ($bestsellers as $bestseller) {
         $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic(intval($bestseller['id_product'])), $currency);
         $best_sellers[] = $bestseller;
     }
     $smarty->assign(array('best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium')));
     return $this->display(__FILE__, 'blockbestsellers.tpl');
 }
开发者ID:sealence,项目名称:local,代码行数:13,代码来源:blockbestsellers.php

示例4: getBestSellers

 protected function getBestSellers($params)
 {
     if (Configuration::get('PS_CATALOG_MODE')) {
         return false;
     }
     if (!($result = ProductSale::getBestSalesLight((int) $params['cookie']->id_lang, 0, 3))) {
         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;
 }
开发者ID:paolobattistella,项目名称:aphro,代码行数:15,代码来源:blockbestsellers.php

示例5: renderContent

 public function renderContent($args, $setting)
 {
     # validate module
     unset($args);
     $t = array('name' => '', 'html' => '');
     $setting = array_merge($t, $setting);
     $nb = $setting['itemstab'] ? (int) $setting['itemstab'] : 8;
     $orderby = $setting['orderby'] ? $setting['orderby'] : 'date_add';
     $orderway = $setting['orderway'] ? $setting['orderway'] : 'date_add';
     $items_page = $columns_page = 3;
     if (isset($setting['itemspage']) && $setting['itemspage']) {
         $items_page = $setting['itemspage'];
     }
     if (isset($setting['columns']) && $setting['columns']) {
         $columns_page = $setting['columns'];
     }
     $interval = isset($setting['interval']) ? (int) $setting['interval'] : 8000;
     switch ($setting['specialtype']) {
         case 'newest':
             $products = Product::getNewProducts($this->langID, 0, $nb, false, $orderby, $orderway);
             break;
         case 'featured':
             $category = new Category(Context::getContext()->shop->getCategory(), $this->langID);
             $products = $category->getProducts((int) $this->langID, 1, $nb, $orderby, $orderway);
             break;
         case 'bestseller':
             $products = ProductSale::getBestSalesLight((int) $this->langID, 0, $nb);
             break;
         case 'special':
             $products = Product::getPricesDrop($this->langID, 0, $nb, false, $orderby, $orderway);
             break;
         case 'random':
             $random = true;
             $products = $this->getProducts('WHERE  p.id_product > 0', (int) Context::getContext()->language->id, 1, $nb, $orderby, $orderway, false, true, $random, $nb);
             Configuration::updateValue('LEO_CURRENT_RANDOM_CACHE', '1');
             break;
     }
     $setting['specialtype'] = $setting['specialtype'];
     Context::getContext()->controller->addColorsToProductList($products);
     $setting['products'] = $products;
     $setting['itemsperpage'] = $items_page;
     $setting['columnspage'] = $columns_page;
     $setting['scolumn'] = 12 / $columns_page;
     $setting['interval'] = $interval;
     $setting['tab'] = 'leospecialproduct' . rand(20, rand());
     $output = array('type' => 'specialproduct', 'data' => $setting);
     return $output;
 }
开发者ID:ahmedonee,项目名称:morinella,代码行数:48,代码来源:specialcarousel.php

示例6: hookRightColumn

 public function hookRightColumn($params)
 {
     if (Configuration::get('PS_CATALOG_MODE')) {
         return;
     }
     global $smarty;
     $currency = new Currency((int) $params['cookie']->id_currency);
     $bestsellers = ProductSale::getBestSalesLight((int) $params['cookie']->id_lang, 0, 5);
     if (!$bestsellers and !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY')) {
         return;
     }
     $best_sellers = array();
     foreach ($bestsellers as $bestseller) {
         $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int) $bestseller['id_product']), $currency);
         $best_sellers[] = $bestseller;
     }
     $smarty->assign(array('best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium')));
     return $this->display(__FILE__, 'blockbestsellers.tpl');
 }
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:19,代码来源:blockbestsellers.php

示例7: hookHome

 /**
  * hook home to display generate the product list associated to home featured, news products and best sellers Modules
  */
 public function hookHome()
 {
     $ga_scripts = '';
     // Home featured products
     if ($this->isModuleEnabled('homefeatured')) {
         $category = new Category($this->context->shop->getCategory(), $this->context->language->id);
         $home_featured_products = $this->wrapProducts($category->getProducts((int) Context::getContext()->language->id, 1, Configuration::get('HOME_FEATURED_NBR') ? (int) Configuration::get('HOME_FEATURED_NBR') : 8, 'position'), array(), true);
         $ga_scripts .= $this->addProductImpression($home_featured_products) . $this->addProductClick($home_featured_products);
     }
     // New products
     if ($this->isModuleEnabled('blocknewproducts') && (Configuration::get('PS_NB_DAYS_NEW_PRODUCT') || Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY'))) {
         $new_products = Product::getNewProducts((int) $this->context->language->id, 0, (int) Configuration::get('NEW_PRODUCTS_NBR'));
         $new_products_list = $this->wrapProducts($new_products, array(), true);
         $ga_scripts .= $this->addProductImpression($new_products_list) . $this->addProductClick($new_products_list);
     }
     // Best Sellers
     if ($this->isModuleEnabled('blockbestsellers') && (!Configuration::get('PS_CATALOG_MODE') || Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY'))) {
         $ga_homebestsell_product_list = $this->wrapProducts(ProductSale::getBestSalesLight((int) $this->context->language->id, 0, 8), array(), true);
         $ga_scripts .= $this->addProductImpression($ga_homebestsell_product_list) . $this->addProductClick($ga_homebestsell_product_list);
     }
     $this->js_state = 1;
     return $this->_runJs($this->filter($ga_scripts));
 }
开发者ID:pierreavizou,项目名称:ganalytics,代码行数:26,代码来源:ganalytics.php

示例8: renderContent

 public function renderContent($args, $setting)
 {
     # validate module
     unset($args);
     $t = array('name' => '', 'html' => '');
     $setting = array_merge($t, $setting);
     $nb = $setting['itemstab'] ? (int) $setting['itemstab'] : 6;
     $orderby = $setting['orderby'] ? $setting['orderby'] : 'date_add';
     $orderway = $setting['orderway'] ? $setting['orderway'] : 'ASC';
     $items_page = $setting['itemspage'] ? (int) $setting['itemspage'] : 3;
     $columns_page = $setting['columns'] ? (int) $setting['columns'] : 3;
     $interval = isset($setting['interval']) ? (int) $setting['interval'] : 8000;
     switch ($setting['source']) {
         case 'ptype':
             switch ($setting['ptype']) {
                 case 'newest':
                     $products = Product::getNewProducts($this->langID, 0, $nb, false, $orderby, $orderway);
                     break;
                 case 'featured':
                     $category = new Category(Context::getContext()->shop->getCategory(), $this->langID);
                     $products = $category->getProducts((int) $this->langID, 1, $nb, $orderby, $orderway);
                     break;
                 case 'bestseller':
                     $products = ProductSale::getBestSalesLight((int) $this->langID, 0, $nb);
                     break;
                 case 'special':
                     $products = Product::getPricesDrop($this->langID, 0, $nb, false, $orderby, $orderway);
                     break;
                 case 'random':
                     $random = true;
                     $products = $this->getProducts('WHERE  p.id_product > 0', (int) Context::getContext()->language->id, 1, $nb, $orderby, $orderway, false, true, $random, $nb);
                     Configuration::updateValue('LEO_CURRENT_RANDOM_CACHE', '1');
                     break;
             }
             break;
         case 'pproductids':
             $where = '';
             if (empty($setting['pproductids'])) {
                 return false;
             }
             if ($pproductids = $setting['pproductids']) {
                 $where = 'WHERE  p.id_product IN  (' . pSQL($pproductids) . ')';
             }
             $products = $this->getProducts($where, (int) Context::getContext()->language->id, 1, $nb, $orderby, $orderway);
             break;
         case 'pcategories':
             $where = '';
             $catids = isset($setting['categories']) && $setting['categories'] ? $setting['categories'] : array();
             $products = array();
             if ($catids) {
                 $categorys = implode(',', $catids);
                 $where = 'WHERE  cp.id_category IN  (' . pSQL($categorys) . ')';
                 $products = $this->getProducts($where, (int) Context::getContext()->language->id, 1, $nb, $orderby, $orderway);
             }
             break;
         case 'pmanufacturers':
             $where = '';
             $manufacturers = $setting['pmanufacturer'] ? $setting['pmanufacturer'] : array();
             if ($manufacturers) {
                 $manufacturers = implode(',', $manufacturers);
                 $where = 'WHERE  p.id_manufacturer IN  (' . pSQL($manufacturers) . ')';
             }
             $products = $this->getProducts($where, (int) Context::getContext()->language->id, 1, $nb, $orderby, $orderway);
             break;
     }
     Context::getContext()->controller->addColorsToProductList($products);
     $setting['products'] = $products;
     $setting['itemsperpage'] = $items_page;
     $setting['columnspage'] = $columns_page;
     $setting['scolumn'] = 12 / $columns_page;
     $setting['interval'] = $interval;
     $setting['homeSize'] = Image::getSize(ImageType::getFormatedName('home'));
     $setting['tab'] = 'leoproductcarousel' . rand(20, rand());
     $output = array('type' => 'carousel', 'data' => $setting);
     return $output;
 }
开发者ID:ahmedonee,项目名称:morinella,代码行数:76,代码来源:carousel.php

示例9: renderContent

 public function renderContent($args, $setting)
 {
     $t = array('ptype' => '', 'limit' => 12, 'image_width' => '200', 'image_height' => '200');
     $products = array();
     $setting = array_merge($t, $setting);
     $orderby = $setting['orderby'] ? $setting['orderby'] : 'position';
     $orderway = $setting['orderway'] ? $setting['orderway'] : 'ASC';
     $plimit = $setting['limit'] ? (int) $setting['limit'] : 6;
     switch ($setting['source']) {
         case 'ptype':
             switch ($setting['ptype']) {
                 case 'newest':
                     $products = Product::getNewProducts($this->langID, 0, $plimit);
                     break;
                 case 'featured':
                     $category = new Category(Context::getContext()->shop->getCategory(), $this->langID);
                     $nb = (int) $setting['limit'];
                     $products = $category->getProducts((int) $this->langID, 1, $plimit);
                     break;
                 case 'bestseller':
                     $products = ProductSale::getBestSalesLight((int) $this->langID, 0, $plimit);
                     break;
                 case 'special':
                     $products = Product::getPricesDrop($this->langID, 0, $plimit);
                     break;
             }
             break;
         case 'pproductids':
             $where = '';
             if (empty($setting['pproductids'])) {
                 return false;
             }
             if ($pproductids = $setting['pproductids']) {
                 $where = 'WHERE  p.id_product IN  (' . pSQL($pproductids) . ')';
             }
             $products = $this->getProducts($where, (int) Context::getContext()->language->id, 1, $plimit, $orderby, $orderway);
             break;
         case 'pcategories':
             $where = '';
             $catids = isset($setting['categories']) && $setting['categories'] ? $setting['categories'] : array();
             if ($catids) {
                 $categorys = implode(",", $catids);
                 $where = 'WHERE  cp.id_category IN  (' . pSQL($categorys) . ')';
             }
             $products = $this->getProducts($where, (int) Context::getContext()->language->id, 1, $plimit, $orderby, $orderway);
             break;
         case 'pmanufacturers':
             $where = '';
             $manufacturers = $setting['pmanufacturer'] ? $setting['pmanufacturer'] : array();
             if ($manufacturers) {
                 $manufacturers = implode(",", $manufacturers);
                 $where = 'WHERE  p.id_manufacturer IN  (' . pSQL($manufacturers) . ')';
             }
             $products = $this->getProducts($where, (int) Context::getContext()->language->id, 1, $plimit, $orderby, $orderway);
             break;
     }
     Context::getContext()->controller->addColorsToProductList($products);
     $setting['products'] = $products;
     $output = array('type' => 'products', 'data' => $setting);
     return $output;
 }
开发者ID:evgrishin,项目名称:se1614,代码行数:61,代码来源:product_list.php

示例10: hookRightColumn

 public function hookRightColumn($params)
 {
     global $smarty;
     $currency = new Currency(intval($params['cookie']->id_currency));
     $nb = Configuration::get('PRODUCTS_BESTSELLERS_NBR');
     if (intval(Configuration::get('PRODUCTS_BESTSELLERS_RANDOM'))) {
         $bestsellers = $this->getBestSalesLight(intval($params['cookie']->id_lang), $nb ? $nb : 4, true, $nb ? $nb : 4);
     } else {
         $bestsellers = ProductSale::getBestSalesLight(intval($params['cookie']->id_lang), 0, $nb ? $nb : 4);
     }
     $best_sellers = array();
     foreach ($bestsellers as $bestseller) {
         $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic(intval($bestseller['id_product'])), $currency);
         $best_sellers[] = $bestseller;
     }
     $smarty->assign(array('best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium')));
     return $this->display(__FILE__, 'blockbestsellerz.tpl');
 }
开发者ID:zapalm,项目名称:blockbestsellerz,代码行数:18,代码来源:blockbestsellerz.php

示例11: hookHome

 public function hookHome($params)
 {
     if (Configuration::get('PS_CATALOG_MODE')) {
         return;
     }
     $currency = new Currency($params['cookie']->id_currency);
     $bestsellers = ProductSale::getBestSalesLight((int) $params['cookie']->id_lang, 0, 4);
     if (!$bestsellers && !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY')) {
         return;
     }
     $best_sellers = array();
     if ($bestsellers) {
         foreach ($bestsellers as $bestseller) {
             $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int) $bestseller['id_product']), $currency);
             $best_sellers[] = $bestseller;
         }
     }
     $this->smarty->assign(array('best_sellers' => $best_sellers, 'homeSize' => Image::getSize('home_default')));
     return $this->display(__FILE__, 'blockbestsellers-home.tpl');
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:20,代码来源:blockbestsellers.php

示例12: hookRightColumn

 public function hookRightColumn($params)
 {
     if (Configuration::get('PS_CATALOG_MODE')) {
         return;
     }
     $currency = new Currency($params['cookie']->id_currency);
     if (Product::getTaxCalculationMethod((int) $this->context->customer->id) == PS_TAX_EXC) {
         $usetax = false;
     } else {
         $usetax = true;
     }
     $bestsellers = ProductSale::getBestSalesLight((int) $params['cookie']->id_lang, 0, (int) Configuration::get('PS_BLOCK_LEO_BESTSELLERS_LIMIT'));
     if (!$bestsellers && !Configuration::get('PS_BLOCK_LEO_BESTSELLERS_DISPLAY')) {
         return;
     }
     $best_sellers = array();
     if ($bestsellers) {
         foreach ($bestsellers as $bestseller) {
             $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int) $bestseller['id_product'], $usetax), $currency);
             $best_sellers[] = $bestseller;
         }
     }
     $this->smarty->assign(array('best_sellers' => $best_sellers, 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'smallSize' => Image::getSize(ImageType::getFormatedName('small'))));
     return $this->display(__FILE__, 'leoblockbestsellers.tpl');
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:25,代码来源:leoblockbestsellers.php


注:本文中的ProductSale::getBestSalesLight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。