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

class About 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->load->library('user_loginfunctions');
		
		
		$ic=0;
		foreach ($this->cart->contents() as $items):
		$ic++;
		endforeach;
		$this->cart_qty = ''.$ic.'';
		//$this->cart_qty = ''.$this->cart->total_items().'';
		
		
		//$this->cart_qty = ''.$this->cart->total_items().'';
		
		
		
		
		if($this->user_loginfunctions->checkloggedin())
		{
			//redirect('Userpage/vieworders') ;
		}

		
		if($this->session->userdata('shop_user2'))
		{
			$this->load->library('encrypt') ;
			$this->user = $this->encrypt->decode($this->session->userdata('shop_user2'));
			$this->logged = 1;
		}
		
		
		
		
		if($_COOKIE['username_m'] !='' && $_COOKIE['password_m']!='' )
		{	
		if($this->user_loginfunctions->mobile_log($_COOKIE['username_m'],$_COOKIE['password_m']))
		{
			// echo $_COOKIE['username_m'];
			$this->load->library('encrypt') ;
			$this->user = $_COOKIE['username_m'];
			$this->logged = 1;
		}	
		}
		
		
		
		
		
	}
	
	public function index()
	{
	//echo $_COOKIE['user_s']; echo "test";
	//echo $_COOKIE['username_m']; 
	//echo $_COOKIE['password_m']; 
		
		
		$data['result'] = array() ;
		$data['cart_qty'] = $this->cart_qty;
		$data['email'] = $this->user;
		$data['logged'] = $this->logged;
		$data['page'] = 'about' ;
	    $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['site'] = $this->Db_model->get_all('site',array()) ;
		$cart_product = $this->Db_model->get_where_by_order('shop_product',array(),'order','asc') ;
		
		
        $data['contactus'] = $this->Db_model->get_where_by_order('shop_contact',array('status'=>'1'),'id','desc') ;
		$data['about'] = $this->Db_model->get_where_by_order('shop_pages',array('type'=>'about','active'=>'Y'),'title','asc') ;
		
		$data['allproduct']= $this->Db_model->get_where_by_order('shop_product',array('active'=>'Y'),'order','asc') ;
		$data['banner'] = $this->Db_model->get_where_by_order('shop_banner',array('status'=>'1'),'id','desc') ;
		$data['service'] = $this->Db_model->get_where_by_order('shop_pages',array('active'=>'Y','type'=>'service'),'order','asc') ;
		
	$data['details2'] = $this->Db_model->get_where_by_order('shop_pages',array('active'=>'Y','type'=>'Welcome'),'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') ;
		
		
		
		
		if($details!==FALSE)
		{
			$data['details'] = $details ;
		}
		
	
		//$this->load->view('website/base_header');
		//$this->load->view('website/menu',$data);
		//$this->load->view('website/about',$data);
		//$this->load->view('website/right');
		//$this->load->view('website/footer');
		

	$this->load->view('website/header',$data);
	$this->load->view('website/menu',$data);
	//$this->load->view('website/banner',$data);
	$this->load->view('website/about',$data);
	$this->load->view('website/footer');
		
	
	}
	
	

	

}
