| Line 49... |
Line 49... |
| 49 |
}else{
|
49 |
}else{
|
| 50 |
$data['response']=$this->productinfo_model->getProducts($this->input->get(),$this->input->post(),$configdata['module'],$itemcode);
|
50 |
$data['response']=$this->productinfo_model->getProducts($this->input->get(),$this->input->post(),$configdata['module'],$itemcode);
|
| 51 |
if(isset($data['response']['response']['product_details']) && !empty($data['response']['response']['product_details']))
|
51 |
if(isset($data['response']['response']['product_details']) && !empty($data['response']['response']['product_details']))
|
| 52 |
setFileCache($data['response'], $productinfo,60);
|
52 |
setFileCache($data['response'], $productinfo,60);
|
| 53 |
}
|
53 |
}
|
| - |
|
54 |
$entity = $data['response']['response']['product_details'][0]->entity;
|
| - |
|
55 |
if(!isset($entity)) {
|
| - |
|
56 |
redirect(base_url());
|
| - |
|
57 |
}elseif(isset($entity) && !empty($entity)){
|
| 54 |
$id = $data['response']['response']['product_details'][0]->entity->id;
|
58 |
$id = $data['response']['response']['product_details'][0]->entity->id;
|
| 55 |
$items = $data['response']['response']['product_details'][0]->entity->items;
|
59 |
$items = $data['response']['response']['product_details'][0]->entity->items;
|
| 56 |
$i=0;
|
60 |
$i=0;
|
| 57 |
foreach ($items as $item) {
|
61 |
foreach ($items as $item) {
|
| 58 |
if(isset($item->sellingPrice) && !empty($item->sellingPrice)){
|
62 |
if(isset($item->sellingPrice) && !empty($item->sellingPrice)){
|
| 59 |
$sellingPrice = $item->sellingPrice;
|
63 |
$sellingPrice = $item->sellingPrice;
|
| - |
|
64 |
}
|
| - |
|
65 |
if(isset($item->mrp) && $item->mrp != 0){
|
| - |
|
66 |
$mrp = $item->mrp;
|
| - |
|
67 |
$discount = (($mrp - $sellingPrice)/$mrp);
|
| - |
|
68 |
$discount = round($discount*100);
|
| - |
|
69 |
$data['response']['response']['product_details'][0]->entity->items[$i]->discount = $discount;
|
| - |
|
70 |
$i++;
|
| - |
|
71 |
}
|
| 60 |
}
|
72 |
}
|
| 61 |
if(isset($item->mrp) && $item->mrp != 0){
|
73 |
if(!isset($id) || empty($id)){
|
| 62 |
$mrp = $item->mrp;
|
74 |
redirect(base_url());
|
| 63 |
$discount = (($mrp - $sellingPrice)/$mrp);
|
- |
|
| 64 |
$discount = round($discount*100);
|
- |
|
| 65 |
$data['response']['response']['product_details'][0]->entity->items[$i]->discount = $discount;
|
- |
|
| 66 |
$i++;
|
- |
|
| 67 |
}
|
75 |
}
|
| 68 |
}
|
- |
|
| 69 |
if(!isset($id) || empty($id)){
|
- |
|
| 70 |
redirect(base_url());
|
- |
|
| 71 |
}
|
- |
|
| 72 |
$name = str_replace(' ', '-', $data['response']['response']['product_details'][0]->entity->name);
|
76 |
$name = str_replace(' ', '-', $data['response']['response']['product_details'][0]->entity->name);
|
| 73 |
$apiCode = strtolower($name.'-'.$id);
|
77 |
$apiCode = strtolower($name.'-'.$id);
|
| 74 |
$apicode = str_replace('-','',$apiCode);
|
78 |
$apicode = str_replace('-','',$apiCode);
|
| 75 |
$originalCode = str_replace('-','',$originalCode);
|
79 |
$originalCode = str_replace('-','',$originalCode);
|
| 76 |
//echo $originalCode;
|
80 |
//echo $originalCode;
|
| 77 |
if($itemcode == $id){
|
81 |
if($itemcode == $id){
|
| 78 |
//set cache to output or renew cache
|
82 |
//set cache to output or renew cache
|
| 79 |
if(isset($cachemodule) and !empty($cachemodule))
|
83 |
if(isset($cachemodule) and !empty($cachemodule))
|
| 80 |
{
|
- |
|
| 81 |
foreach($cachemodule as $cm)
|
- |
|
| 82 |
{
|
84 |
{
|
| 83 |
if(isset($configdata[$cm]) and !empty($configdata[$cm]))
|
85 |
foreach($cachemodule as $cm)
|
| 84 |
{
|
86 |
{
|
| - |
|
87 |
if(isset($configdata[$cm]) and !empty($configdata[$cm]))
|
| - |
|
88 |
{
|
| 85 |
$data['response'][$cm]=$configdata[$cm];
|
89 |
$data['response'][$cm]=$configdata[$cm];
|
| - |
|
90 |
}
|
| 86 |
}
|
91 |
}
|
| 87 |
}
|
92 |
}
|
| - |
|
93 |
setCache($configdata['module'],$cachemodule,$data['response']);
|
| - |
|
94 |
$this->lessphp->object()->ccompile('assets/css/pd-detail.less','assets/css/pd-detail.css');
|
| - |
|
95 |
$data['stylesheet'] = 'pd-detail.css';
|
| - |
|
96 |
$title = $data['response']['response']['product_details'][0]->entity->title;
|
| - |
|
97 |
if(isset($title) && !empty($title)){
|
| - |
|
98 |
$data['title'] = $title;
|
| - |
|
99 |
}
|
| - |
|
100 |
$metaDescription = $data['response']['response']['product_details'][0]->entity->metaDescription;
|
| - |
|
101 |
if(isset($metaDescription) && !empty($metaDescription)){
|
| - |
|
102 |
$data['metaDescription'] = $metaDescription;
|
| - |
|
103 |
}
|
| - |
|
104 |
//end of set cache
|
| - |
|
105 |
$this->layout->view('productinfo/productinfo_view',$data);
|
| 88 |
}
|
106 |
}
|
| 89 |
setCache($configdata['module'],$cachemodule,$data['response']);
|
- |
|
| 90 |
$this->lessphp->object()->ccompile('assets/css/pd-detail.less','assets/css/pd-detail.css');
|
- |
|
| 91 |
$data['stylesheet'] = 'pd-detail.css';
|
- |
|
| 92 |
$title = $data['response']['response']['product_details'][0]->entity->title;
|
- |
|
| 93 |
if(isset($title) && !empty($title)){
|
- |
|
| 94 |
$data['title'] = $title;
|
- |
|
| 95 |
}
|
107 |
else{
|
| 96 |
$metaDescription = $data['response']['response']['product_details'][0]->entity->metaDescription;
|
- |
|
| 97 |
if(isset($metaDescription) && !empty($metaDescription)){
|
108 |
$url = base_url().strtolower(get_class()).'/'.$apiCode;
|
| 98 |
$data['metaDescription'] = $metaDescription;
|
109 |
redirect($url);
|
| 99 |
}
|
110 |
}
|
| 100 |
//end of set cache
|
- |
|
| 101 |
$this->layout->view('productinfo/productinfo_view',$data);
|
- |
|
| 102 |
}
|
- |
|
| 103 |
else{
|
- |
|
| 104 |
$url = base_url().strtolower(get_class()).'/'.$apiCode;
|
- |
|
| 105 |
redirect($url);
|
- |
|
| 106 |
}
|
111 |
}
|
| 107 |
|
112 |
|
| 108 |
}
|
113 |
}
|
| 109 |
|
114 |
|
| 110 |
function getDeliveryDetails($itemId,$pinCode){
|
115 |
function getDeliveryDetails($itemId,$pinCode){
|