本文整理汇总了PHP中ProductSale::getNbSales方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductSale::getNbSales方法的具体用法?PHP ProductSale::getNbSales怎么用?PHP ProductSale::getNbSales使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProductSale
的用法示例。
在下文中一共展示了ProductSale::getNbSales方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initContent
public function initContent()
{
if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
parent::initContent();
$this->productSort();
$nb_products = (int) ProductSale::getNbSales();
$this->pagination($nb_products);
if (!Tools::getValue('orderby')) {
$this->orderBy = 'sales';
}
$products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
/************************* /Images Array ******************************/
if (method_exists('Product', 'getProductsImgs')) {
$image_array = array();
for ($i = 0; $i < $nb_products; $i++) {
if (isset($products[$i]['id_product'])) {
$image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']);
}
}
$this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL);
}
/************************* /Images Array ******************************/
$this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nb_products, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
$this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
} else {
Tools::redirect('index.php?controller=404');
}
}
示例2: process
public function process()
{
$this->productSort();
$nbProducts = (int) ProductSale::getNbSales();
$this->pagination($nbProducts);
self::$smarty->assign(array('products' => ProductSale::getBestSales((int) self::$cookie->id_lang, (int) $this->p - 1, (int) $this->n, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize('home')));
}
示例3: initContent
public function initContent()
{
parent::initContent();
$this->productSort();
$nbProducts = (int) ProductSale::getNbSales();
$this->pagination($nbProducts);
$this->context->smarty->assign(array('products' => ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize('home_default'), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
$this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
}
示例4: initContent
public function initContent()
{
if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
parent::initContent();
$this->productSort();
$nbProducts = (int) ProductSale::getNbSales();
$this->pagination($nbProducts);
$products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
$this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
$this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
} else {
Tools::redirect('index.php?controller=404');
}
}
示例5: initContent
public function initContent()
{
if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
parent::initContent();
$this->productSort();
$nbProducts = (int) ProductSale::getNbSales();
$this->pagination($nbProducts);
$products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay);
$this->addColorsToProductList($products);
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displayLeftColumn'), 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
if ($this->ajax) {
$product_list = $this->context->smarty->fetch(_PS_THEME_DIR_ . 'product-list.tpl');
$pagination = $this->context->smarty->fetch(_PS_THEME_DIR_ . 'pagination.tpl');
$nbLeftProducts = $nbProducts - ($this->n * ($this->p - 1) + count($products));
$nbLeftProductsPercentage = ($nbProducts - $nbLeftProducts) / $nbProducts * 100;
echo Tools::jsonEncode(array('productList' => utf8_encode($product_list), 'pagination' => $pagination, 'nbRenderedProducts' => $nbProducts, 'nbLeftProducts' => $nbLeftProducts, 'nbLeftProductsPercentage' => $nbLeftProductsPercentage));
die;
} else {
$this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl');
}
} else {
Tools::redirect('index.php?controller=404');
}
}
示例6: dirname
<?php
include dirname(__FILE__) . '/config/config.inc.php';
include dirname(__FILE__) . '/header.php';
include dirname(__FILE__) . '/product-sort.php';
$nbProducts = intval(ProductSale::getNbSales());
include dirname(__FILE__) . '/pagination.php';
$smarty->assign(array('products' => ProductSale::getBestSales(intval($cookie->id_lang), intval($p) - 1, intval($n), $orderBy, $orderWay), 'nbProducts' => $nbProducts));
$smarty->display(_PS_THEME_DIR_ . 'best-sales.tpl');
include dirname(__FILE__) . '/footer.php';