<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Detailproduk extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model("model_app");
        $this->load->helper('ongkir');
        $this->load->model('news_model');
        $this->load->model('toko_model');
    }
    
    private $view = "frontend/shop";

    public function produk() {
        $id = $this->uri->segment(3);
        $featuredproduct = "select * from product where featured='Yes' order by RAND() limit 4";
        $product = "select a.*, b.kategori_utama from product a left join kategori_utama b on a.category_id=b.id where a.id=$id";
        $productImage = "select * from product_image where product_id=$id";
        $tagproduct = "select a.*, b.name from tag_product a left join product_category b on a.kategori_id=b.id where a.product_id=$id";
        $getPP = $this->db->query($product)->result();
        foreach($getPP as $gp){
            $title = $gp->product_name;
            $desc = $gp->description;
        }
        $data = array(
            'home' => "",
            "title" => $title,
            'meta_desc' => $desc,
            'met_key' => $desc,
            'produk' => $this->db->query($product)->result(),
            'produkImage' => $this->db->query($productImage)->result(),
            'kategori' => $this->model_app->getAllData('product_category')->result(),
            'feature' => $this->db->query($featuredproduct)->result(),
            'tagproduk' => $this->db->query($tagproduct)->result(),
        );
        
        renderFront("$this->view/detailproduk", $data);
    }

}

/* End of file detailProduk.php */
/* Location: ./application/controllers/detailProduk.php */