當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Product::getNewProducts方法代碼示例

本文整理匯總了PHP中Product::getNewProducts方法的典型用法代碼示例。如果您正苦於以下問題:PHP Product::getNewProducts方法的具體用法?PHP Product::getNewProducts怎麽用?PHP Product::getNewProducts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Product的用法示例。


在下文中一共展示了Product::getNewProducts方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: hookHome

 function hookHome($params)
 {
     global $smarty;
     $products = Product::getNewProducts((int) $params['cookie']->id_lang, 0, 5);
     $smarty->assign(array('products' => $products, 'homeSize' => Image::getSize('home')));
     return $this->display(__FILE__, 'blocknewestproducts.tpl');
 }
開發者ID:srikanthash09,項目名稱:codetestdatld,代碼行數:7,代碼來源:blocknewestproducts.php

示例2: hookRightColumn

 function hookRightColumn($params)
 {
     global $smarty;
     $newProducts = Product::getNewProducts(intval($params['cookie']->id_lang), 0, intval(Configuration::get('NEW_PRODUCTS_NBR')));
     $smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium')));
     return $this->display(__FILE__, 'blocknewproducts.tpl');
 }
開發者ID:vincent,項目名稱:theinvertebrates,代碼行數:7,代碼來源:blocknewproducts.php

示例3: initContent

 public function initContent()
 {
     parent::initContent();
     $this->productSort();
     // Override default configuration values: cause the new products page must display latest products first.
     if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby')) {
         $this->orderBy = 'date_add';
         $this->orderWay = 'DESC';
     }
     $nb_products = (int) Product::getNewProducts($this->context->language->id, isset($this->p) ? (int) $this->p - 1 : null, isset($this->n) ? (int) $this->n : null, true);
     $this->pagination($nb_products);
     $products = Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $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' => (int) $nb_products, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
     $this->setTemplate(_PS_THEME_DIR_ . 'new-products.tpl');
 }
開發者ID:evgrishin,項目名稱:se1614,代碼行數:27,代碼來源:NewProductsController.php

示例4: initContent

 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $this->productSort();
     // Override default configuration values: cause the new products page must display latest products first.
     if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby')) {
         $this->orderBy = 'date_add';
         $this->orderWay = 'DESC';
     }
     $nbProducts = (int) Product::getNewProducts($this->context->language->id, null, null, true);
     $this->pagination($nbProducts);
     $products = Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $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' => (int) $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_ . 'new-products.tpl');
     }
 }
開發者ID:WhisperingTree,項目名稱:etagerca,代碼行數:29,代碼來源:NewProductsController.php

示例5: 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

