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


PHP CategoryModel::getParents方法代码示例

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


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

示例1: renderDefault

 public function renderDefault($id, $id_category)
 {
     if (!$id) {
         throw new NBadRequestException('Product neexistuje');
     }
     $this->template->id_category = $id_category;
     $this->template->category_parents = CategoryModel::getParents($this->template->id_category, $this->id_lang);
     $this->template->product = ProductModel::getProductWithParams($id, $this->id_lang, $this->user);
     $this['productNewsSaleAvaiableTable']->setIdProduct($id);
     $this['productNewsSaleAvaiableTable']->setIdCategory($id_category);
     $this['productNewsSaleAvaiableTable']->setIdLang($this->id_lang);
     $this['productNewsSaleAvaiableTable']->setUser($this->user);
     /*
      * META INFO
      */
     if ($this->template->product) {
         if ($this->template->product['meta_title'] == '') {
             $this['header']->addTitle($this->template->product['name']);
         } else {
             $this['header']->addTitle($this->template->product['meta_title']);
         }
         if ($this->template->product['meta_description'] == '') {
             $this['header']->setDescription($this->template->product['name']);
         } else {
             $this['header']->setDescription($this->template->product['meta_description']);
         }
         $this['header']->addKeywords($this->template->product['meta_keywords']);
     }
     $this['header']['js']->addFile('jquery/bubblepopup/jquery.bubblepopup.v2.3.1.min.js');
     $this['header']['css']->addFile('../jscripts/jquery/bubblepopup/jquery.bubblepopup.v2.3.1.css');
 }
开发者ID:oaki,项目名称:demoshop,代码行数:31,代码来源:Front_ProductPresenter.php

示例2: beforeRender

 function beforeRender()
 {
     parent::beforeRender();
     $this->template->id_category = $this->id;
     $this->template->category_parents = CategoryModel::getParents($this->template->id_category, $this->id_lang);
     //ak je iba jeden parent zobraz kategorie, inak zobraz produkty
     if (count($this->template->category_parents) == 1) {
         $id_parent = current($this->template->category_parents);
         $category_list = CategoryModel::getFluent('id_category')->where('id_parent = %i', $id_parent)->fetchAll();
         $this->template->categories = array();
         foreach ($category_list as $l) {
             $_tmp = CategoryModel::get($l->id_category, $this->id_lang);
             $_tmp['product_count'] = dibi::fetchSingle("SELECT COUNT(id_product) FROM [product] JOIN [category_product] USING(id_product) WHERE id_category = %i", $l->id_category);
             $this->template->categories[] = $_tmp;
         }
         $this->template->product_count = dibi::fetchSingle("SELECT COUNT(id_product) FROM [product] JOIN [category_product] USING(id_product) WHERE id_category = %i", $this->id);
     } else {
         $list = dibi::select('id_product')->from('product')->join('category_product')->using('(id_product)')->join('product_param')->using('(id_product)')->where('id_category = ', $this->id, 'AND product.active = 1');
         /*
          * Filter
          */
         $orderSession = $this['quickFilter']->getSession();
         //			dde($orderSession['order']);
         //			$orderSession['order'] = 'price';
         if ($orderSession['order']) {
             $list->orderBy($orderSession['order']);
         } else {
             $order_array = $this['quickFilter']->getOrderFilterArray();
             $list->orderBy(key($order_array));
         }
         $list->groupBy('id_product');
         //			dump($order);
         //		print_r($list);
         $count_list = clone $list;
         //			$count = $count_list->removeClause('select')->select('COUNT(id_product)')->fetchSingle();
         $count = count($count_list);
         $vp = new VisualPaginator($this, 'paginator');
         $paginator = $vp->getPaginator();
         $numOnPageSession = $this['quickFilter']->getSession();
         if ($numOnPageSession['num']) {
             $paginator->itemsPerPage = $numOnPageSession['num'];
         } else {
             $num_on_page_array = $this['quickFilter']->getNumOnPageFilterArray();
             $paginator->itemsPerPage = key($num_on_page_array);
         }
         $paginator->itemCount = (int) $count;
         $this->template->product_count = $count;
         $this->template->products = $list->limit($paginator->offset . ',' . $paginator->itemsPerPage)->fetchAll();
         //dump($this->template->products);
         $this->template->paginator = $paginator;
         foreach ($this->template->products as $k => $p) {
             $this->template->products[$k] = ProductModel::getProductWithParams($p['id_product'], $this->id_lang, $this->user);
         }
         //		};
     }
     //		print_r($this->template->products);exit;
 }
