ajaxController.php 1.79 KB
<?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']);
	}


}
?>