示例6: process

 public function process()
 {
     parent::process();
     $this->productSort();
     $nbProducts = (int) Product::getNewProducts((int) self::$cookie->id_lang, isset($this->p) ? (int) $this->p - 1 : NULL, isset($this->n) ? (int) $this->n : NULL, true);
     $this->pagination($nbProducts);
     self::$smarty->assign(array('products' => Product::getNewProducts((int) self::$cookie->id_lang, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => (int) $nbProducts, 'homeSize' => Image::getSize('home')));
 }
開發者ID:Evil1991,項目名稱:PrestaShop-1.4,代碼行數:8,代碼來源:NewProductsController.php

示例7: initContent

 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $this->productSort();
     $nbProducts = (int) Product::getNewProducts($this->context->language->id, isset($this->p) ? (int) $this->p - 1 : null, isset($this->n) ? (int) $this->n : null, true);
     $this->pagination($nbProducts);
     $this->context->smarty->assign(array('products' => Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => (int) $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
     $this->setTemplate(_PS_THEME_DIR_ . 'new-products.tpl');
 }
開發者ID:jicheng17,項目名稱:pengwine,代碼行數:13,代碼來源:NewProductsController.php

示例8: displayMain

 public function displayMain()
 {
     global $smarty;
     $this->loadFilter();
     $products = Product::getNewProducts($this->p, $this->n, $this->by, $this->way);
     $this->pagination($products['total']);
     $smarty->assign(array('products' => $products['entitys']));
     return $smarty->fetch('new-products.tpl');
 }
開發者ID:yiuked,項目名稱:tmcart,代碼行數:9,代碼來源:NewProductView.php

示例9: hookhome

 function hookhome($params)
 {
     global $smarty;
     $newProducts = Product::getNewProducts((int) $params['cookie']->id_lang, 0, (int) Configuration::get('NEW_PRODUCTS_NBR'));
     if (!$newProducts and !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) {
         return;
     }
     $smarty->assign(array('new_products' => $newProducts, 'homeSize' => Image::getSize('home_default')));
     return $this->display(__FILE__, 'tdnewproducts.tpl');
 }
開發者ID:reshman,項目名稱:swkart-presta,代碼行數:10,代碼來源:tdnewproducts.php

示例10: getNewProducts

 private function getNewProducts()
 {
     if (!Configuration::get('NEW_PRODUCTS_NBR_TM')) {
         return;
     }
     $newProducts = Product::getNewProducts((int) $this->context->language->id, 0, (int) Configuration::get('NEW_PRODUCTS_NBR_TM'));
     if (!$newProducts && Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) {
         return;
     }
     return $newProducts;
 }
開發者ID:IngenioContenidoDigital,項目名稱:serta,代碼行數:11,代碼來源:tmnewproducts.php

示例11: initContent

 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $this->productSort();
     // Override default configuration values: cause the new products page must display latest products first.
     if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby')) {
         $this->orderBy = 'date_add';
         $this->orderWay = 'DESC';
     }
     $nbProducts = (int) Product::getNewProducts($this->context->language->id, isset($this->p) ? (int) $this->p - 1 : null, isset($this->n) ? (int) $this->n : null, true);
     $this->pagination($nbProducts);
     $this->context->smarty->assign(array('products' => Product::getNewProducts($this->context->language->id, (int) $this->p - 1, (int) $this->n, false, $this->orderBy, $this->orderWay), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => (int) $nbProducts, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM')));
     $this->setTemplate(_PS_THEME_DIR_ . 'new-products.tpl');
 }
開發者ID:toufikadfab,項目名稱:PrestaShop-1.5,代碼行數:18,代碼來源:NewProductsController.php

示例12: hookRightColumn

 function hookRightColumn($params)
 {
     global $smarty;
     $currency = new Currency(intval($params['cookie']->id_currency));
     $newProducts = Product::getNewProducts(intval($params['cookie']->id_lang), 0, Configuration::get('NEW_PRODUCTS_NBR'));
     $new_products = array();
     if ($newProducts) {
         foreach ($newProducts as $newProduct) {
             $new_products[] = $newProduct;
         }
     }
     $smarty->assign(array('new_products' => $new_products, 'mediumSize' => Image::getSize('medium')));
     return $this->display(__FILE__, 'blocknewproducts.tpl');
 }
開發者ID:sealence,項目名稱:local,代碼行數:14,代碼來源:blocknewproducts.php

示例13: getNewProducts

 protected function getNewProducts()
 {
     if (!Configuration::get('NEW_PRODUCTS_NBR')) {
         return;
     }
     $newProducts = false;
     if (Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) {
         $newProducts = Product::getNewProducts((int) $this->context->language->id, 0, (int) Configuration::get('NEW_PRODUCTS_NBR'));
     }
     if (!$newProducts && Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) {
         return;
     }
     return $newProducts;
 }
開發者ID:jpodracky,項目名稱:dogs,代碼行數:14,代碼來源:blocknewproducts.php

示例14: 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

示例15: _getProducts

 /**
  * Récupération de la liste des produits
  * @param string $type
  * @param int $nb_products
  */
 protected function _getProducts($type, $nb_products)
 {
     switch ($type) {
         case 'price_drop':
             return Product::getPricesDrop((int) $this->context->language->id, 0, $nb_products);
             break;
         case 'category':
             $this->_datas['id_category'] ? $id_category = $this->_datas['id_category'] : ($id_category = (int) Configuration::get('HOME_FEATURED_CAT'));
             $category = new Category($id_category, (int) $this->context->language->id);
             return $category->getProducts((int) $this->context->language->id, 1, $nb_products, 'position');
             break;
         case 'new':
         default:
             return Product::getNewProducts((int) $this->context->language->id, 0, $nb_products);
             break;
     }
 }
開發者ID:nenes25,項目名稱:prestashop_eicmslinks,代碼行數:22,代碼來源:WidgetProducts.php


注:本文中的Product::getNewProducts方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。