Exemplo n.º 1
0
 public function products($uri = '', $init = 0)
 {
     $this->load->library('Quest');
     $quest = new Quest();
     $init = round($init);
     if (count($_POST)) {
         $quest->updateFilters($this->input->post(NULL, true));
         if (!AJAX) {
             redirect('productos/' . $quest->generateURI());
         }
     }
     $quest->loadURI($uri);
     if ($quest->filter->cost1 > 0 || $quest->filter->cost2 > 0) {
         if ($quest->filter->cost1 > $quest->filter->cost2) {
             $c1 = $quest->filter->cost1;
             $quest->filter->cost1 = $quest->filter->cost2;
             $quest->filter->cost2 = $c1;
         }
     }
     $this->Data->quest = $quest;
     $this->Data->init = $init;
     $total = $this->Data->SearchCount();
     $this->data['costValues'] = $this->Data->SearchCost();
     if ($quest->filter->cost2 >= round($this->data['costValues']->max) * 0.99) {
         $quest->filter->cost2 = 0;
         $this->Data->quest = $quest;
     }
     $this->data['sectionMenu'] = 'productos';
     $this->data['noChangeURI'] = true;
     $this->data['totalProducts'] = $total;
     $this->data['questURI'] = $quest->generateURI();
     $this->data['search'] = $quest;
     $this->data['productsSearch'] = $this->Data->Search();
     $this->load->driver('cache');
     $this->load->helper('date');
     $this->load->helper('form');
     $this->load->helper('string');
     /*if ( !$bestsellers = $this->cache->file->get('bestsellers'))
       {
         $bestsellers = $this->load->view('products/bestsellers', array('bestsellers' => $this->Data->ProductBestsellers()), true) ;
         $this->cache->file->save('bestsellers', $bestsellers, 300);
       }
       $this->data['bestsellersView'] = $bestsellers;*/
     $this->data['rnd'] = random_string();
     $config['base_url'] = base_url() . "productos/" . ($this->data['questURI'] ? $this->data['questURI'] : "order:1") . "/";
     $config['total_rows'] = $total;
     $config['per_page'] = $this->Data->quest->filter->show;
     $config['uri_segment'] = 3;
     $this->load->library('pagination');
     $this->pagination->initialize($config);
     $this->data['pagination'] = $this->pagination->create_links();
     $this->load->view('products/products', $this->data);
 }