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


PHP product::distinct方法代码示例

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


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

示例1: search

 function search()
 {
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $searchKey = $this->input->post('searchKey');
         redirect("tim-kiem/" . urlencode(htmlentities($searchKey)));
     }
     $searchKey = $this->uri->segment(2, "");
     $viewType = $this->uri->segment(3, "all");
     $page = $this->uri->segment(4, "trang-1");
     $limitProduct = 50;
     $limitNews = 10;
     $dis['page'] = $page;
     //$searchKey = urldecode($searchKey);
     $searchKeyEncode = $searchKey;
     $searchKey = html_entity_decode(urldecode($searchKey));
     if ($searchKey == "") {
         $resultStatus = false;
     }
     if ($viewType == "all") {
         $resultStatus = true;
         //find dien thoai & mtb
         $phoneCat = new productcat($this->config->item('catPhoneId'));
         $phoneChildCat = $this->getListId($phoneCat->getAllChildCat());
         $tabletCat = new productcat($this->config->item('catTabletId'));
         $tabletChildCat = $this->getListId($tabletCat->getAllChildCat());
         $phoneTabletCat = array_merge($phoneChildCat, $tabletChildCat);
         $phoneTabletProduct = new product();
         $phoneTabletProduct->distinct();
         $phoneTabletProduct->group_start();
         $phoneTabletProduct->like('name', $searchKey);
         $phoneTabletProduct->or_like('searchKey', $searchKey);
         $phoneTabletProduct->group_end();
         $phoneTabletProduct->where_in_related_productcat('id', $phoneTabletCat);
         $phoneTabletProduct->where('active', 1);
         $phoneTabletProduct->order_by('id', 'desc');
         $phoneTabletProduct->group_by('id');
         $phoneTabletProduct->get_iterated(10);
         $dis['phoneTabletProduct'] = $phoneTabletProduct;
         //find accessory with the searchkey condition
         $accessoryCat = new productcat();
         $accessoryCat->where_in('id', $this->config->item('allAccessoriesId'));
         $accessoryCat->get_iterated();
         $accessoryChildCat = array();
         foreach ($accessoryCat as $row) {
             $accessoryChildCat = array_merge($accessoryChildCat, $this->getListId($row->getAllChildCat()));
         }
         $accessoryProduct = new product();
         $accessoryProduct->distinct();
         $accessoryProduct->group_start();
         $accessoryProduct->like('name', $searchKey);
         $accessoryProduct->or_like('searchKey', $searchKey);
         $accessoryProduct->group_end();
         $accessoryProduct->where_in_related_productcat('id', $accessoryChildCat);
         $accessoryProduct->where('active', 1);
         $accessoryProduct->group_by('id');
         $accessoryProduct->order_by('id', 'desc');
         $accessoryProduct->get_iterated(10);
         $dis['accessoryProduct'] = $accessoryProduct;
         //find the new by keyword
         $newCat = array(58, 59, 60, 61, 62, 64);
         $newsResult = new article();
         $newsResult->where_in('newscatalogue_id', $newCat);
         $newsResult->like('title_vietnamese', $searchKey);
         $newsResult->where('active', 1);
         $newsResult->where('recycle', 0);
         $newsResult->order_by('id', 'desc');
         $newsResult->get_iterated(10);
         $dis['newsResult'] = $newsResult;
         $dis['view'] = 'product/search_all';
     }
     if ($viewType == "dien-thoai-may-tinh-bang") {
         $resultStatus = true;
         //find dien thoai & mtb
         $phoneCat = new productcat($this->config->item('catPhoneId'));
         $phoneChildCat = $this->getListId($phoneCat->getAllChildCat());
         $tabletCat = new productcat($this->config->item('catTabletId'));
         $tabletChildCat = $this->getListId($tabletCat->getAllChildCat());
         $phoneTabletCat = array_merge($phoneChildCat, $tabletChildCat);
         $offset = ($this->getPageNumber($page) - 1) * $limitProduct;
         $phoneTabletProduct = new product();
         $phoneTabletProduct->distinct();
         $phoneTabletProduct->group_start();
         $phoneTabletProduct->like('name', $searchKey);
         $phoneTabletProduct->or_like('searchKey', $searchKey);
         $phoneTabletProduct->group_end();
         $phoneTabletProduct->where_in_related_productcat('id', $phoneTabletCat);
         $phoneTabletProduct->where('active', 1);
         $phoneTabletProduct->order_by('id', 'desc');
         $phoneTabletProduct->group_by('id');
         $phoneTabletProduct->get_paged_iterated($offset, $limitProduct);
         $dis['phoneTabletProduct'] = $phoneTabletProduct;
         $dis['view'] = 'product/search_product';
         $url = "tim-kiem/" . $searchKeyEncode . '/dien-thoai-may-tinh-bang';
         $dis['url'] = $url;
         $config['base_url'] = site_url($url . "/trang-");
         $config['total_rows'] = $phoneTabletProduct->paged->total_rows;
         $config['per_page'] = $limitProduct;
         $config['use_page_numbers'] = TRUE;
         $config['uri_segment'] = 4;
         $config['num_links'] = 3;
//.........这里部分代码省略.........
开发者ID:lxthien,项目名称:batdongsan,代码行数:101,代码来源:fgalleries.php

示例2: getAllProduct

 /**
  * Productscat::getAllProduct()
  * get all the product belong to a category ,direct or indirect).
  * @param mixed $condition
  * @param mixed $offset
  * @param mixed $limit
  * @return
  */
 function getAllProduct($condition = array(), $orderBy = "id", $orderDirection = "desc", $offset = null, $limit = null)
 {
     $listChildCat = $this->getAllChildCat();
     $listIntChildCat = array();
     foreach ($listChildCat as $row) {
         array_push($listIntChildCat, $row->id);
         //     array_push($listNameChildCat,$row->name);
     }
     array_push($listIntChildCat, $this->id);
     //$CI =& get_instance();
     //$CI->firephp->log("child",$listNameChildCat);
     $product = new product();
     $product->where_in_related_productcat('id', $listIntChildCat);
     $product->order_by($orderBy, $orderDirection);
     if (count($condition) > 0) {
         $product->where($condition);
     }
     $product->distinct();
     $product->get_iterated($limit, $offset);
     return $product;
 }
开发者ID:lxthien,项目名称:batdongsan,代码行数:29,代码来源:productcat.php


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