Subversion Repositories SmartDukaan

Rev

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

Rev 13597 Rev 13599
Line 87... Line 87...
87
		$this->layout = 'ajax';
87
		$this->layout = 'ajax';
88
		$limit = 20;
88
		$limit = 20;
89
		$this->StoreProduct->recursive = -1;
89
		$this->StoreProduct->recursive = -1;
90
		$count = $this->StoreProduct->find('count');
90
		$count = $this->StoreProduct->find('count');
91
		$this->StoreProduct->Behaviors->attach('Containable');
91
		$this->StoreProduct->Behaviors->attach('Containable');
92
		$this->Paginator->settings = array('order'=>array('available_price'=>'desc'), 'contain'=>array('Product'),'limit'=>$limit,'fields'=>array('Product.category_id','StoreProduct.id','StoreProduct.title','StoreProduct.thumbnail','StoreProduct.price','StoreProduct.cashback','StoreProduct.available_price'));
92
		$this->Paginator->settings = array('conditions'=>array('source'=>'Amazon'),'order'=>array('mrp'=>'desc'),'contain'=>array('Product'),'limit'=>$limit,'fields'=>array('Product.category_id','StoreProduct.id','StoreProduct.title','StoreProduct.thumbnail','StoreProduct.price','StoreProduct.cashback','StoreProduct.available_price','Product.name'));
93
		$result = array('products' => $this->Paginator->paginate(),'maxresults'=>ceil($count/$limit));
93
		$result = array('products' => $this->Paginator->paginate(),'maxresults'=>ceil($count/$limit));
94
		$callback = $this->request->query('callback');
94
		$callback = $this->request->query('callback');
95
		$this->set(array(
95
		$this->set(array(
96
		    'result' => $result,
96
		    'result' => $result,
97
		    'callback' => $callback,
97
		    'callback' => $callback,
Line 132... Line 132...
132
		if(!empty($userCategories)){
132
		if(!empty($userCategories)){
133
			foreach ($userCategories as $key => $value) {
133
			foreach ($userCategories as $key => $value) {
134
				$categoryIds[] = $value['UserCategory']['category_id'];
134
				$categoryIds[] = $value['UserCategory']['category_id'];
135
				$conditions = array('Product.category_id'=>$value['UserCategory']['category_id']);
135
				$conditions = array('Product.category_id'=>$value['UserCategory']['category_id']);
136
				$this->Paginator->settings = array('contain'=>array('Product'),'limit'=>$limit,'fields'=>array('Product.category_id','StoreProduct.id','StoreProduct.title','StoreProduct.thumbnail','StoreProduct.price','StoreProduct.cashback','StoreProduct.available_price'),'conditions'=>$conditions);
136
				$this->Paginator->settings = array('contain'=>array('Product'),'limit'=>$limit,'fields'=>array('Product.category_id','StoreProduct.id','StoreProduct.title','StoreProduct.thumbnail','StoreProduct.price','StoreProduct.cashback','StoreProduct.available_price'),'conditions'=>$conditions);
137
				// $products[$value['UserCategory']['category_id']]['products'] = $this->Paginator->paginate();				
-
 
138
				$rows = $this->Paginator->paginate();				
137
				$rows = $this->Paginator->paginate();				
139
				foreach($rows AS $key => $product){
138
				foreach($rows AS $key => $product){
140
					$products[$value['UserCategory']['category_id']][$key][] = $product;
139
					$products[$value['UserCategory']['category_id']][$key][] = $product;
141
				}
140
				}
142
			}
141
			}