Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /proc/self/root/var/www/kanvakanva.com/public_html/application/controllers/ |
Upload File : |
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Product extends Public_Controller { public function __construct() { parent::__construct(); $this->load->model('customer_m'); } public function get($alias = NULL) { if ($alias == NULL) { show_404(); } //check if product exist $this->db->select('*')->from('products')->where('alias', $alias)->where('product_status', 1); $count = $this->db->get()->num_rows(); if ($count == 0) { show_404(); } //get specific product data $this->db->select('*')->from('products')->where('alias', $alias); $data['product'] = $this->db->get()->row(); //get SEO $this->data_header['browser_title'] = 'Product - ' . ucwords($data['product']->title); $this->data_header['meta_description'] = $data['product']->meta_description; $this->data_header['meta_keywords'] = $data['product']->meta_keywords; //get size details $product_id = (int) $data['product']->id_products; $this->db->select('*'); $this->db->from('stocks'); $this->db->join('product_size', 'product_size.id_product_size = stocks.size_id'); $this->db->where('stocks.product_id', $product_id); $this->db->where('stocks.stock !=', 0); $this->db->order_by('stocks.price', 'ASC'); $query = $this->db->get(); $data['size_details'] = $query->result(); //IF CURRENT CATEGORY SESSION EXIST //get category alias from session. This session was created at category.php controller //if session category alias is set.. /* if ($this->session->userdata('current_viewed_category')) { $data['category_alias'] = $this->session->userdata('current_viewed_category'); //get related products with given category alias //get category ID $this->db->select('id_categories')->from('categories')->where('alias', $data['category_alias']); $category_id = $this->db->get()->row(); //get related products (products in the same category) $this->db->select('*'); $this->db->from('products'); $this->db->join('category_product', 'products.id_products = category_product.id_product'); $this->db->where('category_product.id_category', $category_id->id_categories); $this->db->where('products.product_status', '1'); $this->db->limit(4); $data['related_products'] = $this->db->get()->result(); } */ //IF CURRENT BRAND SESSION EXIST //get brand alias from session. This session was created at brand.php controller //if session brand alias is set.. if ($this->session->userdata('current_viewed_brand')) { $data['brand_alias'] = $this->session->userdata('current_viewed_brand'); //get related products with given brand alias //get brand ID $this->db->select('id_brands')->from('brands')->where('alias', $data['brand_alias']); $brand_id = $this->db->get()->row(); //get related products (products in the same brand) $this->db->select('*'); $this->db->from('products'); $this->db->where('brand_id', $brand_id->id_brands); $this->db->where('products.product_status', '1'); $this->db->limit(4); $data['related_products'] = $this->db->get()->result(); } $data['login_status'] = $this->customer_m->loggedin(); $_SESSION['alias'] = $alias; $this->load->view('template/header', $this->data_header); $this->load->view('product', $data); $this->load->view('template/footer', $this->data_footer); } }