| 18065 |
naman |
1 |
<script>
|
|
|
2 |
$(document).ready(function(){
|
| 18075 |
naman |
3 |
var statepushed = false;
|
|
|
4 |
if($("#searchforbrand").length != 0 ) {
|
|
|
5 |
if (window.history && window.history.pushState) {
|
|
|
6 |
|
|
|
7 |
$(window).on('popstate', function() {
|
|
|
8 |
$('#searchforbrand').val("");
|
|
|
9 |
$("#regularcontent").removeClass('hidden');
|
|
|
10 |
$("#searchedcontent").addClass('hidden');
|
|
|
11 |
|
|
|
12 |
statepushed = false;
|
|
|
13 |
});
|
|
|
14 |
|
|
|
15 |
}
|
|
|
16 |
}
|
| 18124 |
amit.gupta |
17 |
trigger = false;
|
| 18076 |
naman |
18 |
var footertop = $(window).height();
|
|
|
19 |
setInterval(function() {
|
|
|
20 |
if(parseInt(footertop)!=parseInt($(window).height())){
|
|
|
21 |
$("div.pmfooter").hide();
|
|
|
22 |
}else{
|
|
|
23 |
$("div.pmfooter").show();
|
|
|
24 |
}
|
|
|
25 |
},100);
|
|
|
26 |
|
| 18065 |
naman |
27 |
var new_msg="";
|
|
|
28 |
var typingTimer;
|
|
|
29 |
var doneTypingInterval = 1000;
|
| 18115 |
amit.gupta |
30 |
$('#searchforbrand').keyup(function(e){
|
| 18123 |
amit.gupta |
31 |
var keycode = e.keyCode || e.which;
|
| 18115 |
amit.gupta |
32 |
//dont do anything if invalid key has been pressed.
|
| 18123 |
amit.gupta |
33 |
var valid =
|
|
|
34 |
(keycode > 47 && keycode < 58) || // number keys
|
|
|
35 |
keycode == 32 || keycode == 13 || // spacebar & return key(s) (if you want to allow carriage returns)
|
|
|
36 |
(keycode > 64 && keycode < 91) || // letter keys
|
|
|
37 |
(keycode > 95 && keycode < 112) || // numpad keys
|
|
|
38 |
(keycode > 185 && keycode < 193) || // ;=,-./` (in order)
|
|
|
39 |
(keycode > 218 && keycode < 223) ||
|
|
|
40 |
keycode==8 || keycode == 0 || keycode==229;
|
|
|
41 |
if(!valid){
|
| 18115 |
amit.gupta |
42 |
return;
|
|
|
43 |
}
|
| 18065 |
naman |
44 |
clearTimeout(typingTimer);
|
| 18115 |
amit.gupta |
45 |
|
| 18065 |
naman |
46 |
var s ="";
|
|
|
47 |
s = encodeURIComponent($(this).val().trim());
|
| 18115 |
amit.gupta |
48 |
if(s.length > 0 && $('#searchforbrand').val()!= "") {
|
|
|
49 |
if(!statepushed) {
|
|
|
50 |
if (window.history && window.history.pushState) {
|
|
|
51 |
window.history.pushState('forward', null, './6');
|
|
|
52 |
statepushed = true;
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
if ($('#searchforbrand').val) {
|
|
|
57 |
typingTimer = setTimeout(function doneTyping(){
|
|
|
58 |
$("#searchloader").removeClass('hidden');
|
|
|
59 |
// $("#regularcontent").addClass('hidden');
|
|
|
60 |
// $("#searchedcontent").addClass('hidden');
|
|
|
61 |
$.ajax({
|
|
|
62 |
method: "GET",
|
|
|
63 |
url: "<?php echo $base_url;?>categories/getdealsforsearchterm/"+s,
|
|
|
64 |
},'json')
|
|
|
65 |
.done(function(msg){
|
| 18124 |
amit.gupta |
66 |
if( c != typingTimer)
|
|
|
67 |
return;
|
| 18115 |
amit.gupta |
68 |
$("#popovertrigger5").popover('hide').remove();
|
|
|
69 |
var cart_details = localStorage.getItem("cart_details");
|
|
|
70 |
if(cart_details!=undefined){
|
|
|
71 |
var cartDetailsObj = JSON.parse(cart_details);
|
|
|
72 |
if(cartDetailsObj.totalCartQuantity > 0){
|
|
|
73 |
var totalCartValue = cartDetailsObj.totalCartValue;
|
|
|
74 |
var priceChangeMap = {};
|
|
|
75 |
$.each(cartDetailsObj.cartItems, function(key,val) {
|
|
|
76 |
var newUnitPrice = $(msg).find("div.number-spinner button[data-id='"+key+"']").data('price');
|
|
|
77 |
if(newUnitPrice!=null){
|
|
|
78 |
$(msg).find("div.number-spinner button[data-id='"+key+"']").closest('.number-spinner').find('input').val(val.quantity);
|
|
|
79 |
if(parseInt(newUnitPrice)!=parseInt(val.unitprice)){
|
|
|
80 |
totalCartValue = totalCartValue - (parseInt(val.unitprice)*parseInt(val.quantity)) + (parseInt(newUnitPrice)*parseInt(val.quantity));
|
|
|
81 |
priceChangeMap[key] = newUnitPrice;
|
| 18065 |
naman |
82 |
}
|
|
|
83 |
}
|
| 18115 |
amit.gupta |
84 |
});
|
|
|
85 |
if(totalCartValue!=undefined){
|
|
|
86 |
cartDetailsObj.totalCartValue = totalCartValue;
|
| 18065 |
naman |
87 |
}
|
| 18115 |
amit.gupta |
88 |
var cartItems = cartDetailsObj.cartItems;
|
|
|
89 |
$.each(priceChangeMap, function(key,val) {
|
|
|
90 |
cartItems[key].unitprice = val;
|
|
|
91 |
});
|
|
|
92 |
cartDetailsObj.cartItems = cartItems;
|
|
|
93 |
localStorage.setItem('cart_details',JSON.stringify(cartDetailsObj));
|
| 18065 |
naman |
94 |
}
|
| 18115 |
amit.gupta |
95 |
}
|
|
|
96 |
$("#searchedcontent").empty();
|
|
|
97 |
$("#searchedcontent").html('<div class="row scroll cscrollselector">'+msg+'</div>');
|
|
|
98 |
if($('.cscrollselector > .card').length>0) {
|
|
|
99 |
setTimeout(function(){ document.location.reload(); }, 1000*15*60);
|
|
|
100 |
if(typeof noscrolling == 'undefined') {
|
|
|
101 |
|
|
|
102 |
$('#searchedcontent').find('.cscrollselector').jscroll({
|
|
|
103 |
loadingHtml: '<center><img src="/img/ajax-loader.gif" alt="Loading" /></center>',
|
|
|
104 |
autoTriggerUntil: 3,
|
|
|
105 |
padding: 20,
|
|
|
106 |
callback:loadCartDetails
|
|
|
107 |
});
|
| 18065 |
naman |
108 |
|
| 18115 |
amit.gupta |
109 |
}
|
|
|
110 |
}
|
| 18065 |
naman |
111 |
|
|
|
112 |
|
|
|
113 |
|
| 18115 |
amit.gupta |
114 |
$("#regularcontent").addClass('hidden');
|
|
|
115 |
$("#searchloader").addClass('hidden');
|
|
|
116 |
// $("#regularcontent").addClass('hidden');
|
|
|
117 |
$("#searchedcontent").removeClass('hidden');
|
|
|
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>');
|
|
|
119 |
setPopOver("popovertrigger5", ".plusqtybutton", 'click');
|
|
|
120 |
});
|
|
|
121 |
}, doneTypingInterval);
|
| 18124 |
amit.gupta |
122 |
c = typingTimer;
|
| 18115 |
amit.gupta |
123 |
}
|
| 18065 |
naman |
124 |
}
|
|
|
125 |
else
|
|
|
126 |
{
|
| 18125 |
amit.gupta |
127 |
c = typingTimer;
|
| 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');
|
| 18075 |
naman |
133 |
if(statepushed){
|
|
|
134 |
window.history.back();
|
|
|
135 |
}
|
|
|
136 |
statepushed = false;
|
| 18122 |
amit.gupta |
137 |
$(':focus').blur();
|
| 18075 |
naman |
138 |
|
| 18065 |
naman |
139 |
}
|
|
|
140 |
});
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
|
144 |
});
|
|
|
145 |
|
|
|
146 |
</script>
|
|
|
147 |
<style>
|
|
|
148 |
#searchloader{
|
|
|
149 |
position:absolute;
|
|
|
150 |
/*top:40%;*/
|
|
|
151 |
left:50%;
|
|
|
152 |
z-index:2001;
|
|
|
153 |
}
|
|
|
154 |
.black_overlay{
|
|
|
155 |
/*display: none;*/
|
|
|
156 |
position: absolute;
|
|
|
157 |
top: 0%;
|
|
|
158 |
left: 0%;
|
|
|
159 |
width: 100%;
|
|
|
160 |
height: 100%;
|
|
|
161 |
background-color: black;
|
|
|
162 |
z-index:2000;
|
|
|
163 |
-moz-opacity: 0.8;
|
|
|
164 |
opacity:.80;
|
|
|
165 |
filter: alpha(opacity=80);
|
|
|
166 |
}
|
|
|
167 |
#moreitem{
|
|
|
168 |
margin: 2px auto;
|
|
|
169 |
height: 30px;
|
|
|
170 |
color: #555;
|
|
|
171 |
background-color: #f5f5f5;
|
|
|
172 |
padding:4px;
|
|
|
173 |
}
|
| 18076 |
naman |
174 |
.inner-addon .glyphicon {
|
|
|
175 |
position: absolute;
|
| 18115 |
amit.gupta |
176 |
padding: 13px;
|
| 18076 |
naman |
177 |
pointer-events: none;
|
|
|
178 |
}
|
|
|
179 |
.left-addon .glyphicon { left: 0px;}
|
| 18115 |
amit.gupta |
180 |
.left-addon input { padding:5px 6px 3px 36px; }
|
| 18065 |
naman |
181 |
</style>
|
|
|
182 |
|
|
|
183 |
<?php //echo strtok($_SERVER["REQUEST_URI"],'?');?>
|
|
|
184 |
<?php if(isset($searchfor) && !empty($searchfor)):?>
|
|
|
185 |
<div id= "moreitem">
|
|
|
186 |
<a href="<?php echo $_SERVER['HTTP_REFERER'];?>"><span class="glyphicon glyphicon-arrow-left"></span></a> Search result for <?php echo $searchfor;?> items.
|
|
|
187 |
</div>
|
|
|
188 |
<?php endif;?>
|
| 18115 |
amit.gupta |
189 |
<?php if($id==6 && isset($subcategorieschosen) && in_array($_COOKIE['subcategorieschosen'], $searchableSubCategories)):?>
|
| 18076 |
naman |
190 |
<div class= "inner-addon left-addon" style='padding-top:5px;position: relative;'>
|
|
|
191 |
<i class="glyphicon glyphicon-search"></i>
|
|
|
192 |
<input type="text" id= "searchforbrand" placeholder="Search brands or models" style = "width:100%;" class="input-block-level">
|
| 18065 |
naman |
193 |
</div>
|
|
|
194 |
<?php endif;?>
|
|
|
195 |
|
|
|
196 |
|
|
|
197 |
<div class="text-center hidden" id="searchloader">
|
|
|
198 |
<br><br><br><br>
|
|
|
199 |
<div class="hexdots-loader"></div>
|
|
|
200 |
</div>
|
|
|
201 |
<div class='content hidden' id='searchedcontent'>
|
|
|
202 |
|
|
|
203 |
</div>
|
|
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
|
207 |
<div class="content" id="regularcontent">
|
|
|
208 |
|
| 18115 |
amit.gupta |
209 |
<div class="row scroll scrollselector">
|
| 13718 |
anikendra |
210 |
<?php echo $this->element('deals');?>
|
| 13579 |
anikendra |
211 |
</div>
|
| 13532 |
anikendra |
212 |
</div>
|
| 18065 |
naman |
213 |
|
| 18068 |
naman |
214 |
<!-- <script type="text/javascript" src="/js/jquery.jscroll.js"></script> -->
|
|
|
215 |
<script type="text/javascript" src="/js/jquery.jscroll.min.js"></script>
|
| 17766 |
manish.sha |
216 |
<script type="text/javascript" src="/js/profittill.js?v=<?php echo $staticversion;?>"></script>
|
| 18065 |
naman |
217 |
<script type="text/javascript" src="/js/checkout.js?v=<?php echo $staticversion;?>"></script>
|
|
|
218 |
<link rel="stylesheet" href="http://css-spinners.com/css/spinner/hexdots.css" type="text/css">
|
|
|
219 |
|
|
|
220 |
|
|
|
221 |
|