Blame view

modules/default/controller/ajaxController.php 1.79 KB
8d65d0ce   andryeyev   init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  <?php
  
  Class AjaxController Extends baseController {
  
  //protected $_navig = array('name'=>"info");
  
  	public function index()
  	{
   
  	}
  
  	public function basket(){
  	header("Content-type: text/html; charset=windows-1251");
  		$products = new Products($this->lang);
  
  		if(isset($this->postParam['clear'])){
  			$products->clearBasket();
  		}
  
  		if(isset($this->postParam['product_id'],$this->postParam['count']) && $this->postParam['product_id']>0 && $this->postParam['count']>0){
  			$products->addBasket($this->postParam['product_id'],$this->postParam['count']);
  		}
  		
  		$row = $products->rowBasket();
  		$this->tpl->assign('cost',$row['cost']);
  		$this->tpl->assign('count',$row['count']);
  		
  	}
  	
  	public function basket_full(){
  		$products = new Products($this->lang);
  		print $products->getBasketFull();
  	}
  	
  	public function gallery($id){
  		$gallery = new Gallery($this->lang);
  		$row = $gallery->getViewOne($id);
  		switch($row['type']){
  			case 'img' : print'<img src="'.Config::get('url').'/pics/catalogs_gallery/big/'.$row['pic_big'].'" />'; break;
  			case 'video' : print $row['code']; break;
  			default: print'<img src="'.Config::get('url').'/pics/catalogs_gallery/big/'.$row['pic_big'].'" />';
  		}
  	}
  	
  	public function products_rec(){
  		$products = new Products($this->lang);
  		$this->tpl->assign('recommended',$products->getRecommended($this->postParam['product_id']));	
  	}
  	
  	public function fotovideo($id){
  		$Fotovideo = new Fotovideo($this->lang);
  		$row = $Fotovideo->getGalleryOne($id);
  		if($row['type']=="video"){print stripcslashes($row['code']);}
  		else{print'<img src="'.Config::get('url').'/pics/fotovideo/big/'.$row['pic_big'].'" />';}
  	}
  	
  	public function product_video($id){
  		$products = new Products($this->lang);
  		$row = $products->getProduct($id);
  		print stripcslashes($row['video_code']);
  	}
  
  
  }
  ?>