Subversion Repositories SmartDukaan

Rev

Rev 11169 | Rev 11523 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11169 Rev 11517
Line 22... Line 22...
22
		$this->layoutName= $this->layout->getLayout();
22
		$this->layoutName= $this->layout->getLayout();
23
		$this->layoutName =substr($this->layoutName , 0, strrpos($this->layoutName , "/")).'/';
23
		$this->layoutName =substr($this->layoutName , 0, strrpos($this->layoutName , "/")).'/';
24
		//print_r($this->session->userdata);
24
		//print_r($this->session->userdata);
25
 
25
 
26
	}
26
	}
27
	public function index()
27
		public function index()
28
	{
28
	{
29
		$authorized = $this->session->userdata('authorized');
29
		$authorized = $this->session->userdata('authorized');
-
 
30
		//standard array
-
 
31
		$configdata = $this->config->item('cart');
-
 
32
		//$checkConfig = $this->config->item('home');
-
 
33
		$cachemodule = array('header','footer');
-
 
34
		$configdata = getCache($configdata,$cachemodule);
-
 
35
		$data = array();
30
		if(isset($authorized) && !empty($authorized)){
36
		if(isset($authorized) && !empty($authorized)){
31
			$_GET['userId'] = $authorized['Id'];
37
			$_GET['userId'] = $authorized['Id'];
32
			$_GET['Id'] = $authorized['cartId'];
38
			$_GET['Id'] = $authorized['cartId'];
33
			if($authorized['isLoggedIn'] == 1){
39
			if($authorized['isLoggedIn'] == 1){
34
				$_GET['isLoggedIn'] = 'true';
40
				$_GET['isLoggedIn'] = 'true';
35
			}
41
			}
36
			elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
42
			elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
37
				$_GET['isLoggedIn'] = 'false';
43
				$_GET['isLoggedIn'] = 'false';
38
			}
44
			}
39
		}
-
 
40
		//standard array
-
 
41
		$configdata = $this->config->item('cart');
45
			unset($configdata['module']['response'][0]);
42
		//$checkConfig = $this->config->item('home');
-
 
43
		$cachemodule = array('header','footer');
-
 
44
		$configdata = getCache($configdata,$cachemodule);
-
 
45
		$data = array();
-
 
46
		$data['response']=$this->cart_model->getCart($this->input->get(),$this->input->post(),$configdata['module']);
46
			$data['response']=$this->cart_model->getCart($this->input->get(),$this->input->post(),$configdata['module']);
47
		//print_r($data['response']['response']['carts']);
47
			//print_r($data['response']['response']['carts']);
48
		if(isset($data['response']['response']['carts'][0]->lines))
48
			if(isset($data['response']['response']['carts'][0]->lines))
49
		$cartCount = sizeof($data['response']['response']['carts'][0]->lines);
49
			$cartCount = sizeof($data['response']['response']['carts'][0]->lines);
50
		$authorized = $this->session->userdata('authorized');
50
			$authorized = $this->session->userdata('authorized');
51
		if(isset($authorized) && !empty($authorized)){
51
			if(isset($authorized) && !empty($authorized)){
52
			$newValues = $authorized;
52
				$newValues = $authorized;
53
			$newValues['totalItems'] = $cartCount;
53
				$newValues['totalItems'] = $cartCount;
54
			$this->session->set_userdata('authorized',$newValues);
54
				$this->session->set_userdata('authorized',$newValues);
55
		}
55
			}
56
		$this->lessphp->object()->ccompile('assets/css/cart.less','assets/css/cart.css');
56
			$this->lessphp->object()->ccompile('assets/css/cart.less','assets/css/cart.css');
57
		$data['stylesheet'] = 'cart.css';
57
			$data['stylesheet'] = 'cart.css';
58
		if(isset($cachemodule) and !empty($cachemodule) && !isset($api))
58
			if(isset($cachemodule) and !empty($cachemodule) && !isset($api))
59
		{
59
			{
60
			foreach($cachemodule as $cm)
60
				foreach($cachemodule as $cm)
-
 
61
				{
-
 
62
					if(isset($configdata[$cm]) and !empty($configdata[$cm]))
-
 
63
					{
-
 
64
						$data['response'][$cm]=$configdata[$cm];
-
 
65
					}
-
 
66
				}
-
 
67
			}
-
 
68
			setCache($configdata['module'],$cachemodule,$data['response']);
-
 
69
			$this->layout->view('cart/cart_view',$data);
-
 
70
		}else{
-
 
71
			unset($configdata['module']['response'][1]);
-
 
72
			$data['response']=$this->cart_model->getCart($this->input->get(),$this->input->post(),$configdata['module']);
-
 
73
			$this->lessphp->object()->ccompile('assets/css/cart.less','assets/css/cart.css');
-
 
74
			$data['stylesheet'] = 'cart.css';
-
 
75
			if(isset($cachemodule) and !empty($cachemodule) && !isset($api))
61
			{
76
			{
62
				if(isset($configdata[$cm]) and !empty($configdata[$cm]))
77
				foreach($cachemodule as $cm)
63
				{
78
				{
-
 
79
					if(isset($configdata[$cm]) and !empty($configdata[$cm]))
-
 
80
					{
64
					$data['response'][$cm]=$configdata[$cm];
81
						$data['response'][$cm]=$configdata[$cm];
-
 
82
					}
65
				}
83
				}
66
			}
84
			}
-
 
85
			setCache($configdata['module'],$cachemodule,$data['response']);
-
 
86
			$this->layout->view('cart/carts',$data);
67
		}
87
		}
68
		setCache($configdata['module'],$cachemodule,$data['response']);
-
 
69
		$this->layout->view('cart/cart_view',$data);
-
 
70
	}
88
	}
71
 
89
 
72
	
90
	
73
	public function add($id=null,$email=null,$itemname)
91
	public function add($id=null,$email=null,$itemname)
74
	{
92
	{