Esempio n. 1
0
 public function index()
 {
     $data = array();
     $details = explode('-', $this->uri->segment($this->uri->total_segments()));
     $id = array_pop($details);
     if (!preg_match("/\\d/", $id)) {
         show_error('Product not found!');
     }
     // Get product
     $res = $this->product->get_by_id($id);
     if (!$res) {
         show_error('Product not found!');
     }
     $data = product_conversion($res, true);
     $data = $data[0];
     $this->load->view($this->config->item('frontend_folder') . 'main', array('page' => 'view', 'product' => $data, 'menu' => $this->menu->get()));
 }
Esempio n. 2
0
 public function viewProducts($current_category = NULL)
 {
     if (!$current_category) {
         show_404();
     }
     $data = array();
     // Get ID first
     $res = $this->category->get_by_url($current_category);
     if (!$res || !isset($res[0]['id'])) {
         show_404();
     }
     // Check if category has children, then need to also get children's products
     $this->getChildren($res[0]['id']);
     if ($this->childs) {
         $current_category = array_unique($this->childs);
     }
     $this->load->library('producttpl');
     $this->load->view($this->config->item('frontend_folder') . 'main', array('page' => 'product', 'menu' => $this->menu->get(), 'products_tpl' => $this->producttpl->generate(product_conversion($this->product->get_by_category($current_category)))));
 }
Esempio n. 3
0
 public function index()
 {
     $this->load->view($this->config->item('frontend_folder') . 'main', array('page' => 'home', 'menu' => $this->menu->get(), 'latest_tpl' => $this->producttpl->generate(product_conversion($this->product->get_latest())), 'offers_tpl' => $this->producttpl->generate(product_conversion($this->product->get_offers()))));
 }