| 10582 |
lgm |
1 |
<script src="<?php echo base_url();?>assets/js/jquery.js" type="text/javascript"></script>
|
|
|
2 |
<script src="<?php echo base_url();?>assets/js/jquery.nouislider.js" type="text/javascript"></script>
|
|
|
3 |
<script src="<?php echo base_url();?>assets/css/jquery.nouislider.css" type="text/css"></script>
|
|
|
4 |
|
| 13161 |
anikendra |
5 |
<?php $authorized=$this->session->userdata('authorized');?>
|
| 10582 |
lgm |
6 |
|
| 12188 |
anikendra |
7 |
<?php
|
| 10582 |
lgm |
8 |
if(isset($search_list[0]->result->results) && (!empty($search_list[0]->result->results))) {
|
|
|
9 |
$selectedFilters = array();
|
|
|
10 |
$results = $search_list[0]->result?>
|
|
|
11 |
<div class="pd-info-head ">
|
|
|
12 |
<div class="name-hldr clearfix">
|
|
|
13 |
<div>
|
|
|
14 |
<?php if(isset($results->label) && !empty($results->label))?>
|
|
|
15 |
<span><?php echo $results->label;?></span>
|
|
|
16 |
<?php if((isset($results->totalCount)) && (!empty($results->totalCount))){
|
|
|
17 |
$TotalPage = ceil($results->totalCount/10);?>
|
|
|
18 |
<span>(<?php echo $results->totalCount;?> results)</span></div>
|
|
|
19 |
<?php } ?>
|
|
|
20 |
<div onclick="toggleListview(event);"></div>
|
|
|
21 |
</div>
|
|
|
22 |
</div><!--pd-info-head-->
|
|
|
23 |
<div class="filter-div clearfix">
|
|
|
24 |
<div onclick="toggleRefine(event)" class="sort">
|
|
|
25 |
<span>
|
|
|
26 |
<?php
|
|
|
27 |
if(isset($results->sortedBy) && !empty($results->sortedBy)){
|
|
|
28 |
foreach($results->sortOptions as $key=>$value){
|
|
|
29 |
if($results->sortedBy == $key){
|
| 10961 |
lgm |
30 |
$sortedBy = $results->sortedBy;
|
|
|
31 |
echo $value;
|
| 10582 |
lgm |
32 |
}
|
|
|
33 |
}
|
|
|
34 |
}else{ echo "sort by";} ?>
|
|
|
35 |
</span>
|
|
|
36 |
</div>
|
|
|
37 |
<div onclick="toggleRefine(event)" class="filter">
|
|
|
38 |
<span>
|
|
|
39 |
Filter
|
|
|
40 |
</span>
|
|
|
41 |
</div>
|
|
|
42 |
<!-- <div onclick="toggleRefine(event)" class="deals">
|
|
|
43 |
<span>
|
|
|
44 |
All
|
|
|
45 |
</span>
|
|
|
46 |
</div> -->
|
|
|
47 |
<div class="sort-by" style="display:none;" onclick="fireSort(event)">
|
|
|
48 |
<?php foreach($results->sortOptions as $key=>$value){ ?>
|
| 10961 |
lgm |
49 |
<div <?php if(isset($sortedBy) && $sortedBy == $key){ echo 'class="opt selected"';}?> data-val="<?php echo $key;?>" ><?php echo $value;?></div>
|
| 10582 |
lgm |
50 |
<?php }?>
|
|
|
51 |
</div><!--sort-by-->
|
|
|
52 |
<div class="filter-by" style="display:none" onclick="fireFilter(event)">
|
|
|
53 |
<div class="filter-head clearfix">
|
|
|
54 |
<div class="clear" onclick="clearfilter(event)">Clear</div>
|
|
|
55 |
<div class="apply" onclick="applyFilter1(event)">Apply</div>
|
|
|
56 |
</div><!--btn-hldr-->
|
|
|
57 |
<div class="filter-name">Price(Rs.)<span>+</span></div>
|
| 11456 |
lgm |
58 |
<div class="filter-options ch-filter clearfix" style="display:none" >
|
|
|
59 |
<div style="position:relative; height:40px;padding:10px 0;box-sizing: border-box;-webkit-box-sizing: border-box;">
|
| 10582 |
lgm |
60 |
<span id="exTO" class="slider-input"><?php echo $results->minPrice; ?></span>
|
|
|
61 |
<span id="exFR" class="slider-input"><?php echo $results->maxPrice; ?></span>
|
|
|
62 |
</div>
|
|
|
63 |
<div class="clear"></div>
|
|
|
64 |
|
|
|
65 |
<div class="noUiSlider"></div>
|
|
|
66 |
<div id="minprice" class="oprice" style="display:<?php if(isset($results->dynamicPriceMap) && !empty($results->dynamicPriceMap)){echo 'block';}else{echo 'none';} ?>"><?php if(isset($results->dynamicPriceMap) && !empty($results->dynamicPriceMap)) { echo $results->dynamicPriceMap->min; } else { echo $results->minPrice; }?></div>
|
|
|
67 |
<div id="maxprice" class="oprice max" style="display:<?php if(isset($results->dynamicPriceMap) && !empty($results->dynamicPriceMap)){echo 'block';}else{echo 'none';} ?>"><?php if(isset($results->dynamicPriceMap) && !empty($results->dynamicPriceMap)) { echo $results->dynamicPriceMap->max; } else { echo $results->maxPrice; } ?></div>
|
|
|
68 |
</div><!--filter-options -->
|
|
|
69 |
<?php foreach($results->facets as $facets){ ?>
|
|
|
70 |
<div class="filter-name"><?php if(isset($facets->displayText) && !empty($facets->displayText)) echo $facets->displayText;?><span>+</span></div>
|
|
|
71 |
<div class="filter-options" style="display:none" >
|
|
|
72 |
<?php $i=0;
|
|
|
73 |
foreach($facets->filterOptions as $filterOptions){ ?>
|
| 11269 |
lgm |
74 |
<div id="<?php echo $filterOptions->value;?>" <?php if(($filterOptions->value == 'Mobile Accessories') || ($filterOptions->value == 'Mobile Phone') || ($filterOptions->value == 'Cameras') || ($filterOptions->value == 'Tablets') || ($filterOptions->value == 'Laptop Accessories') || ($filterOptions->value == 'Smart Watches')){ ?> onclick="filterAccess('main',event)"<?php }else{ ?> onclick="filterAccess('brand',event)" <?php }?> data-parent="<?php echo $facets->displayText;?>" data-key="<?php echo $filterOptions->key; ?>" data-value="<?php echo $filterOptions->value; ?>"
|
| 10582 |
lgm |
75 |
<?php if($filterOptions->selected == 'true'){
|
|
|
76 |
$selectedFilters[$i] = $filterOptions->value; $i++;?>
|
|
|
77 |
class="opt selected" <?php } else{?> class="opt" <?php }?> >
|
|
|
78 |
<?php if(isset($filterOptions->nestedOptions) && !empty($filterOptions->nestedOptions)){ ?>
|
|
|
79 |
+
|
|
|
80 |
<?php }else{ ?>
|
|
|
81 |
□
|
|
|
82 |
<?php } ?>
|
|
|
83 |
<?php echo $filterOptions->value; ?>
|
|
|
84 |
<span>(<?php if($filterOptions->count != 1) echo $filterOptions->count." items"; else echo $filterOptions->count." item"; ?>)</span></div>
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
<?php if(isset($filterOptions->nestedOptions) && !empty($filterOptions->nestedOptions)){ ?>
|
|
|
88 |
<div class='sub-filter' <?php if($filterOptions->selected == 'true'){ ?>style='display:block' <?php } else {?> style="display:none"<?php } ?>>
|
|
|
89 |
<?php
|
|
|
90 |
foreach($filterOptions->nestedOptions as $nestedOptions){ ?>
|
|
|
91 |
<div data-key="<?php echo $nestedOptions->key; ?>" data-parent="<?php echo $filterOptions->value;?>" data-value="<?php echo $nestedOptions->value; ?>"
|
| 11344 |
lgm |
92 |
<?php if($nestedOptions->selected == 'true'){ ?> class="opt selected" <?php } else {?> class="opt" <?php } ?>
|
|
|
93 |
<?php if(($filterOptions->value == 'Mobile Accessories') || ($filterOptions->value == 'Mobile Phone') || ($filterOptions->value == 'Cameras') || ($filterOptions->value == 'Tablets') || ($filterOptions->value == 'Laptop Accessories') || ($filterOptions->value == 'Smart Watches')){ ?> onclick="filterAccess('sub',event)"<?php }else{ ?> onclick="filterAccess('brand',event)" <?php }?> >
|
| 10582 |
lgm |
94 |
□ <?php echo $nestedOptions->value;?>
|
|
|
95 |
<span>
|
|
|
96 |
(<?php if($nestedOptions->count != 1) echo $nestedOptions->count." items"; else echo $nestedOptions->count." item"; ?>)
|
|
|
97 |
</span>
|
|
|
98 |
</div>
|
|
|
99 |
<?php } ?>
|
|
|
100 |
</div>
|
|
|
101 |
<?php }
|
|
|
102 |
} ?>
|
|
|
103 |
|
|
|
104 |
</div>
|
|
|
105 |
<?php } ?>
|
|
|
106 |
<div class="filter-head clearfix">
|
|
|
107 |
<div class="clear" onclick="clearfilter(event)">Clear</div>
|
|
|
108 |
<div class="apply" onclick="applyFilter1(event)">Apply</div>
|
|
|
109 |
</div><!--btn-hldr-->
|
|
|
110 |
</div><!--filter-by-->
|
|
|
111 |
<div class="refine-mask" onclick="toggleRefine(event)"></div>
|
|
|
112 |
</div><!--filter-div-->
|
|
|
113 |
|
|
|
114 |
<div id="page" style="display:none">1</div>
|
|
|
115 |
<input type = "hidden" id="count" value="<?=$TotalPage?>"/>
|
|
|
116 |
<div id="appendlist" class="pd-list-hldr clearfix" >
|
| 13203 |
anikendra |
117 |
<?php foreach ($results->results as $result) {?>
|
| 10796 |
lgm |
118 |
<a class="pd-list" href="<?php echo base_url().$result->url;?>">
|
|
|
119 |
<div class="pd-image" style='background:url("<?php echo str_replace("'","'",$result->image_url);?>")no-repeat center center;background-size:contain;'></div>
|
| 13203 |
anikendra |
120 |
<?php if(!isset($result->dealprice) || empty($authorized['isPrivateDealUser'])):?>
|
| 10582 |
lgm |
121 |
<div class="pd-info">
|
|
|
122 |
<div class="pdt-name"><?php echo $result->title;?></div>
|
| 10796 |
lgm |
123 |
<div class="pdt-price">
|
|
|
124 |
<?php if(isset($result->price) || isset($result->mrp)){?>
|
|
|
125 |
<span class="pr">Rs</span>
|
|
|
126 |
<?php if(isset($result->mrp) && $result->mrp != 0){ echo "<span class='pr-linethrough'>".$result->mrp. "</span>"; } ?>
|
|
|
127 |
<?php if(isset($result->price) && $result->price != 0){?><span class="pr-original"><?php echo $result->price;?></span><?php }?>
|
|
|
128 |
<?php }?>
|
|
|
129 |
</div>
|
| 10582 |
lgm |
130 |
<div class="pdt-spec"><?php echo $result->description;?> </div>
|
|
|
131 |
</div>
|
| 13203 |
anikendra |
132 |
<?php elseif(isset($result->dealprice) && isset($authorized['isPrivateDealUser']) && !empty($authorized['isPrivateDealUser'])):?>
|
| 12188 |
anikendra |
133 |
<div class="pd-info">
|
|
|
134 |
<div class="pdt-name"><?php echo $result->title;?></div>
|
|
|
135 |
<div class="pdt-price">
|
|
|
136 |
<?php if(isset($result->price) || isset($result->mrp)){?>
|
|
|
137 |
<span class="pricetype">Site Price</span><span class="pr">Rs</span>
|
|
|
138 |
<?php if(isset($result->mrp) && $result->mrp != 0){ echo "<span class='pr-linethrough'>".$result->mrp. "</span>"; } ?>
|
|
|
139 |
<span class="pr-linethrough"><?php echo $result->price;?></span>
|
|
|
140 |
<?php }?>
|
|
|
141 |
</div>
|
| 13161 |
anikendra |
142 |
<?php if(isset($result->dealprice) && isset($authorized['isPrivateDealUser']) && !empty($authorized['isPrivateDealUser'])):?>
|
| 12188 |
anikendra |
143 |
<div class="pdt-price pdeal-price">
|
|
|
144 |
<span class="pricetype">Your Price</span><span class="pr">Rs</span> <span class="pr-original"><?php echo $result->dealprice;?></span>
|
|
|
145 |
</div>
|
|
|
146 |
<?php endif;?>
|
|
|
147 |
<?php if(isset($result->offer_text) && !empty($result->offer_text)):?>
|
|
|
148 |
<div class="pdt-offertext"><?php echo $result->offer_text ;?> </div>
|
|
|
149 |
<?php endif;?>
|
|
|
150 |
<div class="pdt-spec"><?php echo $result->description;?> </div>
|
|
|
151 |
<?php if(isset($result->dealColors) && !empty($result->dealColors) && $result->colorCount > 1 && trim($result->dealColors[0])!=''):?>
|
|
|
152 |
<?php if(sizeof($result->dealColors) < $result->colorCount):?>
|
|
|
153 |
<div class="pdt-offercolors">Offer available for : <?php echo implode(',',$result->dealColors);?></div>
|
|
|
154 |
<?php elseif(sizeof($result->dealColors) == $result->colorCount):?>
|
|
|
155 |
<div class="pdt-offercolors">Offer available on all colors</div>
|
|
|
156 |
<?php endif;?>
|
|
|
157 |
<?php endif;?>
|
|
|
158 |
</div>
|
|
|
159 |
<?php endif;?>
|
| 10582 |
lgm |
160 |
</a>
|
|
|
161 |
<?php } ?>
|
|
|
162 |
</div>
|
|
|
163 |
<div id="showmorebutton" class="load-more" style="display:none" onclick="showMore('<?php echo $_GET['q']?>');">Show More</div>
|
| 11456 |
lgm |
164 |
<?php } else { ?>
|
| 11441 |
lgm |
165 |
<div class="empty-list">
|
|
|
166 |
|
|
|
167 |
</div><!--empty-msg-->
|
|
|
168 |
<p class="empty-msg tcenter">No Products Found</p>
|
| 10582 |
lgm |
169 |
<?php } ?>
|
|
|
170 |
<script type="text/javascript">
|
|
|
171 |
var items = <?php echo json_encode($selectedFilters);?>
|
|
|
172 |
</script>
|
|
|
173 |
<script>
|
|
|
174 |
//max, min values for slider initialization
|
|
|
175 |
var max = document.getElementById("maxprice").innerHTML;
|
|
|
176 |
max = parseInt(max);
|
|
|
177 |
var min = document.getElementById("minprice").innerHTML;
|
|
|
178 |
min = parseInt(min);
|
|
|
179 |
var smin = document.getElementById("exTO").innerHTML
|
|
|
180 |
smin = parseInt(smin);
|
|
|
181 |
var smax = document.getElementById("exFR").innerHTML
|
|
|
182 |
smax = parseInt(smax);
|
|
|
183 |
// Run noUiSlider
|
|
|
184 |
|
| 11269 |
lgm |
185 |
$("#exTO").css({
|
|
|
186 |
left: 0 + '%'
|
|
|
187 |
});
|
|
|
188 |
$("#exFR").css({
|
|
|
189 |
left: 94 + '%'
|
|
|
190 |
})
|
| 10582 |
lgm |
191 |
|
| 11269 |
lgm |
192 |
|
| 10582 |
lgm |
193 |
$('.noUiSlider').noUiSlider({
|
|
|
194 |
set: function(){
|
|
|
195 |
var left = $($(".noUiSlider").find("a")[0]).offset().left;
|
|
|
196 |
var right = $($(".noUiSlider").find("a")[1]).offset().left;
|
|
|
197 |
var width = $(".noUiSlider").width();
|
|
|
198 |
|
|
|
199 |
|
|
|
200 |
$("#exTO").css({
|
|
|
201 |
left: ((left/width * 100) - 8 ) + '%'
|
|
|
202 |
});
|
|
|
203 |
$("#exFR").css({
|
| 11269 |
lgm |
204 |
left: ((right/width * 100) - 15 ) + '%'
|
| 10582 |
lgm |
205 |
});
|
|
|
206 |
},
|
|
|
207 |
range: [min, max],
|
|
|
208 |
start: [smin, smax],
|
|
|
209 |
step: 1,
|
|
|
210 |
handles: 2,
|
|
|
211 |
slide:function(){
|
|
|
212 |
var maxWidth = document.getElementsByClassName('filter-by')[0].clientWidth;
|
|
|
213 |
var value = $(this).val();
|
|
|
214 |
var from = value[0];
|
|
|
215 |
var to = value[1];
|
|
|
216 |
|
|
|
217 |
$("#exTO").text(value[0]);
|
|
|
218 |
$("#exFR").text(value[1]);
|
|
|
219 |
|
|
|
220 |
left = $($(".noUiSlider").find("a")[0]).offset().left;
|
|
|
221 |
right = $($(".noUiSlider").find("a")[1]).offset().left;
|
|
|
222 |
width = $(".noUiSlider").width();
|
|
|
223 |
|
|
|
224 |
if(left < 0){
|
|
|
225 |
left = 1;
|
|
|
226 |
}
|
|
|
227 |
|
|
|
228 |
if((right - left) > 70)
|
|
|
229 |
{
|
|
|
230 |
$("#exTO").css({
|
|
|
231 |
left: ((left/width * 100) - 8 ) + '%'
|
|
|
232 |
});
|
|
|
233 |
if(right < maxWidth){
|
|
|
234 |
$("#exFR").css({
|
| 11269 |
lgm |
235 |
left: ((right/width * 100) - 15 ) + '%'
|
| 10582 |
lgm |
236 |
})
|
|
|
237 |
}
|
|
|
238 |
}
|
|
|
239 |
}
|
|
|
240 |
|
|
|
241 |
});
|
| 11227 |
lgm |
242 |
|
|
|
243 |
var ominVal = document.getElementById('minprice').innerHTML;
|
|
|
244 |
var omaxVal = document.getElementById('maxprice').innerHTML;
|
|
|
245 |
var minVal = document.getElementById('exTO').innerHTML;
|
|
|
246 |
var maxVal = document.getElementById('exFR').innerHTML;
|
| 10582 |
lgm |
247 |
|
| 11269 |
lgm |
248 |
function filterAccess(el,e){
|
|
|
249 |
|
|
|
250 |
if(e.currentTarget.className.indexOf('selected') != -1){
|
|
|
251 |
e.currentTarget.className = event.toElement.className.replace('selected', '');
|
|
|
252 |
e.currentTarget.nextElementSibling.style.display = 'none'
|
| 10582 |
lgm |
253 |
return false;
|
|
|
254 |
}else{
|
| 11269 |
lgm |
255 |
e.currentTarget.className = e.currentTarget.className + ' selected';
|
| 10582 |
lgm |
256 |
}
|
| 11269 |
lgm |
257 |
var url1, sp = e.currentTarget.getAttribute('data-value').replace(' ','+');
|
| 10582 |
lgm |
258 |
if(el == 'main'){
|
| 11269 |
lgm |
259 |
url1 = window.location.href.split('&')[0]+'&fq='+e.currentTarget.getAttribute('data-key')+':'+sp;
|
| 10582 |
lgm |
260 |
}else if(el == 'brand'){
|
| 11269 |
lgm |
261 |
url1 = window.location.href +'&fq='+e.currentTarget.getAttribute('data-key')+':'+sp;
|
| 10582 |
lgm |
262 |
}else if(el == 'sub'){
|
|
|
263 |
eUrl = window.location.href;
|
|
|
264 |
if( (localStorage.getItem("prev") != null) && (eUrl.indexOf(localStorage.getItem('prev').replace(' ','+')) != -1) ){
|
|
|
265 |
url1 = eUrl.replace(localStorage.getItem('prev').replace(' ','+') , sp);
|
|
|
266 |
}else{
|
| 11269 |
lgm |
267 |
url1 = window.location.href +'&fq='+e.currentTarget.getAttribute('data-key')+':'+sp;
|
| 10582 |
lgm |
268 |
}
|
| 11269 |
lgm |
269 |
localStorage.setItem("prev", e.currentTarget.getAttribute('data-value') );
|
| 10582 |
lgm |
270 |
}else{
|
|
|
271 |
url1 = window.location.href
|
|
|
272 |
url1 = url1.split('&');
|
| 11269 |
lgm |
273 |
url1 = url1[0]+'&fq='+e.currentTarget.getAttribute('data-key')+':'+sp;
|
| 10582 |
lgm |
274 |
}
|
| 11227 |
lgm |
275 |
if((window.location.href.indexOf('minPrice') != -1) ){
|
|
|
276 |
if((url1.indexOf('minPrice') == -1)){
|
|
|
277 |
url1 = url1+'&minPrice='+document.getElementById('exTO').innerHTML+'&maxPrice='+document.getElementById('exFR').innerHTML;
|
|
|
278 |
}
|
|
|
279 |
}
|
|
|
280 |
|
| 10582 |
lgm |
281 |
window.location.assign(url1);
|
| 11269 |
lgm |
282 |
e.stopPropagation();
|
| 10582 |
lgm |
283 |
|
|
|
284 |
}
|
| 11227 |
lgm |
285 |
|
|
|
286 |
|
| 11312 |
lgm |
287 |
function applyFilter1(e){
|
| 11227 |
lgm |
288 |
|
|
|
289 |
var ominVal = document.getElementById('minprice').innerHTML;
|
|
|
290 |
var omaxVal = document.getElementById('maxprice').innerHTML;
|
|
|
291 |
var minVal = document.getElementById('exTO').innerHTML;
|
|
|
292 |
var maxVal = document.getElementById('exFR').innerHTML;
|
|
|
293 |
var url1;
|
|
|
294 |
if(window.location.href.indexOf('minPrice') != -1){
|
|
|
295 |
if((<?php echo $results->minPrice; ?> != minVal) || (<?php echo $results->maxPrice; ?> !=maxVal)){
|
|
|
296 |
url1 = window.location.href.replace(<?php echo $results->minPrice; ?>,document.getElementById('exTO').innerHTML);
|
|
|
297 |
url1 = url1.replace(<?php echo $results->maxPrice; ?>,document.getElementById('exFR').innerHTML);
|
| 11312 |
lgm |
298 |
}else{
|
|
|
299 |
return false;
|
| 11227 |
lgm |
300 |
}
|
|
|
301 |
}else{
|
|
|
302 |
url1 = window.location.href+'&minPrice='+document.getElementById('exTO').innerHTML+'&maxPrice='+document.getElementById('exFR').innerHTML;
|
|
|
303 |
}
|
|
|
304 |
window.location.assign(url1);
|
| 11312 |
lgm |
305 |
e.stopPropagation();
|
| 10582 |
lgm |
306 |
}
|
| 11227 |
lgm |
307 |
|
| 11344 |
lgm |
308 |
</script>
|
|
|
309 |
|
|
|
310 |
|