| Line 30... |
Line 30... |
| 30 |
if(isset($hide) && !empty($hide) && $hide == 1){
|
30 |
if(isset($hide) && !empty($hide) && $hide == 1){
|
| 31 |
// $this->loadModel('StoreProduct');
|
31 |
// $this->loadModel('StoreProduct');
|
| 32 |
// $options = array('conditions'=>array('id'=>$productId),'fields'=>array('category_id','brand'),'recursive'=>-1);
|
32 |
// $options = array('conditions'=>array('id'=>$productId),'fields'=>array('category_id','brand'),'recursive'=>-1);
|
| 33 |
// $product = $this->StoreProduct->find('first',$options);
|
33 |
// $product = $this->StoreProduct->find('first',$options);
|
| 34 |
$cachekey = 'storeproduct-'.$productId;
|
34 |
$cachekey = 'storeproduct-'.$productId;
|
| 35 |
$product = Cache::read($cachekey,'month');
|
35 |
$product = Cache::read($cachekey,'fivemin');
|
| 36 |
if(empty($product)) {
|
36 |
if(empty($product)) {
|
| 37 |
$url = $this->apihost.'masterData/getSkuById/'.$productId;
|
37 |
$url = $this->apihost.'masterData/getSkuById/'.$productId;
|
| 38 |
$productarr = $this->make_request($url,null);
|
38 |
$productarr = $this->make_request($url,null);
|
| 39 |
$product = json_decode($productarr[0],1);
|
39 |
$product = json_decode($productarr[0],1);
|
| 40 |
Cache::write($cachekey,$product,'month');
|
40 |
Cache::write($cachekey,$product,'fivemin');
|
| 41 |
}
|
41 |
}
|
| 42 |
$this->loadModel('BrandPreference');
|
42 |
$this->loadModel('BrandPreference');
|
| 43 |
$data = array('user_id' => $userId, 'category_id' => $product['category_id'],'brand'=>$product['brand'],'status'=>'hide');
|
43 |
$data = array('user_id' => $userId, 'category_id' => $product['category_id'],'brand'=>$product['brand'],'status'=>'hide');
|
| 44 |
try{
|
44 |
try{
|
| 45 |
$this->BrandPreference->create();
|
45 |
$this->BrandPreference->create();
|