Subversion Repositories SmartDukaan

Rev

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

Rev 13683 Rev 13688
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('conditions'=>array('source'=>'Flipkart','stock' => 'In Stock'),'order'=>array('mrp'=>'asc'),'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'));
92
		$this->Paginator->settings = array('conditions'=>array('source'=>'Flipkart','stock' => 'In Stock'),'order'=>array('mrp'=>'asc'),'contain'=>array('Product'),'limit'=>$limit,'fields'=>array('Product.category_id','StoreProduct.id','StoreProduct.title','StoreProduct.thumbnail','StoreProduct.price','StoreProduct.cashback','StoreProduct.tagline','StoreProduct.offer','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 105... Line 105...
105
		$this->layout = 'ajax';
105
		$this->layout = 'ajax';
106
		$limit = 20;
106
		$limit = 20;
107
		$this->StoreProduct->recursive = -1;
107
		$this->StoreProduct->recursive = -1;
108
		// $count = $this->StoreProduct->find('count');
108
		// $count = $this->StoreProduct->find('count');
109
		$this->StoreProduct->Behaviors->attach('Containable');
109
		$this->StoreProduct->Behaviors->attach('Containable');
110
		$this->Paginator->settings = array('conditions'=>array('Product.category_id'=>$categoryId),'contain'=>array('Product'),'limit'=>$limit,'fields'=>array('Product.category_id','StoreProduct.id','StoreProduct.title','StoreProduct.thumbnail','StoreProduct.price','StoreProduct.cashback','StoreProduct.available_price'));
110
		$this->Paginator->settings = array('conditions'=>array('Product.category_id'=>$categoryId),'contain'=>array('Product'),'limit'=>$limit,'fields'=>array('Product.category_id','StoreProduct.id','StoreProduct.title','StoreProduct.thumbnail','StoreProduct.price','StoreProduct.cashback','StoreProduct.tagline','StoreProduct.offer','StoreProduct.available_price'));
111
		$result = array('products' => $this->Paginator->paginate());
111
		$result = array('products' => $this->Paginator->paginate());
112
		$callback = $this->request->query('callback');
112
		$callback = $this->request->query('callback');
113
		$this->set(array(
113
		$this->set(array(
114
		    'result' => $result,
114
		    'result' => $result,
115
		    'callback' => $callback,
115
		    'callback' => $callback,
Line 131... Line 131...
131
		$products = array();
131
		$products = array();
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','StoreProduct.tagline','StoreProduct.offer'),'conditions'=>$conditions);
137
				$rows = $this->Paginator->paginate();				
137
				$rows = $this->Paginator->paginate();				
138
				foreach($rows AS $key => $product){
138
				foreach($rows AS $key => $product){
139
					$products[$value['UserCategory']['category_id']][$key][] = $product;
139
					$products[$value['UserCategory']['category_id']][$key][] = $product;
140
				}
140
				}
141
			}
141
			}
Line 143... Line 143...
143
			//Fetch all categories
143
			//Fetch all categories
144
			$categories = $this->StoreProduct->Product->Category->find('all');
144
			$categories = $this->StoreProduct->Product->Category->find('all');
145
			foreach ($categories as $key => $value) {
145
			foreach ($categories as $key => $value) {
146
				$categoryIds[] = $value['Category']['id'];
146
				$categoryIds[] = $value['Category']['id'];
147
				$conditions = array('Product.category_id'=>$value['Category']['id']);
147
				$conditions = array('Product.category_id'=>$value['Category']['id']);
148
				$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);
148
				$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','StoreProduct.tagline','StoreProduct.offer'),'conditions'=>$conditions);
149
				$rows = $this->Paginator->paginate();				
149
				$rows = $this->Paginator->paginate();				
150
				foreach($rows AS $key => $product){
150
				foreach($rows AS $key => $product){
151
					$products[$value['Category']['id']][$key][] = $product;
151
					$products[$value['Category']['id']][$key][] = $product;
152
				}
152
				}
153
			}
153
			}