本文整理汇总了PHP中product::order_by方法的典型用法代码示例。如果您正苦于以下问题:PHP product::order_by方法的具体用法?PHP product::order_by怎么用?PHP product::order_by使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类product
的用法示例。
在下文中一共展示了product::order_by方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: priceTable
function priceTable($id = "0")
{
$dis['base_url'] = base_url();
if ($id != "0") {
$id = explode("_", $id);
$id = $id[1];
$manu = new Productmanufacture($id);
$product = new product();
$product->where('productmanufacture_id', $id);
$product->where('status', enum::PRODUCT_AVAILABLE);
$product->order_by('name', 'asc');
$product->get_iterated();
$dis['product'] = $product;
$this->load->view('front/product/ajaxPriceTable', $dis);
} else {
//manufacture
$manu = new Productmanufacture();
$manu->where('isShow', 1);
$manu->get_iterated();
$dis['manu'] = $manu;
$dis['view'] = 'product/priceTable';
$this->viewfront($dis);
}
}
示例3: search
function search()
{
$viewMode = $this->uri->segment(2, "") == "" ? "ma-tran" : $this->uri->segment(2);
$orderBy = $this->uri->segment(3, "") == "" ? "moi-nhat" : $this->uri->segment(3);
$page = $this->uri->segment(4, "") == "" ? "trang-1" : $this->uri->segment(4);
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$searchKey = $this->input->post('searchKey');
$this->session->set_userdata('searchKey', $searchKey);
}
$searchKey = $this->session->userdata('searchkey');
$limit = $viewMode == "ma-tran" ? 15 : 10;
$offset = ($this->getPageNumber($page) - 1) * $limit;
$product = new Product();
if (trim($searchKey) != "") {
$product->like('name', $searchKey);
}
$product->where('active', 1);
$product->order_by($this->getOrderBy($orderBy), $this->getOrderDirection($orderBy));
$product->get_paged_iterated();
$dis['product'] = $product;
$dis['pageUrl'] = "tim-kiem";
$config['base_url'] = site_url($url . "/" . $viewMode . "/" . $orderBy . "/trang-");
$config['total_rows'] = $product->paged->total_rows;
$config['per_page'] = $limit;
$config['use_page_numbers'] = TRUE;
$config['uri_segment'] = 4;
$config['num_links'] = 3;
$config['full_tag_open'] = '<span class="pagin">';
$config['full_tag_close'] = "</span>";
$config['first_link'] = FALSE;
$config['first_tag_open'] = '';
$config['first_tag_close'] = '';
$config['last_link'] = FALSE;
$config['last_tag_open'] = '';
$config['last_tag_close'] = '';
$config['next_link'] = '<img src="' . base_url() . 'images/pagination_next.png" />';
$config['next_tag_open'] = '';
$config['next_tag_close'] = '';
$config['prev_link'] = '<img src="' . base_url() . 'images/pagination_pre.png" /';
$config['prev_tag_open'] = '';
$config['prev_tag_close'] = '';
$config['num_tag_open'] = '';
$config['num_tag_close'] = '';
$config['cur_tag_open'] = '<span class="active">';
$config['cur_tag_close'] = '</span>';
$this->pagination->initialize($config);
if ($viewMode == 'ma-tran') {
$dis['view'] = 'product/product_grid';
} else {
$dis['view'] = 'product/product_list';
}
$productSaleOff = new product();
$productSaleOff->where('active', 1);
$productSaleOff->where('isSale', 1);
$productSaleOff->order_by('id', 'desc');
$productSaleOff->get_iterated(15);
$dis['productSaleOff'] = $productSaleOff;
$dis['base_url'] = base_url();
$this->viewfront($dis);
}