Subversion Repositories SmartDukaan

Rev

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

Rev 10582 Rev 10726
Line 91... Line 91...
91
		}
91
		}
92
		if(isset($email) && $email != 'null'){
92
		if(isset($email) && $email != 'null'){
93
			$_POST['email'] = $email;
93
			$_POST['email'] = $email;
94
		}
94
		}
95
		$response=$this->cart_model->getCart($this->input->get(),$this->input->post(),$this->config->item('cart_add'));
95
		$response=$this->cart_model->getCart($this->input->get(),$this->input->post(),$this->config->item('cart_add'));
96
	
-
 
97
		if(isset($response['response']['addcart'][0]->message) && !empty($response['response']['addcart'][0]->message)){
96
		if(isset($response['response']['addcart'][0]->message) && !empty($response['response']['addcart'][0]->message)){
98
			echo json_encode($response['response']);
97
			echo json_encode($response['response']);
99
		}
98
		}
100
		else{
-
 
101
			$cartCount = sizeof($response['response']['addcart'][0]->lines);
99
		elseif(isset($response['response']['addcart'][0]->redirectUrl) && $response['response']['addcart'][0]->redirectUrl == 'cart'){
102
			$authorized = $this->session->userdata('authorized');
100
			$authorized = $this->session->userdata('authorized');
103
			if(isset($authorized) && !empty($authorized)){
101
			if(isset($authorized) && !empty($authorized)){
-
 
102
				$cartCount = $authorized['totalItems'];
104
				$newValues = $authorized;
103
				$newValues = $authorized;
105
				$newValues['totalItems'] = $cartCount;
104
				$newValues['totalItems'] = $cartCount+1;
106
				$this->session->set_userdata('authorized',$newValues);
105
				$this->session->set_userdata('authorized',$newValues);
107
			}
106
			}
108
			echo json_encode($response['response']);
107
			echo json_encode($response['response']);
109
			//redirect(base_url().strtolower(__CLASS__),'refresh');
108
			//redirect(base_url().strtolower(__CLASS__),'refresh');
-
 
109
		}elseif(isset($response['response']['addcart'][0]->redirectUrl) && $response['response']['addcart'][0]->redirectUrl != 'cart'){
-
 
110
			echo json_encode($response['response']);
110
		}
111
		}
111
	}
112
	}
112
	public function update($id=null,$qty=null)
113
	public function update($id=null,$qty=null)
113
	{
114
	{
114
		$response=array();
115
		$response=array();