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

class Pages extends CI_Controller {


	private $cart_qty   = '' ;
	private $logged 	= 0  ;	
	private $user 		= '' ;
	
	public function __construct()
	{
		parent::__construct();
		
		$this->load->model('Db_model');
		
		$this->load->library('cart');
		
		$this->load->helper('basic_helper');
		
		$this->cart_qty = ''.$this->cart->total_items().'';
		
		if($this->session->userdata('shop_user2'))
		{
			$this->load->library('encrypt') ;
			$this->user = $this->encrypt->decode($this->session->userdata('shop_user2'));
			$this->logged = 1;
		}
		
	}
	
	public function index()
	{
		$this->view() ;
	}
	
	public function view()
	{
		
		$data['details'] = array();
		$data['cart_qty'] = $this->cart_qty ;
		$data['email'] = $this->user;
		$data['logged'] = $this->logged;
		$data['page'] = 'service' ;
		
				
		$data['result'] = $this->Db_model->get_where_by_order('shop_category',array(),'order','asc') ;	
		$data['gift'] = $this->Db_model->get_where_by_order('shop_category',array(),'order','asc') ;
        $data['subcat']= $this->Db_model->get_where_by_order('shop_subcategory',array(),'id','asc') ;
        $cart_product = $this->Db_model->get_where_by_order('shop_product',array(),'order','asc') ;
		$data['site'] = $this->Db_model->get_all('site',array()) ;
		$data['contactus'] = $this->Db_model->get_where_by_order('shop_contact',array('status'=>'1'),'id','desc') ;
		$data['banner'] = $this->Db_model->get_where_by_order('shop_banner',array('status'=>'1'),'id','desc') ;
        $data['details2'] = $this->Db_model->get_where_by_order('shop_pages',array('active'=>'Y','type'=>'Welcome'),'order','asc') ; 
        $data['allproduct']= $this->Db_model->get_where_by_order('shop_product',array('active'=>'Y'),'order','asc') ;
		$product = $this->Db_model->get_where_by_order('shop_product',array('active'=>'Y','featured'=>1),'order','asc') ;
		if($product!==FALSE)
		{
			$data['product'] = $product;
		}
		
		
		$details = $this->Db_model->get_where_by_order('shop_pages',array('active'=>'Y','type'=>'about'),'order','asc') ;
		$data['service'] = $this->Db_model->get_where_by_order('shop_pages',array('active'=>'Y','type'=>'service'),'order','asc') ;
		
		
		
		
		if($details!==FALSE){$data['details'] = $details ;}
		
		
		
	$this->load->view('website/header',$data);
	$this->load->view('website/menu',$data);
	//$this->load->view('website/banner',$data);
	$this->load->view('website/services',$data);
	$this->load->view('website/footer',$data);

	}
	
	public function views($id)
	{
		
		$data['details'] = array();
		$data['cart_qty'] = $this->cart_qty ;
		$data['email'] = $this->user;
		$data['logged'] = $this->logged;
		$data['page'] = 'service' ;
		
				
		$data['result'] = $this->Db_model->get_where_by_order('shop_category',array(),'order','asc') ;	
		$data['gift'] = $this->Db_model->get_where_by_order('shop_category',array(),'order','asc') ;
        $data['subcat']= $this->Db_model->get_where_by_order('shop_subcategory',array(),'id','asc') ;
        $cart_product = $this->Db_model->get_where_by_order('shop_product',array(),'order','asc') ;
		$data['site'] = $this->Db_model->get_all('site',array()) ;
		$data['contactus'] = $this->Db_model->get_where_by_order('shop_contact',array('status'=>'1'),'id','desc') ;
		$data['banner'] = $this->Db_model->get_where_by_order('shop_banner',array('status'=>'1'),'id','desc') ;
        $data['details2'] = $this->Db_model->get_where_by_order('shop_pages',array('active'=>'Y','type'=>'Welcome'),'order','asc') ; 
        $data['allproduct']= $this->Db_model->get_where_by_order('shop_product',array('active'=>'Y'),'order','asc') ;
		$product = $this->Db_model->get_where_by_order('shop_product',array('active'=>'Y','featured'=>1),'order','asc') ;
		if($product!==FALSE)
		{
			$data['product'] = $product;
		}
		
		
		$details = $this->Db_model->get_where_by_order('shop_pages',array('active'=>'Y','type'=>'about'),'order','asc') ;
		$data['services'] = $this->Db_model->get_where_by_order('shop_pages',array('active'=>'Y','type'=>'service','aid'=>$id),'order','asc') ;
		$data['service'] = $this->Db_model->get_where_by_order('shop_pages',array('active'=>'Y','type'=>'service'),'order','asc') ;
		
		
		
		if($details!==FALSE){$data['details'] = $details ;}
		
		
		
	$this->load->view('website/header',$data);
	$this->load->view('website/menu',$data);
	//$this->load->view('website/banner',$data);
	$this->load->view('website/services',$data);
	$this->load->view('website/footer',$data);

	}
	

	
}
