<?php
error_reporting(0);
defined('BASEPATH') OR exit('No direct script access allowed');

class Product extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see https://codeigniter.com/user_guide/general/urls.html
	 */
	 
	  function __construct() {
parent::__construct();
  $this->load->helper("url");
  $this->load->library("pagination");
   $this->load->library('session');
 
}
public function index()
	{      
     $this->load->library('table');
     
     $this->load->helper('form');
    
     $this->load->database();
	 
	if(isset($this->session->userdata['logged_in']))
						 {
							 $session_id=$this->session->userdata['logged_in']['email'];
						 }
						 else
						 {
							 $session_id =session_id();	 
							 
						 }	 
	 
	 
	 
     $num_rows=$this->db->count_all("product");
 $config = array();
        $config["base_url"] = base_url() . "/product/index";
        $config["total_rows"] = $num_rows;
        $config["per_page"] = 8;

        $config["uri_segment"] = 3;
		$config['cur_tag_open'] = '&nbsp;<a class="current">';
$config['cur_tag_close'] = '</a>';
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
        $this->pagination->initialize($config);
        $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
        //$data["allproduct"] = $this->product_details->allproduct_details($config["per_page"], $page);
       $data['products']=$this->db->get('product', $config['per_page'],$page);
//echo $this->db->last_query(); die;
		
		$str_links = $this->pagination->create_links();
		$data["links"] = explode('&nbsp;',$str_links );
		 $data['hproduct']=$this->contact->get_product_sheader();
		 $data['msg']="";
		 $data['cat']=$this->db->get('product_category');
		 $data['min']="";
		 $data['max']="";
		 $data['check']=array();
		 $data['count_cart']=$this->contact->count_cart($session_id);
		 $data['count_wishlist']=$this->contact->count_wishlist($session_id);
		 $data['all_category_gp_3']=$this->contact->all_category_gp_3();
		 $data['rotatingtext']=$this->homeDetails->getspecialofferAll();
		 $this->load->view('layout/header',$data);
		$this->load->view('product/clay_product',$data);
		$this->load->view('layout/footer');
	  
	  
	}
	
 function category($min,$max,$cat)
	{   
	
	
	if(isset($this->session->userdata['logged_in']))
						 {
							 $session_id=$this->session->userdata['logged_in']['email'];
						 }
						 else
						 {
							 $session_id =session_id();	 
							 
						 }	



	
     $this->load->library('table');
     
     $this->load->helper('form');
    $url = urldecode($cat);
     $this->load->database();
	 if($min == 0 && $max == 0)
	 {
		  $this->db->where('category',$url);
	
	 }
	 else
	 {
	 $this->db->where('category',$url);
	  $this->db->where('price >=', $min);
   $this->db->where('price <=', $max);
	 }
$num_rows=$this->db->count_all_results("product");

 $config = array();
        $config["base_url"] = base_url() . "/product/morning_elixir".$min."/".$max."/".$cat."";
        $config["total_rows"] = $num_rows;
        $config["per_page"] = 4;

        $config["uri_segment"] =5 ;
		$config['cur_tag_open'] = '&nbsp;<a class="current">';
$config['cur_tag_close'] = '</a>';
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
        $this->pagination->initialize($config);
        $page = ($this->uri->segment(5)) ? $this->uri->segment(5) : 0;
        //$data["allproduct"] = $this->product_details->allproduct_details($config["per_page"], $page);
     if($min == 0 && $max == 0)
	 {
		  $this->db->where('category',$url);
	
	 }
	 else
	 {
	 $this->db->where('category',$url);
	  $this->db->where('price >=', $min);
   $this->db->where('price <=', $max);
	 }
	   $data['products']=$this->db->get('product', $config['per_page'],$page);
//echo $this->db->last_query(); die;
		
		$str_links = $this->pagination->create_links();
		$data["links"] = explode('&nbsp;',$str_links );
		$data['msg']="";
			 $data['min']=$min;
		 $data['max']=$max;
		$data['cat']=$this->db->get('product_category');
		 $data['hproduct']=$this->contact->get_product_sheader();
		 $data['count_cart']=$this->contact->count_cart($session_id);
		 $data['count_wishlist']=$this->contact->count_wishlist($session_id);
		 $data['all_category_gp_3']=$this->contact->all_category_gp_3();
		 $data['rotatingtext']=$this->homeDetails->getspecialofferAll();
		$this->load->view('layout/header',$data);
		$this->load->view('product/clay_product',$data);
		$this->load->view('layout/footer');
	 
	  
	}
	
	
	function product_bycategory($cat)
	{     
	if(isset($this->session->userdata['logged_in']))
						 {
							 $session_id=$this->session->userdata['logged_in']['email'];
						 }
						 else
						 {
							 $session_id =session_id();	 
							 
						 }	
	
	
$url = urldecode($cat);
	
     $this->load->library('table');
     
     $this->load->helper('form');
    
     $this->load->database();
	 $this->db->where('category',$cat);
     $num_rows=$this->db->count_all("product");
 $config = array();
        $config["base_url"] = base_url() . "/product/product_bycategory/".$url."";
        $config["total_rows"] = $num_rows;
        $config["per_page"] = 8;

        $config["uri_segment"] = 4;
		$config['cur_tag_open'] = '&nbsp;<a class="current">';
$config['cur_tag_close'] = '</a>';
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
        $this->pagination->initialize($config);
        $page = ($this->uri->segment(4)) ? $this->uri->segment(4) : 0;
        //$data["allproduct"] = $this->product_details->allproduct_details($config["per_page"], $page);
        	 $this->db->where('category',$url);
	   $data['products']=$this->db->get('product', $config['per_page'],$page);
//echo $this->db->last_query(); die;
		
		$str_links = $this->pagination->create_links();
		$data["links"] = explode('&nbsp;',$str_links );
		$data['msg']="";
		 $data['hproduct']=$this->contact->get_product_sheader();
		 $data['cat']=$this->db->get('product_category');
		 $data['count_cart']=$this->contact->count_cart($session_id);
		 $data['count_wishlist']=$this->contact->count_wishlist($session_id);
		 $data['all_category_gp_3']=$this->contact->all_category_gp_3();
		 $data['rotatingtext']=$this->homeDetails->getspecialofferAll();
		$this->load->view('layout/header',$data);
		$this->load->view('product/clay_product',$data);
		$this->load->view('layout/footer');
	  
	  
	}
	
	
	function fruit_juice()
	{ 


if(isset($this->session->userdata['logged_in']))
						 {
							 $session_id=$this->session->userdata['logged_in']['email'];
						 }
						 else
						 {
							 $session_id =session_id();	 
							 
						 }	
						 
     $this->load->library('table');
     
     $this->load->helper('form');
    
     $this->load->database();
	 $this->db->where('category','Fruit Juice');
     $num_rows=$this->db->count_all("product");
 $config = array();
        $config["base_url"] = base_url() . "/product/fruit_juice";
        $config["total_rows"] = $num_rows;
        $config["per_page"] = 4;

        $config["uri_segment"] = 3;
		$config['cur_tag_open'] = '&nbsp;<a class="current">';
$config['cur_tag_close'] = '</a>';
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
        $this->pagination->initialize($config);
        $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
        //$data["allproduct"] = $this->product_details->allproduct_details($config["per_page"], $page);
       $this->db->where('category','Fruit Juice');
	   $data['products']=$this->db->get('product', $config['per_page'],$page);
//echo $this->db->last_query(); die;
		
		$str_links = $this->pagination->create_links();
		$data["links"] = explode('&nbsp;',$str_links );
		 $data['hproduct']=$this->contact->get_product_sheader();
		 $data['count_cart']=$this->contact->count_cart($session_id);
		 $data['count_wishlist']=$this->contact->count_wishlist($session_id);
		 $data['all_category_gp_3']=$this->contact->all_category_gp_3();
		 $data['rotatingtext']=$this->homeDetails->getspecialofferAll();
		 $data['msg']="";
		$this->load->view('layout/header',$data);
		$this->load->view('product/clay_product',$data);
		$this->load->view('layout/footer');
	  
	  
	}
	
	
		


