| Line 156... |
Line 156... |
| 156 |
public function admin_clicks_report($product=null){
|
156 |
public function admin_clicks_report($product=null){
|
| 157 |
$this->loadModel('Click');
|
157 |
$this->loadModel('Click');
|
| 158 |
$date = $this->request->query('date');
|
158 |
$date = $this->request->query('date');
|
| 159 |
if($product==null || $product=='search'){
|
159 |
if($product==null || $product=='search'){
|
| 160 |
if(!empty($date)){
|
160 |
if(!empty($date)){
|
| 161 |
$sql = "select count(*) as count,product_name,brand from clicks where length(product_name)>0 and store_product_id>0 and date(created)='$date' group by store_product_id order by count desc";
|
161 |
$sql = "select count(*) as count,product_name,brand,count(distinct user_id) as countUserId from clicks where length(product_name)>0 and store_product_id>0 and date(created)='$date' group by store_product_id order by count desc";
|
| 162 |
} else{
|
162 |
} else{
|
| 163 |
$sql = "select count(*) as count,product_name,brand from clicks where length(product_name)>0 and store_product_id>0 and date(created)=curdate() group by store_product_id order by count desc";
|
163 |
$sql = "select count(*) as count,product_name,brand,count(distinct user_id) as countUserId from clicks where length(product_name)>0 and store_product_id>0 and date(created)=curdate() group by store_product_id order by count desc";
|
| 164 |
}
|
164 |
}
|
| 165 |
$clicks_count = $this->Click->query($sql);
|
165 |
$clicks_count = $this->Click->query($sql);
|
| 166 |
$this->set(compact('clicks_count'));
|
166 |
$this->set(compact('clicks_count'));
|
| 167 |
}else{
|
167 |
}else{
|
| 168 |
$sql="select count(*) as count,date(created) date from clicks where length(product_name)>0 and store_product_id>0 and product_name ='$product' group by date(created) order by date desc";
|
168 |
$sql="select count(*) as count,date(created) date,count(distinct user_id) as countUserId from clicks where length(product_name)>0 and store_product_id>0 and product_name ='$product' group by date(created) order by date desc";
|
| 169 |
$product_count = $this->Click->query($sql);
|
169 |
$product_count = $this->Click->query($sql);
|
| 170 |
$this->set(compact('product_count','product'));
|
170 |
$this->set(compact('product_count','product'));
|
| 171 |
}
|
171 |
}
|
| 172 |
}
|
172 |
}
|
| 173 |
}
|
173 |
}
|
| 174 |
|
174 |
|