| 18065 |
naman |
1 |
<script>
|
|
|
2 |
$(document).ready(function(){
|
| 18149 |
amit.gupta |
3 |
setTimeout(function(){
|
|
|
4 |
$('#searchforbrand').css({'background-color':'orange'});
|
| 18205 |
amit.gupta |
5 |
setTimeout(function(){$('#searchforbrand').css({'background-color':''})}, 1500);
|
| 18149 |
amit.gupta |
6 |
}, 1000);
|
| 18145 |
amit.gupta |
7 |
|
| 18075 |
naman |
8 |
var statepushed = false;
|
|
|
9 |
if($("#searchforbrand").length != 0 ) {
|
|
|
10 |
if (window.history && window.history.pushState) {
|
|
|
11 |
|
|
|
12 |
$(window).on('popstate', function() {
|
|
|
13 |
$('#searchforbrand').val("");
|
|
|
14 |
$("#regularcontent").removeClass('hidden');
|
|
|
15 |
$("#searchedcontent").addClass('hidden');
|
|
|
16 |
|
|
|
17 |
statepushed = false;
|
|
|
18 |
});
|
|
|
19 |
|
|
|
20 |
}
|
|
|
21 |
}
|
| 18241 |
naman |
22 |
trigger = false;
|
| 18076 |
naman |
23 |
var footertop = $(window).height();
|
|
|
24 |
setInterval(function() {
|
|
|
25 |
if(parseInt(footertop)!=parseInt($(window).height())){
|
|
|
26 |
$("div.pmfooter").hide();
|
|
|
27 |
}else{
|
|
|
28 |
$("div.pmfooter").show();
|
|
|
29 |
}
|
|
|
30 |
},100);
|
|
|
31 |
|
| 18065 |
naman |
32 |
var new_msg="";
|
|
|
33 |
var typingTimer;
|
|
|
34 |
var doneTypingInterval = 1000;
|
| 18115 |
amit.gupta |
35 |
$('#searchforbrand').keyup(function(e){
|
| 18241 |
naman |
36 |
var keycode = e.keyCode || e.which;
|
|
|
37 |
//dont do anything if invalid key has been pressed.
|
|
|
38 |
var valid =
|
|
|
39 |
(keycode > 47 && keycode < 58) || // number keys
|
|
|
40 |
keycode == 32 || keycode == 13 || // spacebar & return key(s) (if you want to allow carriage returns)
|
|
|
41 |
(keycode > 64 && keycode < 91) || // letter keys
|
|
|
42 |
(keycode > 95 && keycode < 112) || // numpad keys
|
|
|
43 |
(keycode > 185 && keycode < 193) || // ;=,-./` (in order)
|
|
|
44 |
(keycode > 218 && keycode < 223) ||
|
|
|
45 |
keycode==8 || keycode == 0 || keycode==229;
|
|
|
46 |
if(!valid){
|
|
|
47 |
return;
|
|
|
48 |
}
|
| 18065 |
naman |
49 |
clearTimeout(typingTimer);
|
| 18115 |
amit.gupta |
50 |
|
| 18065 |
naman |
51 |
var s ="";
|
|
|
52 |
s = encodeURIComponent($(this).val().trim());
|
| 18115 |
amit.gupta |
53 |
if(s.length > 0 && $('#searchforbrand').val()!= "") {
|
| 18241 |
naman |
54 |
if(!statepushed) {
|
|
|
55 |
if (window.history && window.history.pushState) {
|
| 18387 |
naman |
56 |
window.history.pushState('forward', null, window.location);
|
| 18241 |
naman |
57 |
statepushed = true;
|
|
|
58 |
}
|
|
|
59 |
}
|
| 18115 |
amit.gupta |
60 |
|
|
|
61 |
if ($('#searchforbrand').val) {
|
|
|
62 |
typingTimer = setTimeout(function doneTyping(){
|
|
|
63 |
$("#searchloader").removeClass('hidden');
|
|
|
64 |
$.ajax({
|
|
|
65 |
method: "GET",
|
| 18387 |
naman |
66 |
url: "<?php echo $base_url;?>categories/getdealsforsearchterm/"+s + "?subcategories="+getJsonFromUrl()["subcategories"],
|
| 18115 |
amit.gupta |
67 |
},'json')
|
|
|
68 |
.done(function(msg){
|
| 18129 |
amit.gupta |
69 |
if( c != typingTimer) {
|
|
|
70 |
$("#searchloader").addClass('hidden');
|
| 18124 |
amit.gupta |
71 |
return;
|
| 18129 |
amit.gupta |
72 |
}
|
| 18205 |
amit.gupta |
73 |
$(window).one('scroll', function(){
|
|
|
74 |
$("#searchforbrand").blur();
|
|
|
75 |
});
|
| 18115 |
amit.gupta |
76 |
$("#popovertrigger5").popover('hide').remove();
|
|
|
77 |
var cart_details = localStorage.getItem("cart_details");
|
|
|
78 |
if(cart_details!=undefined){
|
|
|
79 |
var cartDetailsObj = JSON.parse(cart_details);
|
|
|
80 |
if(cartDetailsObj.totalCartQuantity > 0){
|
|
|
81 |
var totalCartValue = cartDetailsObj.totalCartValue;
|
|
|
82 |
var priceChangeMap = {};
|
|
|
83 |
$.each(cartDetailsObj.cartItems, function(key,val) {
|
|
|
84 |
var newUnitPrice = $(msg).find("div.number-spinner button[data-id='"+key+"']").data('price');
|
|
|
85 |
if(newUnitPrice!=null){
|
|
|
86 |
$(msg).find("div.number-spinner button[data-id='"+key+"']").closest('.number-spinner').find('input').val(val.quantity);
|
|
|
87 |
if(parseInt(newUnitPrice)!=parseInt(val.unitprice)){
|
|
|
88 |
totalCartValue = totalCartValue - (parseInt(val.unitprice)*parseInt(val.quantity)) + (parseInt(newUnitPrice)*parseInt(val.quantity));
|
|
|
89 |
priceChangeMap[key] = newUnitPrice;
|
| 18065 |
naman |
90 |
}
|
|
|
91 |
}
|
| 18115 |
amit.gupta |
92 |
});
|
|
|
93 |
if(totalCartValue!=undefined){
|
|
|
94 |
cartDetailsObj.totalCartValue = totalCartValue;
|
| 18065 |
naman |
95 |
}
|
| 18115 |
amit.gupta |
96 |
var cartItems = cartDetailsObj.cartItems;
|
|
|
97 |
$.each(priceChangeMap, function(key,val) {
|
|
|
98 |
cartItems[key].unitprice = val;
|
|
|
99 |
});
|
|
|
100 |
cartDetailsObj.cartItems = cartItems;
|
|
|
101 |
localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
|
| 18065 |
naman |
102 |
}
|
| 18115 |
amit.gupta |
103 |
}
|
| 18145 |
amit.gupta |
104 |
$("#regularcontent").addClass('hidden');
|
|
|
105 |
$("#searchloader").addClass('hidden');
|
| 18115 |
amit.gupta |
106 |
$("#searchedcontent").html('<div class="row scroll cscrollselector">'+msg+'</div>');
|
| 18145 |
amit.gupta |
107 |
$("#searchedcontent").removeClass('hidden');
|
| 18115 |
amit.gupta |
108 |
if($('.cscrollselector > .card').length>0) {
|
|
|
109 |
if(typeof noscrolling == 'undefined') {
|
|
|
110 |
$('#searchedcontent').find('.cscrollselector').jscroll({
|
|
|
111 |
loadingHtml: '<center><img src="/img/ajax-loader.gif" alt="Loading" /></center>',
|
|
|
112 |
autoTriggerUntil: 3,
|
|
|
113 |
padding: 20,
|
|
|
114 |
callback:loadCartDetails
|
|
|
115 |
});
|
|
|
116 |
}
|
|
|
117 |
}
|
|
|
118 |
$('.data-up:visible:first').append('<a id="popovertrigger5" data-container="body" data-toggle="popover" data-placement="left" data-content="Quick buy multiple items together"></a>');
|
| 18241 |
naman |
119 |
setPopOver("popovertrigger5", ".plusqtybutton", 'click');
|
| 18115 |
amit.gupta |
120 |
});
|
|
|
121 |
}, doneTypingInterval);
|
| 18124 |
amit.gupta |
122 |
c = typingTimer;
|
| 18115 |
amit.gupta |
123 |
}
|
| 18065 |
naman |
124 |
}
|
|
|
125 |
else
|
|
|
126 |
{
|
| 18241 |
naman |
127 |
c = 0;
|
| 18065 |
naman |
128 |
$("#regularcontent").removeClass('hidden');
|
|
|
129 |
$("#searchedcontent").addClass('hidden');
|
| 18115 |
amit.gupta |
130 |
$('#popovertrigger5').popover('hide').remove();
|
|
|
131 |
$('.data-up:visible:first').append('<a id="popovertrigger5" data-container="body" data-toggle="popover" data-placement="left" data-content="Quick buy multiple items together"></a>');
|
|
|
132 |
setPopOver("popovertrigger5", ".plusqtybutton", 'click');
|
| 18145 |
amit.gupta |
133 |
$('.scrollselector').jscrollobj({
|
| 18241 |
naman |
134 |
loadingHtml: '<center><img src="/img/ajax-loader.gif" alt="Loading" /></center>',
|
|
|
135 |
autoTriggerUntil: 3,
|
|
|
136 |
padding: 20,
|
|
|
137 |
callback:loadCartDetails
|
|
|
138 |
});
|
| 18075 |
naman |
139 |
if(statepushed){
|
| 18241 |
naman |
140 |
statepushed = false;
|
| 18075 |
naman |
141 |
window.history.back();
|
|
|
142 |
}
|
| 18065 |
naman |
143 |
}
|
|
|
144 |
});
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
});
|
|
|
149 |
|
|
|
150 |
</script>
|
|
|
151 |
<style>
|
| 18145 |
amit.gupta |
152 |
|
|
|
153 |
.shadow {
|
|
|
154 |
-webkit-box-shadow: 0px 0px 12px 4px #ffffff;
|
|
|
155 |
-moz-box-shadow: 0px 0px 12px 4px #ffffff;
|
|
|
156 |
box-shadow: 0px 0px 12px 4px #ffffff;
|
|
|
157 |
-webkit-transition: all 0.5s linear;
|
|
|
158 |
-o-transition: all 0.5s linear;
|
|
|
159 |
-moz-transition: all 0.5s linear;
|
|
|
160 |
-ms-transition: all 0.5s linear;
|
|
|
161 |
-kthtml-transition: all 0.5s linear;
|
|
|
162 |
transition: all 0.5s linear;
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
#searchforbrand {
|
|
|
166 |
width: 100%;
|
|
|
167 |
-webkit-transition: all 0.5s linear;
|
|
|
168 |
-o-transition: all 0.5s linear;
|
|
|
169 |
-moz-transition: all 0.5s linear;
|
|
|
170 |
-ms-transition: all 0.5s linear;
|
|
|
171 |
-kthtml-transition: all 0.5s linear;
|
|
|
172 |
transition: all 0.5s linear;
|
|
|
173 |
}
|
|
|
174 |
|
| 18065 |
naman |
175 |
#searchloader{
|
|
|
176 |
position:absolute;
|
|
|
177 |
/*top:40%;*/
|
|
|
178 |
left:50%;
|
|
|
179 |
z-index:2001;
|
|
|
180 |
}
|
|
|
181 |
.black_overlay{
|
|
|
182 |
/*display: none;*/
|
|
|
183 |
position: absolute;
|
|
|
184 |
top: 0%;
|
|
|
185 |
left: 0%;
|
|
|
186 |
width: 100%;
|
|
|
187 |
height: 100%;
|
|
|
188 |
background-color: black;
|
|
|
189 |
z-index:2000;
|
|
|
190 |
-moz-opacity: 0.8;
|
|
|
191 |
opacity:.80;
|
|
|
192 |
filter: alpha(opacity=80);
|
|
|
193 |
}
|
|
|
194 |
#moreitem{
|
|
|
195 |
margin: 2px auto;
|
|
|
196 |
height: 30px;
|
|
|
197 |
color: #555;
|
|
|
198 |
background-color: #f5f5f5;
|
|
|
199 |
padding:4px;
|
|
|
200 |
}
|
| 18076 |
naman |
201 |
.inner-addon .glyphicon {
|
|
|
202 |
position: absolute;
|
| 18115 |
amit.gupta |
203 |
padding: 13px;
|
| 18076 |
naman |
204 |
pointer-events: none;
|
|
|
205 |
}
|
|
|
206 |
.left-addon .glyphicon { left: 0px;}
|
| 18115 |
amit.gupta |
207 |
.left-addon input { padding:5px 6px 3px 36px; }
|
| 18065 |
naman |
208 |
</style>
|
| 18241 |
naman |
209 |
<?php if($id==6):?>
|
| 18439 |
naman |
210 |
<div style="background:#58d936;text-align: center;width:100%;font-size:12px;padding:5px 1px 1px 1px;">
|
| 18243 |
naman |
211 |
<a href= "<?php echo $base_url."abouts/returnpolicy";?>" style="color:#E9292A;"><strong><u>EASY RETURNS, FREE REPLACEMENT : </strong>
|
| 18241 |
naman |
212 |
See detail</a>
|
| 18443 |
naman |
213 |
<br>
|
|
|
214 |
<a href= "<?php echo $base_url."abouts/shippingpolicy";?>" style="color:#E9292A;"><strong><u>FREE SHIPPINGS : </strong>
|
|
|
215 |
See how</a>
|
| 18241 |
naman |
216 |
</div>
|
| 18443 |
naman |
217 |
|
| 18241 |
naman |
218 |
<?php endif;?>
|
| 18065 |
naman |
219 |
<?php //echo strtok($_SERVER["REQUEST_URI"],'?');?>
|
| 18241 |
naman |
220 |
|
| 18409 |
amit.gupta |
221 |
<?php if($id==6 && $subcategories && array_key_exists($subcategories, $searchableSubCategories)):?>
|
| 18184 |
amit.gupta |
222 |
<div id= "moreitem">
|
| 18387 |
naman |
223 |
<a onclick="clearFilters()" href="<?php echo $_SERVER['HTTP_REFERER'];?>"><span style="padding:3px" class="glyphicon glyphicon-arrow-left"></span>Showing <?php echo $searchableSubCategories[$subcategories];?></a>
|
| 18184 |
amit.gupta |
224 |
</div>
|
| 18076 |
naman |
225 |
<div class= "inner-addon left-addon" style='padding-top:5px;position: relative;'>
|
|
|
226 |
<i class="glyphicon glyphicon-search"></i>
|
| 18145 |
amit.gupta |
227 |
<input type="text" id= "searchforbrand" placeholder="Search brands or models" class="input-block-level">
|
| 18065 |
naman |
228 |
</div>
|
| 18408 |
amit.gupta |
229 |
<?php elseif(isset($searchfor) && !empty($searchfor)):?>
|
|
|
230 |
<div id= "moreitem">
|
|
|
231 |
<a href="<?php echo $_SERVER['HTTP_REFERER'];?>"><span style="padding:3px" class="glyphicon glyphicon-arrow-left"></span>Showing <?php echo $searchfor;?> items</a>
|
|
|
232 |
</div>
|
| 18065 |
naman |
233 |
<?php endif;?>
|
|
|
234 |
|
|
|
235 |
|
|
|
236 |
<div class="text-center hidden" id="searchloader">
|
|
|
237 |
<br><br><br><br>
|
|
|
238 |
<div class="hexdots-loader"></div>
|
|
|
239 |
</div>
|
|
|
240 |
|
|
|
241 |
|
|
|
242 |
|
|
|
243 |
<div class="content" id="regularcontent">
|
|
|
244 |
|
| 18115 |
amit.gupta |
245 |
<div class="row scroll scrollselector">
|
| 19244 |
amit.gupta |
246 |
<?php echo $this->element('deals');?>
|
|
|
247 |
</div>
|
|
|
248 |
<script type="text/javascript">
|
|
|
249 |
function getCookie(cname,forceCookie) {
|
|
|
250 |
if(typeof(Storage) !== "undefined" && !forceCookie) {
|
|
|
251 |
return localStorage.getItem(cname);
|
|
|
252 |
} else {
|
|
|
253 |
var name = cname + "=";
|
|
|
254 |
var ca = document.cookie.split(';');
|
|
|
255 |
for(var i=0; i<ca.length; i++) {
|
|
|
256 |
var c = ca[i];
|
|
|
257 |
while (c.charAt(0)==' ') c = c.substring(1);
|
|
|
258 |
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
|
|
|
259 |
}
|
|
|
260 |
return "";
|
|
|
261 |
}
|
|
|
262 |
}
|
|
|
263 |
if(getCookie('fresh', true)=="0"){
|
|
|
264 |
if(typeof localStorage.pages != "undefined") {
|
|
|
265 |
document.getElementsByClassName('scrollselector')[0].innerHTML = localStorage.pages;
|
|
|
266 |
localStorage.pages = undefined;
|
|
|
267 |
}
|
|
|
268 |
}
|
|
|
269 |
</script>
|
|
|
270 |
|
| 13532 |
anikendra |
271 |
</div>
|
| 18145 |
amit.gupta |
272 |
|
|
|
273 |
<div class='content hidden' id='searchedcontent'>
|
| 18065 |
naman |
274 |
|
| 18145 |
amit.gupta |
275 |
</div>
|
|
|
276 |
|
| 18068 |
naman |
277 |
<!-- <script type="text/javascript" src="/js/jquery.jscroll.js"></script> -->
|
| 18146 |
amit.gupta |
278 |
<script type="text/javascript" src="/js/jquery.jscroll.min.js?v=<?php echo $staticversion;?>"></script>
|
| 17766 |
manish.sha |
279 |
<script type="text/javascript" src="/js/profittill.js?v=<?php echo $staticversion;?>"></script>
|
| 18065 |
naman |
280 |
<script type="text/javascript" src="/js/checkout.js?v=<?php echo $staticversion;?>"></script>
|
| 18145 |
amit.gupta |
281 |
<link rel="stylesheet" href="/css/hexdots.css" type="text/css">
|
| 18065 |
naman |
282 |
|
|
|
283 |
|
|
|
284 |
|
| 18443 |
naman |
285 |
|