| Line 177... |
Line 177... |
| 177 |
$this->loadModel('MasterData');
|
177 |
$this->loadModel('MasterData');
|
| 178 |
$date = $this->request->query('date');
|
178 |
$date = $this->request->query('date');
|
| 179 |
|
179 |
|
| 180 |
if($product==null || $product=='search'){
|
180 |
if($product==null || $product=='search'){
|
| 181 |
if(!empty($date)){
|
181 |
if(!empty($date)){
|
| 182 |
$sql = "SELECT DATE( created ) date, count(id) AS count,count(distinct user_id) as countUserId, SUBSTRING_INDEX( url, '/', -1 ) AS skuBundleId FROM `user_urls` WHERE date(created) = '$date' AND url LIKE '%store_products/view%' GROUP BY skuBundleId ORDER BY countUserId DESC,count DESC";
|
182 |
$sql = "SELECT DATE( created ) date, count(id) AS count,count(distinct user_id) as countUserId, SUBSTRING_INDEX(SUBSTRING_INDEX( url, '/', -1 ),'?',1) AS skuBundleId FROM `user_urls` WHERE date(created) = '$date' AND url LIKE '%store_products/view%' GROUP BY skuBundleId ORDER BY countUserId DESC,count DESC";
|
| 183 |
} else{
|
183 |
} else{
|
| 184 |
$sql = "SELECT DATE( created ) date, count(id) AS count,count(distinct user_id) as countUserId, SUBSTRING_INDEX( url, '/', -1 ) AS skuBundleId FROM `user_urls` WHERE date(created) = curdate() AND url LIKE '%store_products/view%' group by skuBundleId ORDER BY countUserId DESC,count DESC";
|
184 |
$sql = "SELECT DATE( created ) date, count(id) AS count,count(distinct user_id) as countUserId, SUBSTRING_INDEX(SUBSTRING_INDEX( url, '/', -1 ),'?',1) AS skuBundleId FROM `user_urls` WHERE date(created) = curdate() AND url LIKE '%store_products/view%' group by skuBundleId ORDER BY countUserId DESC,count DESC";
|
| 185 |
}
|
185 |
}
|
| 186 |
$clicks_count = $this->UserUrl->query($sql);
|
186 |
$clicks_count = $this->UserUrl->query($sql);
|
| 187 |
$this->set(compact('clicks_count'));
|
187 |
$this->set(compact('clicks_count'));
|
| 188 |
} else{
|
188 |
} else{
|
| 189 |
$sql = "SELECT DATE( created ) date, count(id) AS count,count(distinct user_id) as countUserId, SUBSTRING_INDEX( url, '/', -1 ) AS skuBundleId FROM `user_urls` WHERE SUBSTRING_INDEX( url, '/', -1 ) = $product group by date(created) ORDER BY id DESC ";
|
189 |
$sql = "SELECT DATE( created ) date, count(id) AS count,count(distinct user_id) as countUserId, SUBSTRING_INDEX(SUBSTRING_INDEX( url, '/', -1 ), '/', -1 ) AS skuBundleId FROM `user_urls` WHERE SUBSTRING_INDEX( url, '/', -1 ) = $product group by date(created) ORDER BY id DESC ";
|
| 190 |
$product_count = $this->UserUrl->query($sql);
|
190 |
$product_count = $this->UserUrl->query($sql);
|
| 191 |
$this->set(compact('product_count','product'));
|
191 |
$this->set(compact('product_count','product'));
|
| 192 |
}
|
192 |
}
|
| - |
|
193 |
echo $sql;
|
| 193 |
$params = array(
|
194 |
$params = array(
|
| 194 |
'fields' => array('skuBundleId','brand','source_product_name'),
|
195 |
'fields' => array('skuBundleId','brand','source_product_name'),
|
| 195 |
'conditions' => array('source_id' => array('$ne' => 0)),
|
196 |
'conditions' => array('source_id' => array('$ne' => 0)),
|
| 196 |
'order' => array('_id' => 1),
|
197 |
'order' => array('_id' => 1),
|
| 197 |
);
|
198 |
);
|