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


PHP ProductSale::isBestsaler方法代码示例

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


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

示例1: getProductsProperties

 public static function getProductsProperties($id_lang, $query_result)
 {
     $results_array = array();
     if (is_array($query_result)) {
         foreach ($query_result as $row) {
             if ($row2 = Product::getProductProperties($id_lang, $row)) {
                 if (Pack::isPack($row['id_product'])) {
                     $row2['is_pack'] = true;
                     $row2['pack_items'] = Pack::getItemTable($row['id_product'], $id_lang, true);
                     if (!$row2['pack_items']) {
                         $row2['pack_items'] = array();
                     }
                 }
                 $row['is_bestsaler'] = ProductSale::isBestsaler($row['id_product']);
                 $results_array[] = $row2;
             }
         }
     }
     return $results_array;
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:20,代码来源:Product.php

示例2: initContent


//.........这里部分代码省略.........
         $this->assignImages();
         $this->assign3dImages();
         // Assign attribute groups to the template
         $this->assignAttributesGroups();
         // Assign attributes combinations to the template
         $this->assignAttributesCombinations();
         // Pack management
         $pack_items = $this->product->cache_is_pack ? Pack::getItemTable($this->product->id, $this->context->language->id, true) : array();
         if (is_array($pack_items) && count($pack_items)) {
             foreach ($pack_items as &$pack_item) {
                 $pack_item['features'] = Product::getFrontFeaturesStatic($this->context->language->id, $pack_item['id_product']);
             }
         }
         $this->context->smarty->assign('packItems', $pack_items);
         $this->context->smarty->assign('packs', Pack::getPacksTable($this->product->id, $this->context->language->id, true, 1));
         if (isset($this->category->id) && $this->category->id) {
             $return_link = Tools::safeOutput($this->context->link->getCategoryLink($this->category));
         } else {
             $return_link = 'javascript: history.back();';
         }
         //reviews
         //                        $average = ProductComment::getAverageGrade((int)Tools::getValue('id_product'));
         $nbComments = (int) ProductComment::getCommentNumber((int) Tools::getValue('id_product'));
         $act_pack = 0;
         //паки
         if (!$flag_pack) {
             $sql = "SELECT DISTINCT(id_product_pack) FROM " . _DB_PREFIX_ . "pack WHERE id_product_item={$this->product->id}";
             $pack_products = array();
             $result_packs = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
             if (is_array($result_packs) && count($result_packs)) {
                 foreach ($result_packs as $k => $id_product_pack) {
                     $prod = new Product($id_product_pack['id_product_pack'], $this->context->language->id, true);
                     $cover = $prod->getCover((int) $prod->id);
                     if ($cover) {
                         $pack_products[$k]['id_image'] = $cover['id_image'];
                     } else {
                         $pack_products[$k]['id_image'] = null;
                     }
                     $price = $prod->getPrice(true, null, 2);
                     $price_old = $prod->getPriceWithoutReduct(false, null, 2);
                     if (isset($prod->specificPrice) && is_array($prod->specificPrice)) {
                         $pack_products[$k]['sale_percentage'] = $prod->specificPrice['reduction_type'] == 'percentage' ? $prod->specificPrice['reduction'] * 100 : $prod->specificPrice['reduction'] / $price_old * 100;
                     }
                     $pack_products[$k]['active'] = $prod->active;
                     if ($prod->active) {
                         $act_pack = 1;
                     }
                     $pack_products[$k]['count_reviews'] = (int) ProductComment::getCommentNumber((int) $prod->id);
                     $pack_products[$k]['star_reviews'] = ProductComment::getRatings((int) $prod->id);
                     $pack_products[$k]['price'] = $price;
                     $pack_products[$k]['price_old'] = $price_old;
                     $pack_products[$k]['on_sale'] = (bool) ($price != $price_old);
                     $pack_products[$k]['id_product_pack'] = $prod->id;
                     $pack_products[$k]['link'] = $this->context->link->getProductLink($prod);
                     $pack_products[$k]['name'] = $prod->name;
                     $pack_products[$k]['link_rewrite'] = $prod->link_rewrite;
                     $pack_products[$k]['items'] = Pack::getItemTable($prod->id, $this->context->language->id, true);
                     unset($prod);
                 }
             }
         } else {
             $pack_products = null;
         }
         //var_dump($pack_products);exit();
         //текстовой блок доставка
         $cms_block = '';
         $cms = new CMS($this->block_cms_id, $this->context->language->id);
         if (is_object($cms)) {
             $cms_block = $cms->content;
         }
         $sql = "SELECT id_category FROM ps_category_product WHERE id_product={$this->product->id}";
         $result_cats = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
         $params_image = null;
         foreach ($result_cats as $cat) {
             $params_image = file_exists(_PS_IMG_DIR_ . '/c_icon/' . $cat['id_category'] . '.png') ? '/img/c_icon/' . $cat['id_category'] . '.png' : null;
             if (!$params_image) {
                 $params_image = file_exists(_PS_IMG_DIR_ . '/c_icon/' . $cat['id_category'] . '.jpg') ? '/img/c_icon/' . $cat['id_category'] . '.jpg' : null;
             }
             if ($params_image) {
                 break;
             }
         }
         //{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}
         $this->context->smarty->assign(array('is_bestsaler' => ProductSale::isBestsaler($this->product->id), 'og_type' => 'product', 'params_image' => $params_image, 'cms_block' => $cms_block, 'pack_products' => $pack_products, 'act_pack' => $act_pack, 'url' => $this->context->link->getProductLink($this->product), 'minimal_quantity' => $this->product->minimal_quantity > 1 ? $this->product->minimal_quantity : 1, 'nbComments' => $nbComments, 'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), 'customizationFields' => $this->product->customizable ? $this->product->getCustomizationFields($this->context->language->id) : false, 'accessories' => $this->product->getAccessories($this->context->language->id), 'return_link' => $return_link, 'product' => $this->product, 'product_manufacturer' => new Manufacturer((int) $this->product->id_manufacturer, $this->context->language->id), 'token' => Tools::getToken(false), 'features' => $this->product->getFrontFeatures($this->context->language->id), 'attachments' => $this->product->cache_has_attachments ? $this->product->getAttachments($this->context->language->id) : array(), 'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int) $this->product->out_of_stock), 'last_qties' => (int) Configuration::get('PS_LAST_QTIES'), 'HOOK_EXTRA_LEFT' => Hook::exec('displayLeftColumnProduct'), 'HOOK_EXTRA_RIGHT' => Hook::exec('displayRightColumnProduct'), 'HOOK_PRODUCT_OOS' => Hook::exec('actionProductOutOfStock', array('product' => $this->product)), 'HOOK_PRODUCT_ACTIONS' => Hook::exec('displayProductButtons', array('product' => $this->product)), 'HOOK_PRODUCT_TAB' => Hook::exec('displayProductTab', array('product' => $this->product)), 'HOOK_PRODUCT_TAB_CONTENT' => Hook::exec('displayProductTabContent', array('product' => $this->product)), 'HOOK_PRODUCT_CONTENT' => Hook::exec('displayProductContent', array('product' => $this->product)), 'display_qties' => (int) Configuration::get('PS_DISPLAY_QTIES'), 'display_ht' => !Tax::excludeTaxeOption(), 'currencySign' => $this->context->currency->sign, 'currencyRate' => $this->context->currency->conversion_rate, 'currencyFormat' => $this->context->currency->format, 'currencyBlank' => $this->context->currency->blank, 'jqZoomEnabled' => Configuration::get('PS_DISPLAY_JQZOOM'), 'ENT_NOQUOTES' => ENT_NOQUOTES, 'outOfStockAllowed' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'errors' => $this->errors, 'body_classes' => array($this->php_self . '-' . $this->product->id, $this->php_self . '-' . $this->product->link_rewrite, 'category-' . (isset($this->category) ? $this->category->id : ''), 'category-' . (isset($this->category) ? $this->category->getFieldByLang('link_rewrite') : '')), 'display_discount_price' => Configuration::get('PS_DISPLAY_DISCOUNT_PRICE')));
     }
     if (isset($_GET['quick_view'])) {
         $this->ajax = true;
         if ($flag_pack) {
             $this->setTemplate(_PS_THEME_DIR_ . 'preview_pack.tpl');
         } else {
             $this->setTemplate(_PS_THEME_DIR_ . 'preview.tpl');
         }
     } else {
         if ($flag_pack) {
             $this->setTemplate(_PS_THEME_DIR_ . 'product-pack.tpl');
         } else {
             $this->setTemplate(_PS_THEME_DIR_ . 'product.tpl');
         }
     }
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:101,代码来源:ProductController.php


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