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

class Faq 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'] = 'faq' ;
		
		$details = $this->Db_model->get_where_by_order('shop_pages',array('type'=>'faq','active'=>'Y'),'order','asc') ;
		$results = $this->Db_model->get_where_by_order('shop_pages',array('type'=>'faq','active'=>'Y'),'order','asc') ;
		
		$data['contactus'] = $this->Db_model->get_where_by_order('shop_contact',array('status'=>'1'),'id','desc') ;
		$data['category'] = $this->Db_model->get_all_by_order('shop_category','order','asc') ;
		if($details!==FALSE)
		{
			$data['details'] = $details ;
			$data['results'] = $results ;
			
		}
		
	
		$this->load->view('website/base_header');
		$this->load->view('website/header',$data);
		$this->load->view('website/topbar',$data);
		$this->load->view('website/menu',$data);
		$this->load->view('website/faq',$data);
		$this->load->view('website/footer');
	}
	
	public function views($id)
	{
		
		$data['details'] = array();
		$data['cart_qty'] = $this->cart_qty ;
		$data['email'] = $this->user;
		$data['logged'] = $this->logged;
		$data['page'] = 'faq' ;
		
		$details = $this->Db_model->get_where_by_order('shop_pages',array('type'=>'faq','active'=>'Y','aid'=>$id),'order','asc') ;
		$data['results'] = $this->Db_model->get_where_by_order('shop_pages',array('type'=>'faq','active'=>'Y'),'order','asc') ;
		
		$data['contactus'] = $this->Db_model->get_where_by_order('shop_contact',array('status'=>'1'),'id','desc') ;
		$data['category'] = $this->Db_model->get_all_by_order('shop_category','order','asc') ;
		if($details!==FALSE)
		{
			$data['details'] = $details ;
			
			
		}
		
	
		$this->load->view('website/base_header');
		$this->load->view('website/header',$data);
		$this->load->view('website/topbar',$data);
		$this->load->view('website/menu',$data);
		$this->load->view('website/faq',$data);
		$this->load->view('website/footer');
	}
	

	
}