function AZ()
	{    


if(isset($this->session->userdata['logged_in']))
						 {
							 $session_id=$this->session->userdata['logged_in']['email'];
						 }
						 else
						 {
							 $session_id =session_id();	 
							 
						 }		
      $this->load->library('table');
     
      $this->load->helper('form');
    
     $this->load->database();
    $this->db->order_by("name", "asc");
     $num_rows=$this->db->count_all("product");
 $config = array();
        $config["base_url"] = base_url() . "/product/AZ";
        $config["total_rows"] = $num_rows;
        $config["per_page"] = 4;

        $config["uri_segment"] = 3;
		$config['cur_tag_open'] = '&nbsp;<a class="current">';
$config['cur_tag_close'] = '</a>';
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
        $this->pagination->initialize($config);
        $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
        //$data["allproduct"] = $this->product_details->allproduct_details($config["per_page"], $page);
      $this->db->order_by("name", "asc");
	   $data['products']=$this->db->get('product', $config['per_page'],$page);
//echo $this->db->last_query(); die;
		
		$str_links = $this->pagination->create_links();
		$data["links"] = explode('&nbsp;',$str_links );
		$data['msg']="Result for A To Z";
		$data['cat']=$this->db->get('product_category');
		 $data['hproduct']=$this->contact->get_product_sheader();
		 $data['count_cart']=$this->contact->count_cart($session_id);
		 $data['count_wishlist']=$this->contact->count_wishlist($session_id);
		 $data['all_category_gp_3']=$this->contact->all_category_gp_3();
		 $data['rotatingtext']=$this->homeDetails->getspecialofferAll();
		$this->load->view('layout/header',$data);
		$this->load->view('product/clay_product',$data);
		$this->load->view('layout/footer');
	  
	  
	}

	
	function ZA()
	{      
	if(isset($this->session->userdata['logged_in']))
						 {
							 $session_id=$this->session->userdata['logged_in']['email'];
						 }
						 else
						 {
							 $session_id =session_id();	 
							 
						 }	
	
	
      $this->load->library('table');
     
      $this->load->helper('form');
    
     $this->load->database();
    $this->db->order_by("name", "desc");
     $num_rows=$this->db->count_all("product");
 $config = array();
        $config["base_url"] = base_url() . "/product/ZA";
        $config["total_rows"] = $num_rows;
        $config["per_page"] = 4;

        $config["uri_segment"] = 3;
		$config['cur_tag_open'] = '&nbsp;<a class="current">';
$config['cur_tag_close'] = '</a>';
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
        $this->pagination->initialize($config);
        $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
      $this->db->order_by("name", "desc");
	   $data['products']=$this->db->get('product', $config['per_page'],$page);		$str_links = $this->pagination->create_links();
		$data["links"] = explode('&nbsp;',$str_links );
		$data['msg']="Result for Z To A";
		$data['cat']=$this->db->get('product_category');
		 $data['hproduct']=$this->contact->get_product_sheader();
		 $data['count_cart']=$this->contact->count_cart($session_id);
		 $data['count_wishlist']=$this->contact->count_wishlist($session_id);
		 $data['all_category_gp_3']=$this->contact->all_category_gp_3();
		 $data['rotatingtext']=$this->homeDetails->getspecialofferAll();
		$this->load->view('layout/header',$data);
		$this->load->view('product/clay_product',$data);
		$this->load->view('layout/footer');
	  
	  
	}
	
	
	
