function count_static_by_price($url_type, $url_district, $url_price) { $CI =& get_instance(); $estates = new Estate(); $estates->where_related_estatetype('name_none', $url_type); $estates->where_related_estatedistrict('name_none', $url_district); $estates->where_related_estateprice('url', $url_price); $estates->get(); return $estates->result_count(); }
function staticByPrices() { $url_type = $this->uri->segment(2); $cat_type = new Estatetype(); $cat_type->where('name_none', $url_type)->get(); $dis['cat_type'] = $cat_type; $url_district = $this->uri->segment(3); $cat_districts = new Estatedistrict(); $cat_districts->where('name_none', $url_district)->get(); $dis['cat_districts'] = $cat_districts; $url_price = $this->uri->segment(4); $cat_price = new Estateprice(); $cat_price->where('url', $url_price)->get(); $dis['cat_price'] = $cat_price; $level = 4; $page = $this->uri->segment($level + 1, "") == "" ? 1 : $this->uri->segment($level + 1); $dis['page'] = $page; $limit = 20; $offset = ($page - 1) * $limit; /*get page estate*/ $estates = new Estate(); $estates->order_by('isVip', 'desc'); $estates->order_by('created', 'desc'); $estates->where_related_estatetype('name_none', $url_type); $estates->where_related_estatedistrict('name_none', $url_district); $estates->where_related_estateprice('url', $url_price); $estates->get_paged($offset, $limit, TRUE); $dis['estates'] = $estates; /*get all estate*/ $estates = new Estate(); $estates->order_by('isVip', 'desc'); $estates->order_by('created', 'desc'); $estates->where_related_estatetype('name_none', $url_type); $estates->where_related_estatedistrict('name_none', $url_district); $estates->where_related_estateprice('url', $url_price); $estates->get(); $total = $estates->result_count(); /*Begin pagination for product*/ $url = 'thong-ke-theo-muc-gia/' . $url_type . '/' . $url_district . '/' . $url_price; $config['base_url'] = site_url($url); $config['total_rows'] = $total; $config['per_page'] = $limit; $config['use_page_numbers'] = TRUE; $config['uri_segment'] = 5; $config['num_links'] = 5; $config['full_tag_open'] = '<div class="news-pagination">'; $config['full_tag_close'] = "</div>"; $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'] = '>'; $config['next_tag_open'] = ''; $config['next_tag_close'] = ''; $config['prev_link'] = '<'; $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); /*End pagination for product*/ $this->page_title = $cat_type->name . ' tại ' . $cat_districts->name . ' giá từ ' . $cat_price->label . ' | ' . $cat_type->name . ' tại ' . $cat_districts->name; $this->page_description = $cat_type->name . ' tại ' . $cat_districts->name . ' giá từ ' . $cat_price->label . ' với đầy đủ hình ảnh, hướng, vị trí khác nhau... để bạn lựa chọn. ' . 'Thông tin ' . $cat_type->name . ' tại ' . $cat_districts->name . ' cập nhật nhất!'; $dis['base_url'] = base_url(); $dis['view'] = 'front/estates/by-prices'; $this->viewfront($dis); }