开发者ID:oaki,项目名称:demoshop,代码行数:57,代码来源:Front_EshopPresenter.php

示例3: renderCategory

 function renderCategory($id_category, $id_lang, $color = 'black')
 {
     $template = $this->template;
     $template->color_home = $color;
     $tmp = CategoryModel::getParents($id_category, $id_lang);
     $tmp = array_reverse($tmp);
     $tree = CategoryModel::getTree($id_lang);
     $template->parents = array();
     foreach ($tmp as $t) {
         $template->parents[] = $tree[$t];
     }
     $template->setFile(dirname(__FILE__) . '/eshop_category.latte');
     $template->render();
 }
开发者ID:oaki,项目名称:demoshop,代码行数:14,代码来源:BreadcrumbControl.php

示例4: getParents

 static function getParents()
 {
     $model = new CategoryModel();
     $result = $model->getParents();
     return $result;
 }
开发者ID:jianchengdu,项目名称:dangjia,代码行数:6,代码来源:CategoryData.php

示例5: getProductWithParams

 static function getProductWithParams($id_product, $id_lang, $user)
 {
     $product = self::get($id_product, $id_lang);
     if (!$product) {
         throw new NBadRequestException('Product neexistuje');
     }
     $product = (array) $product;
     $key = 'getProductWithParams(' . $id_product . ',' . $id_lang . ')';
     $value = self::loadCache($key);
     if (!$value) {
         $value = array();
         $value['files'] = self::getFiles($id_product);
         if (isset($value['files'][0])) {
             $value['first_file'] =& $value['files'][0];
         } else {
             $value['first_file'] = array('src' => 'no-image', 'ext' => 'jpg');
         }
         $value['categories'] = self::getProductCategories($id_product);
         //zisti main category!!!
         $max_count = 0;
         $main_parent = null;
         foreach ($value['categories'] as $k => $category) {
             $tmp_parents = CategoryModel::getParents($category['id_category'], $id_lang);
             if ($max_count < count($tmp_parents)) {
                 $main_parent = $tmp_parents[key($tmp_parents)];
                 $max_count = count($tmp_parents);
             }
         }
         $value['main_category'] = $main_parent;
         self::saveCache($key, $value);
     }
     $product = array_merge($product, $value);
     //no cache
     $product['params'] = self::getProductParams($id_product, $id_lang, $user);
     $first_key_param = null;
     //		print_r($product);exit;
     //zisti ktora varianta je najviac na sklade, tu budeme uvadzat pri nahlade
     $product['max_stock'] = 0;
     //zisti min_price
     $product['min_price'] = array('original_price' => 0, 'sale_percent' => 0, 'sale' => 0, 'price' => 0, 'tax' => 0, 'user_discount' => 0, 'price_with_tax' => 0, 'tax_price' => 0, 'price_showed' => 0);
     //iba pre parameter connection, ci nie je vsade prazdny
     $show_connection = false;
     foreach ($product['params'] as $k => $r) {
         if ($r['connection'] != '') {
             $show_connection = true;
         }
         if ($first_key_param == null) {
             $first_key_param = $k;
         }
         if (isset($r['stock']) and $r['stock'] > $product['max_stock']) {
             $product['max_stock'] = $r['stock'];
         }
         if ($r['price_array']['price_showed'] < $product['min_price']['price_showed'] or $product['min_price']['price_showed'] == 0) {
             $product['min_price'] =& $r['price_array'];
         }
     }
     $product['show_connection'] = $show_connection;
     if (isset($product['params'][$first_key_param])) {
         $product['first_param'] =& $product['params'][$first_key_param];
     } else {
         $product['first_param'] = null;
     }
     return $product;
 }
开发者ID:oaki,项目名称:demoshop,代码行数:64,代码来源:ProductModel.php


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