function high_low()
	{    


	if(isset($this->session->userdata['logged_in']))
						 {
							 $session_id=$this->session->userdata['logged_in']['email'];
						 }
						 else
						 {
							 $session_id =session_id();	 
							 
						 }	

	
      $this->load->library('table');
     
      $this->load->helper('form');
    
     $this->load->database();
    $this->db->order_by("price", "desc");
     $num_rows=$this->db->count_all("product");
 $config = array();
        $config["base_url"] = base_url() . "/product/high_low";
        $config["total_rows"] = $num_rows;
        $config["per_page"] = 4;

        $config["uri_segment"] = 3;
		$config['cur_tag_open'] = '&nbsp;<a class="current">';
$config['cur_tag_close'] = '</a>';
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
        $this->pagination->initialize($config);
        $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
      $this->db->order_by("price", "desc");
	   $data['products']=$this->db->get('product', $config['per_page'],$page);		$str_links = $this->pagination->create_links();
		$data["links"] = explode('&nbsp;',$str_links );
		$data['msg']="Result for price High to Low";
		$data['cat']=$this->db->get('product_category');
		 $data['hproduct']=$this->contact->get_product_sheader();
		 $data['count_cart']=$this->contact->count_cart($session_id);
		 $data['count_wishlist']=$this->contact->count_wishlist($session_id);
		 $data['all_category_gp_3']=$this->contact->all_category_gp_3();
		 $data['rotatingtext']=$this->homeDetails->getspecialofferAll();
		$this->load->view('layout/header',$data);
		$this->load->view('product/clay_product',$data);
		$this->load->view('layout/footer');
	  
	  
	}
	function low_high()
	{ 

if(isset($this->session->userdata['logged_in']))
						 {
							 $session_id=$this->session->userdata['logged_in']['email'];
						 }
						 else
						 {
							 $session_id =session_id();	 
							 
						 }	

	
      $this->load->library('table');
     
      $this->load->helper('form');
    
     $this->load->database();
    $this->db->order_by("price", "asc");
     $num_rows=$this->db->count_all("product");
 $config = array();
        $config["base_url"] = base_url() . "/product/low_high";
        $config["total_rows"] = $num_rows;
        $config["per_page"] = 4;

        $config["uri_segment"] = 3;
		$config['cur_tag_open'] = '&nbsp;<a class="current">';
$config['cur_tag_close'] = '</a>';
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
        $this->pagination->initialize($config);
        $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
      $this->db->order_by("price", "asc");
	   $data['products']=$this->db->get('product', $config['per_page'],$page);	
  $this->db->last_query();
  $data['msg']="Result for price Low to High";
	   $str_links = $this->pagination->create_links();
		$data["links"] = explode('&nbsp;',$str_links );
		$data['cat']=$this->db->get('product_category');
		 $data['hproduct']=$this->contact->get_product_sheader();
		 $data['count_cart']=$this->contact->count_cart($session_id);
		 $data['count_wishlist']=$this->contact->count_wishlist($session_id);
		 $data['all_category_gp_3']=$this->contact->all_category_gp_3();
		 $data['rotatingtext']=$this->homeDetails->getspecialofferAll();
		$this->load->view('layout/header',$data);
		$this->load->view('product/clay_product',$data);
		$this->load->view('layout/footer');
	  
	  
	}
	
	
		function category_details_json($id,$id1)
    {
		
		echo $id;
		echo $id1;
       /*  $this->db->where('price >=', $id);
        $this->db->where('price <=', $id1);
		 $num_rows=$this->db->count_all_results("product");
		$dataArr=$this->db->get('product');
       

        //echo $data;
        $data = array();
        for($i=0; $i<$num_rows; $i++)
        {
            array_push($data,array_shift($dataArr));
        }
        
        header('Content-Type: application/json');
        echo json_encode($data);
		*/
		
		
	} 
	
	
	
	function filter_price()
	{ 

	if(isset($this->session->userdata['logged_in']))
						 {
							 $session_id=$this->session->userdata['logged_in']['email'];
						 }
						 else
						 {
							 $session_id =session_id();	 
							 
						 }	
	
	
	$min1="";
$max1="";
$category="";	
  $min1=$this->input->post('SortTags1');
	 $max1=$this->input->post('SortTags2');
	$category=$this->input->post('cechk');
	
	$this->load->library('table');
     
      $this->load->helper('form');
    
     $this->load->database();
	 
	 
	 if($this->input->post('SortTags1') == "" && $this->input->post('SortTags2') == "" && $this->input->post('cechk') == "")
	{
		
		
		$min1=$this->session->userdata['filter_values']['min'];
	 $max1=$this->session->userdata['filter_values']['max'];
	 $category=$this->session->userdata['filter_values']['cat'];   
	 
	}
	
	else
	{
		$sess_array = array(
			 'min' => $min1,
			 'max' => $max1,
			 'cat' => $category
		   );
		   $this->session->set_userdata('filter_values', $sess_array);
		
	}

	 //where condition for category
	$arraycount=count($category);
	$chechcat=$arraycount -1;
	$i=1;
	$where='';
	$new_cat=array();
	if(!empty($category))
	{
		foreach($category as $key=>$val)
		{
			$where .="category = '".$val."'";
			if($i<=$chechcat)
			$where .=" or ";
			$i++;
			$new_cat[]=urlencode($val);
		
		}
	}	
	
$cat1=implode(',',$new_cat);
		if($arraycount !=0)
		{
		$this->db->where('('.$where.')');
		}
		if($min1 != "min" && $max1 != "700+")
		{
		
		$this->db->where('price >=', $min1);
		$this->db->where('price <=', $max1);
		}
		$num_rows=$this->db->count_all_results("product");
		//$this->db->last_query();
		$config = array();
        //$config["base_url"] = base_url()."/product/filter_price/".$min1."/".$max1."/".$cat1."";
		$config["base_url"] = base_url()."/product/filter_price";
        $config["total_rows"] = $num_rows;
        $config["per_page"] = 8;

        $config["uri_segment"] = 3;
		$config['cur_tag_open'] = '&nbsp;<a class="current">';
        $config['cur_tag_close'] = '</a>';
        $config['next_link'] = 'Next';
        $config['prev_link'] = 'Previous';
        $this->pagination->initialize($config);
	
        $offset = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
	
		if($arraycount !=0)
		{
		$this->db->where('('.$where.')');
		}
		if($min1 != "min" && $max1 != "700+")
		{
		
		$this->db->where('price >=', $min1);
		$this->db->where('price <=', $max1);
		}
	   $data['products']=$this->db->get('product', $config['per_page'],$offset);
if(!empty($category))
	{
			$arraycount=count($category);
	$chechcat=$arraycount -1;
	$i=1;
		$where1="";
		foreach($category as $key=>$val)
		{
			$where1 .=$val;
			if($i<=$chechcat)
			$where1 .=" , ";
			$i++;
			
		
		}
		if($min1 == "min" && $max1 == "700+")
		{
			$min1=1;
			$max1=700;
		  $data['msg']="Result for price&nbsp;".$min1."&nbsp;to&nbsp;".$max1."&nbsp;,&nbsp;".$where1."&nbsp;";
        }
		else
		{
			 $data['msg']="Result for price&nbsp;".$min1."&nbsp;to&nbsp;".$max1."&nbsp;,&nbsp;".$where1."&nbsp;";
		}
}	
else{	

if($min1 == "min" && $max1 == "700+")
		{
			$min1=1;
			$max1=700;
		   $data['msg']="Result for price&nbsp;".$min1."&nbsp;to&nbsp;".$max1."";
        }
		else
		{
			   $data['msg']="Result for price&nbsp;".$min1."&nbsp;to&nbsp;".$max1."";
		}
	 
}
	// $this->db->last_query();
	   $str_links = $this->pagination->create_links();
		$data["links"] = explode('&nbsp;',$str_links );
		 $data['hproduct']=$this->contact->get_product_sheader();
		 $data['max']=$max1;
		 $data['min']=$min1;
		 $data['check']=$category;
		 $data['cat']=$this->db->get('product_category');
		 $data['count_cart']=$this->contact->count_cart($session_id);
		 $data['count_wishlist']=$this->contact->count_wishlist($session_id);
		 $data['all_category_gp_3']=$this->contact->all_category_gp_3();
		 $data['rotatingtext']=$this->homeDetails->getspecialofferAll();
		$this->load->view('layout/header',$data);
		$this->load->view('product/clay_product',$data);
		$this->load->view('layout/footer');
		

	  
	}


