Subversion Repositories SmartDukaan

Rev

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

Rev 10735 Rev 10752
Line 29... Line 29...
29
			//if user logged-in
29
			//if user logged-in
30
			redirect(base_url().strtolower(__CLASS__).'/shipping');
30
			redirect(base_url().strtolower(__CLASS__).'/shipping');
31
		}
31
		}
32
 
32
 
33
		//standard array
33
		//standard array
34
		$data = array();
-
 
35
		$checkoutconfig = $this->config->item('checkout');
-
 
36
		if(!isset($_POST['submit'])){
-
 
37
		unset($checkoutconfig['response'][1]);	
-
 
38
		$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$checkoutconfig);
-
 
39
		$this->layout->view('checkout/checkout_view',$data);
-
 
40
		}
-
 
41
		if(isset($_POST['submit'])){
-
 
42
			$type = $this->input->post('type');
-
 
43
			if($type == "member"){
-
 
44
			unset($checkoutconfig['response'][0]);	
-
 
45
			$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$checkoutconfig);
-
 
46
			if(isset($data['response']['response']['login_submit']['authorized'])){
-
 
47
			$this->session->set_userdata('authorized',$data['response']['response']['login_submit']['authorized']);
-
 
48
			$this->session->set_flashdata(array('msg'=>$data['response']['response']['login_submit']['msg']));
-
 
49
			redirect(base_url().$data['response']['response']['login_submit']['redirect']);
-
 
50
			}
-
 
51
			else
-
 
52
			{
-
 
53
				$this->layout->view(strtolower(__CLASS__).'/checkout_view',$data);
-
 
54
			}
-
 
55
			}
-
 
56
			if($type == 'guest'){
-
 
57
				redirect(base_url().strtolower(__CLASS__).'/shipping');	
-
 
58
			}
-
 
59
			if($type == 'register'){
-
 
60
				redirect(base_url().'auth/signup');	
-
 
61
			}
-
 
62
		}
-
 
63
	}
34
	}
64
	// public function billing()
-
 
65
	// {
-
 
66
	// 	//standard array
-
 
67
	// 	$data = array();
-
 
68
		
-
 
69
	// 	$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$this->config->item('billing'));
-
 
70
	// 	$this->layout->view('checkout/checkout_view',$data);
-
 
71
 
-
 
72
	// }
-
 
73
	public function __paginateList($data=array())
35
	public function __paginateList($data=array())
74
	{
36
	{
75
			//$data['baseSubTotal']=$data['baseSubTotal'];
37
			//$data['baseSubTotal']=$data['baseSubTotal'];
76
			$data['subTotal'] = $data['subTotal'];
38
			$data['subTotal'] = $data['subTotal'];
77
			//$data['shippingCharges'] = $data['shippingCharges'];
39
			//$data['shippingCharges'] = $data['shippingCharges'];
Line 492... Line 454...
492
			}else{
454
			}else{
493
				$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
455
				$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
494
        		if(isset($data['response']['response']['pickup']) && !empty($data['response']['response']['pickup']))
456
        		if(isset($data['response']['response']['pickup']) && !empty($data['response']['response']['pickup']))
495
        		setFileCache($data['response']['response']['pickup'], 'pickup',900);
457
        		setFileCache($data['response']['response']['pickup'], 'pickup',900);
496
			}
458
			}
-
 
459
			if(isset($data['response']['response']['shipping_process'][0]) && !empty($data['response']['response']['shipping_process'][0])){
497
			$this->layout->view('checkout/checkout_view',$data);
460
				$this->layout->view('checkout/checkout_view',$data);
-
 
461
			}else{
-
 
462
				redirect(base_url()."cart");
-
 
463
			}
498
		}
464
		}
499
		if(isset($_POST['submit']))
465
		if(isset($_POST['submit']))
500
		{
466
		{
501
			unset($shippingconfig['response'][1]);	
467
			unset($shippingconfig['response'][1]);	
502
			$data = $this->get_shipping_billing($_POST);
468
			$data = $this->get_shipping_billing($_POST);
Line 518... Line 484...
518
			redirect(base_url()."shipping");
484
			redirect(base_url()."shipping");
519
			
485
			
520
		}
486
		}
521
		
487
		
522
	}
488
	}
523
	public function shippingmode()
-
 
524
	{
-
 
525
		$data = array();
-
 
526
		$shippingconfig = $this->config->item('shippingmethod');
-
 
527
		if(!isset($_POST['submit']))
-
 
528
		{
-
 
529
			unset($shippingconfig['response'][1]);
-
 
530
			$data['response']['address']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
-
 
531
			$this->layout->view('checkout/checkout_view',$data);
-
 
532
		}
-
 
533
		if(isset($_POST['submit']))
-
 
534
		{
-
 
535
			unset($shippingconfig['response'][0]);
-
 
536
			$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
-
 
537
			if($data['response']['response']['shippingmethod_submit'][0] == 1){
-
 
538
			redirect(base_url().strtolower(__CLASS__)."/payment");
-
 
539
			}
-
 
540
			else{
-
 
541
			redirect(base_url().strtolower(__CLASS__)."/shippingmode");	
-
 
542
			}
-
 
543
			
-
 
544
		}
-
 
545
	}
-
 
546
	public function review()
-
 
547
	{
-
 
548
		//standard array
-
 
549
		$authorized = $this->session->userdata('authorized');
-
 
550
		if(isset($authorized) and !empty($authorized['id']))
-
 
551
		{
-
 
552
			//if user logged-in
-
 
553
			$_GET['customerId'] = $authorized['id'];
-
 
554
		}
-
 
555
		$data = array();
-
 
556
		$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$this->config->item('review'));
-
 
557
		if(isset($data['response']['response']['review_process']) && !empty($data['response']['response']['review_process'])){
-
 
558
		$this->layout->view('checkout/checkout_view',$data);
-
 
559
		}
-
 
560
		else{
-
 
561
			redirect(base_url().strtolower(__CLASS__)."/shipping");
-
 
562
		}
-
 
563
	}
-
 
564
 
489
 
565
	public function get_shipping_billing($data=array()){
490
	public function get_shipping_billing($data=array()){
566
		$billing =array();
491
		$billing =array();
567
		$shipping =array();
492
		$shipping =array();
568
		if (isset($data) && !empty($data)) {
493
		if (isset($data) && !empty($data)) {