예제 #1
0
		$table_search->data[0][2] = user_print_autocomplete_input($params_assigned);
		
		//Contract
		$contracts = get_contracts ();
		if(!isset($params['id_contract'])){
			$params['id_contract'] = '';	
		}
		$table_search->data[1][0] = print_select ($contracts, 'id_contract', $params['id_contract'],
			'', __('None'), 0, true, false, false, __('Contract'), '', '');

		//Manufacturer
		if(!isset($params['id_manufacturer'])){
			$params['id_manufacturer'] = '';
		}
		$manufacturers = get_manufacturers ();
		$table_search->data[1][1] = print_select ($manufacturers, 'id_manufacturer',
		$params['id_manufacturer'], '', __('None'), 0, true, false, false, __('Manufacturer'), '','');

		//User Assoc
		if(!isset($params['associated_user'])){
			$params['associated_user'] = '';
		}
		$params_associated['input_id'] = 'text-associated_user';
		$params_associated['input_name'] = 'associated_user';
		$params_associated['input_value'] = $params['associated_user'];
		$params_associated['title'] = __('Associated user');
		$params_associated['return'] = true;
	
		$table_search->data[1][2] = user_print_autocomplete_input($params_associated);
		
예제 #2
0
 /**
  * Default Function
  *
  * @access public
  * @param string
  */
 public function index()
 {
     //get function arguments
     $arguments = func_get_args();
     //connect arguments to cpath
     $cpath = $this->parse_cpath();
     //if has arguments
     if ($cpath != NULL) {
         //compile cpath from friendly url
         $cpath = $this->category_tree->parse_cpath($cpath);
         //page title
         $this->set_page_title(sprintf(lang('index_heading'), config('STORE_NAME')));
         //check whether cpath is exist
         if (isset($cpath) && !empty($cpath)) {
             //get current category id
             $categories = explode('_', $cpath);
             $current_category_id = end($categories);
             //set global variable
             $this->registry->set('cpath', $cpath);
             $this->registry->set('current_category_id', $current_category_id);
             //model
             $this->load->model('categories_model');
             $this->load->model('products_model');
             $this->load->model('manufacturers_model');
             //breadcrumb
             $categories = $this->category_tree->get_full_cpath_info($cpath);
             foreach ($categories as $categories_id => $categories_name) {
                 $this->template->set_breadcrumb($categories_name, site_url('cpath/' . $categories_id));
             }
             //load the category object
             $this->load->library('category', $current_category_id);
             //set page title
             $data['title'] = $this->category->get_title();
             $this->set_page_title($this->category->get_title());
             //set page keywords
             $meta_keywords = $this->category->get_meta_keywords();
             if (!empty($meta_keywords)) {
                 $this->template->add_meta_tags('keywords', $meta_keywords);
             }
             //set meta description
             $meta_description = $this->category->get_meta_description();
             if (!empty($meta_description)) {
                 $this->template->add_meta_tags('description', $meta_description);
             }
             //set category data
             $data['category'] = $this->category_tree->get_data($current_category_id);
             //get sub categories
             $data['sub_categories'] = get_sub_categories();
             //get manufacturers
             $data['manufacturers'] = get_manufacturers();
             //check whether this category has products
             if ($this->categories_model->has_products($current_category_id)) {
                 $pagesize = $this->input->get('pagesize');
                 $sort = $this->input->get('sort');
                 $view = $this->input->get('view');
                 //get page
                 $filter = array('categories_id' => $current_category_id, 'page' => $this->page_num - 1, 'per_page' => $pagesize !== NULL ? $pagesize : config('MAX_DISPLAY_SEARCH_RESULTS'), 'sort' => $sort);
                 $products = $this->products_model->get_products($filter);
                 //initialize pagination parameters
                 $pagination = $this->get_pagination_config($cpath, $filter);
                 //load pagination library
                 $this->load->library('pagination', $pagination);
                 $this->pagination->initialize($pagination);
                 $data['links'] = $this->pagination->create_links();
                 $data['total_pages'] = sprintf(lang('result_set_number_of_products'), $filter['page'] * $filter['per_page'] + 1, $filter['page'] * $filter['per_page'] + sizeof($products), $pagination['total_rows']);
                 $data['products'] = array();
                 foreach ($products as $product) {
                     $data['products'][] = array('products_id' => $product['products_id'], 'product_name' => $product['products_name'], 'product_price' => $product['products_price'], 'specials_price' => $product['specials_price'], 'tax_class_id' => $product['products_tax_class_id'], 'is_specials' => $product['specials_price'] === NULL ? FALSE : TRUE, 'is_featured' => $product['featured_products_id'] === NULL ? FALSE : TRUE, 'product_image' => $product['image'], 'short_description' => $product['products_short_description']);
                 }
                 $data['has_products'] = true;
                 $data['pagesize'] = $pagesize;
                 $data['sort'] = $sort;
                 $data['view'] = empty($view) && !in_array($view, array('grid', 'list')) ? 'grid' : $view;
                 $data['filter_form_action'] = site_url('cpath/' . $cpath) . '/page';
             } else {
                 $data['has_products'] = false;
             }
             $this->template->build('index/product_listing', $data);
         }
     } else {
         redirect('index');
     }
 }