function product_view($id)
{
	if(isset($this->session->userdata['logged_in']))
						 {
							 $session_id=$this->session->userdata['logged_in']['email'];
						 }
						 else
						 {
							 $session_id =session_id();	 
							 
						 }	
	
	
	$data['pv']=$this->products->product_view($id);
	$data['om']=$this->products->other_image($id);
	$data['hproduct']=$this->contact->get_product_sheader();
	$data['count_cart']=$this->contact->count_cart($session_id);
	$data['count_wishlist']=$this->contact->count_wishlist($session_id);
	$data['all_category_gp_3']=$this->contact->all_category_gp_3();
	$data['rotatingtext']=$this->homeDetails->getspecialofferAll();
		$this->load->view('layout/header',$data);
		$this->load->view('product/product_view',$data);
		$this->load->view('layout/footer');
	
	
}



function filter_price1()
	{ 

	
	
	if(isset($this->session->userdata['logged_in']))
						 {
							 $session_id=$this->session->userdata['logged_in']['email'];
						 }
						 else
						 {
							 $session_id =session_id();	 
							 
						 }	
	
						 
  $min1=$this->input->post('SortTags1');
	 $max1=$this->input->post('SortTags2');
	$category=$this->input->post('cechk');
	
	
	$this->load->library('table');
     
      $this->load->helper('form');
    
     $this->load->database();
	 /*
	 //where condition for category
	$arraycount=count($category);
	$chechcat=$arraycount -1;
	$i=1;
	$where='';
	$new_cat=array();
	if(!empty($category))
	{
		foreach($category as $key=>$val)
		{
			$where .="category = '".$val."'";
			if($i<=$chechcat)
			$where .=" or ";
			$i++;
			$new_cat[]=urlencode($val);
		
		}
	}	
	
$cat1=implode(',',$new_cat);
		if($arraycount !=0)
		{
		$this->db->where('('.$where.')');
		}
		if($min1 != "min" && $max1 != "700+")
		{
		
		$this->db->where('price >=', $min1);
		$this->db->where('price <=', $max1);
		}
		$num_rows=$this->db->count_all_results("product");
		//$this->db->last_query();
		$config = array();
        $config["base_url"] = base_url()."/product/filter_price/".$min1."/".$max1."/".$cat1."";
        $config["total_rows"] = $num_rows;
        $config["per_page"] = 700;

        $config["uri_segment"] = 5;
		$config['cur_tag_open'] = '&nbsp;<a class="current">';
        $config['cur_tag_close'] = '</a>';
        $config['next_link'] = 'Next';
        $config['prev_link'] = 'Previous';
        $this->pagination->initialize($config);
	
        $offset = ($this->uri->segment(5)) ? $this->uri->segment(5) : 0;
	
		if($arraycount !=0)
		{
		$this->db->where('('.$where.')');
		}
		if($min1 != "min" && $max1 != "700+")
		{
		
		$this->db->where('price >=', $min1);
		$this->db->where('price <=', $max1);
		}
	   $data['products']=$this->db->get('product', $config['per_page'],$offset);
if(!empty($category))
	{
			$arraycount=count($category);
	$chechcat=$arraycount -1;
	$i=1;
		$where1="";
		foreach($category as $key=>$val)
		{
			$where1 .=$val;
			if($i<=$chechcat)
			$where1 .=" , ";
			$i++;
			
		
		}
		if($min1 == "min" && $max1 == "700+")
		{
			$min1=1;
			$max1=700;
		  $data['msg']="Result for price&nbsp;".$min1."&nbsp;to&nbsp;".$max1."&nbsp;,&nbsp;".$where1."&nbsp;";
        }
		else
		{
			 $data['msg']="Result for price&nbsp;".$min1."&nbsp;to&nbsp;".$max1."&nbsp;,&nbsp;".$where1."&nbsp;";
		}
}	
else{	

if($min1 == "min" && $max1 == "700+")
		{
			$min1=1;
			$max1=700;
		   $data['msg']="Result for price&nbsp;".$min1."&nbsp;to&nbsp;".$max1."";
        }
		else
		{
			   $data['msg']="Result for price&nbsp;".$min1."&nbsp;to&nbsp;".$max1."";
		}
	 
}
	// $this->db->last_query();
	   $str_links = $this->pagination->create_links();
		$data["links"] = explode('&nbsp;',$str_links );
		 $data['hproduct']=$this->contact->get_product_sheader();
		 $data['max']=$max1;
		 $data['min']=$min1;
		 $data['check']=$category;
		 $data['cat']=$this->db->get('product_category');
		 $data['count_cart']=$this->contact->count_cart($session_id);
		$this->load->view('layout/header',$data);
		$this->load->view('product/clay_product',$data);
		$this->load->view('layout/footer');
		

	  */
	}


	function mail_enquiry()
	{
			$id=$this->input->post('id');
			$productname = $this->input->post('productname');
			$fullname = $this->input->post('fname');
			$email = $this->input->post('email');
			$mobile = $this->input->post('mob');
			$message = $this->input->post('message');
			//echo $productname.''.$fullname.''.$email.''.$mobile.''.$message;
			
			$msgbody= "Product Name :". $productname.'<br>'."Name :". $fullname.'<br>'."email :"."<a href='mailto: $email'>" . $email ."</a>".'<br>'."mobile :". $mobile.'<br>'."Message :". $message;

			// echo "<a href='mailto:" . $email . "?body=" . $body . "'>";


			$config = array(
						   'mailtype' => 'html',
                  'protocol' => 'smtp',
                 
				  'smtp_host' => 'mail.tazaahar.com',
                  'smtp_user' => 'info@tazaahar.com',
                  'smtp_pass' => 'Info@2022',
                  'smtp_port' => 465,
                  'crlf' => "\r\n",
                  'newline' => "\r\n"
                );
               $this->load->library('email',$config);


			$this->email->from('info@tazaahar.com');
			$this->email->to('info@tazaahar.com');
            $this->email->subject('Website Product Enquiry');
           
            $this->email->message($msgbody);
			if ($this->email->send()) 
			{
			    echo "<script>
			    alert('You are Message Send succesfully .. ')
			    </script>";

			    if(isset($this->session->userdata['logged_in']))
						 {
							 $session_id=$this->session->userdata['logged_in']['email'];
						 }
						 else
						 {
							 $session_id =session_id();	 
							 
						 }	
	
					redirect("product/product_view/".$id."");
					
			}
			
	}




}
?>