Subversion Repositories SmartDukaan

Rev

Rev 11227 | Rev 11312 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11227 Rev 11269
Line 53... Line 53...
53
            <div class="clear" onclick="clearfilter(event)">Clear</div>
53
            <div class="clear" onclick="clearfilter(event)">Clear</div>
54
            <div class="apply" onclick="applyFilter1(event)">Apply</div>
54
            <div class="apply" onclick="applyFilter1(event)">Apply</div>
55
          </div><!--btn-hldr-->
55
          </div><!--btn-hldr-->
56
           <div class="filter-name">Price(Rs.)<span>+</span></div>
56
           <div class="filter-name">Price(Rs.)<span>+</span></div>
57
          <div class="filter-options clearfix" style="display:none" >
57
          <div class="filter-options clearfix" style="display:none" >
58
          <div style="position:relative; height:40px; width: 87%;padding:10px;box-sizing: border-box;-webkit-box-sizing: border-box;">
58
          <div style="position:relative; height:40px;padding:10px;box-sizing: border-box;-webkit-box-sizing: border-box;width: 85%;left: 6%;">
59
            <span id="exTO" class="slider-input"><?php echo $results->minPrice; ?></span>
59
            <span id="exTO" class="slider-input"><?php echo $results->minPrice; ?></span>
60
            <span id="exFR" class="slider-input"><?php echo $results->maxPrice; ?></span>
60
            <span id="exFR" class="slider-input"><?php echo $results->maxPrice; ?></span>
61
          </div>
61
          </div>
62
          <div class="clear"></div>
62
          <div class="clear"></div>
63
          
63
          
Line 68... Line 68...
68
          <?php foreach($results->facets as $facets){ ?>
68
          <?php foreach($results->facets as $facets){ ?>
69
          <div class="filter-name"><?php if(isset($facets->displayText) && !empty($facets->displayText)) echo $facets->displayText;?><span>+</span></div>
69
          <div class="filter-name"><?php if(isset($facets->displayText) && !empty($facets->displayText)) echo $facets->displayText;?><span>+</span></div>
70
          <div class="filter-options" style="display:none" >
70
          <div class="filter-options" style="display:none" >
71
          <?php $i=0;
71
          <?php $i=0;
72
          foreach($facets->filterOptions as $filterOptions){ ?>
72
          foreach($facets->filterOptions as $filterOptions){ ?>
73
            <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')"<?php }else{ ?> onclick="filterAccess('brand')" <?php }?> data-parent="<?php echo $facets->displayText;?>" data-key="<?php echo $filterOptions->key; ?>" data-value="<?php echo $filterOptions->value; ?>" 
73
            <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; ?>" 
74
              <?php if($filterOptions->selected == 'true'){ 
74
              <?php if($filterOptions->selected == 'true'){ 
75
                $selectedFilters[$i] = $filterOptions->value; $i++;?> 
75
                $selectedFilters[$i] = $filterOptions->value; $i++;?> 
76
                class="opt selected" <?php } else{?> class="opt"  <?php }?> >
76
                class="opt selected" <?php } else{?> class="opt"  <?php }?> >
77
                <?php  if(isset($filterOptions->nestedOptions) && !empty($filterOptions->nestedOptions)){ ?>
77
                <?php  if(isset($filterOptions->nestedOptions) && !empty($filterOptions->nestedOptions)){ ?>
78
                +
78
                +
Line 145... Line 145...
145
          smin = parseInt(smin);
145
          smin = parseInt(smin);
146
          var smax = document.getElementById("exFR").innerHTML
146
          var smax = document.getElementById("exFR").innerHTML
147
          smax = parseInt(smax);
147
          smax = parseInt(smax);
148
        // Run noUiSlider
148
        // Run noUiSlider
149
        
149
        
-
 
150
         $("#exTO").css({
-
 
151
                  left: 0 + '%'
-
 
152
                });
-
 
153
                $("#exFR").css({
-
 
154
                  left: 94 + '%'
-
 
155
                })
-
 
156
        
150
        
157
        
151
        $('.noUiSlider').noUiSlider({
158
        $('.noUiSlider').noUiSlider({
152
          set: function(){
159
          set: function(){
153
                var left = $($(".noUiSlider").find("a")[0]).offset().left;
160
                var left = $($(".noUiSlider").find("a")[0]).offset().left;
154
                var right = $($(".noUiSlider").find("a")[1]).offset().left;
161
                var right = $($(".noUiSlider").find("a")[1]).offset().left;
Line 157... Line 164...
157
          
164
          
158
            $("#exTO").css({
165
            $("#exTO").css({
159
              left: ((left/width * 100) - 8 ) + '%'
166
              left: ((left/width * 100) - 8 ) + '%'
160
            });
167
            });
161
              $("#exFR").css({
168
              $("#exFR").css({
162
                left: ((right/width * 100) - 12 ) + '%'
169
                left: ((right/width * 100) - 15 ) + '%'
163
              });  
170
              });  
164
          },
171
          },
165
           range: [min, max],
172
           range: [min, max],
166
           start: [smin, smax],
173
           start: [smin, smax],
167
           step: 1,
174
           step: 1,
Line 188... Line 195...
188
            $("#exTO").css({
195
            $("#exTO").css({
189
              left: ((left/width * 100) - 8 ) + '%'
196
              left: ((left/width * 100) - 8 ) + '%'
190
            });
197
            });
191
            if(right < maxWidth){
198
            if(right < maxWidth){
192
              $("#exFR").css({
199
              $("#exFR").css({
193
                left: ((right/width * 100) - 12 ) + '%'
200
                left: ((right/width * 100) - 15 ) + '%'
194
              })  
201
              })  
195
            }
202
            }
196
          }
203
          }
197
           }
204
           }
198
           
205
           
Line 201... Line 208...
201
        var ominVal = document.getElementById('minprice').innerHTML;
208
        var ominVal = document.getElementById('minprice').innerHTML;
202
        var omaxVal = document.getElementById('maxprice').innerHTML;
209
        var omaxVal = document.getElementById('maxprice').innerHTML;
203
        var minVal = document.getElementById('exTO').innerHTML;
210
        var minVal = document.getElementById('exTO').innerHTML;
204
        var maxVal = document.getElementById('exFR').innerHTML;
211
        var maxVal = document.getElementById('exFR').innerHTML;
205
         
212
         
206
         function filterAccess(el){
213
         function filterAccess(el,e){
207
          debugger;
214
          
208
           if(event.toElement.className.indexOf('selected') != -1){
215
           if(e.currentTarget.className.indexOf('selected') != -1){
209
             event.toElement.className =  event.toElement.className.replace('selected', '');
216
             e.currentTarget.className =  event.toElement.className.replace('selected', '');
210
             event.toElement.nextElementSibling.style.display = 'none'
217
             e.currentTarget.nextElementSibling.style.display = 'none'
211
              return false;
218
              return false;
212
           }else{
219
           }else{
213
             event.toElement.className = event.toElement.className + ' selected'; 
220
             e.currentTarget.className = e.currentTarget.className + ' selected'; 
214
           }
221
           }
215
           var url1, sp = event.toElement.getAttribute('data-value').replace(' ','+');
222
           var url1, sp = e.currentTarget.getAttribute('data-value').replace(' ','+');
216
           if(el == 'main'){
223
           if(el == 'main'){
217
               url1 = window.location.href.split('&')[0]+'&fq='+event.toElement.getAttribute('data-key')+':'+sp;  
224
               url1 = window.location.href.split('&')[0]+'&fq='+e.currentTarget.getAttribute('data-key')+':'+sp;  
218
           }else if(el == 'brand'){
225
           }else if(el == 'brand'){
219
             url1 = window.location.href +'&fq='+event.toElement.getAttribute('data-key')+':'+sp;
226
             url1 = window.location.href +'&fq='+e.currentTarget.getAttribute('data-key')+':'+sp;
220
           }else if(el == 'sub'){
227
           }else if(el == 'sub'){
221
             eUrl = window.location.href;
228
             eUrl = window.location.href;
222
             if( (localStorage.getItem("prev") != null) && (eUrl.indexOf(localStorage.getItem('prev').replace(' ','+')) != -1) ){
229
             if( (localStorage.getItem("prev") != null) && (eUrl.indexOf(localStorage.getItem('prev').replace(' ','+')) != -1) ){
223
               url1 = eUrl.replace(localStorage.getItem('prev').replace(' ','+') , sp);
230
               url1 = eUrl.replace(localStorage.getItem('prev').replace(' ','+') , sp);
224
             }else{
231
             }else{
225
               url1 = window.location.href +'&fq='+event.toElement.getAttribute('data-key')+':'+sp;
232
               url1 = window.location.href +'&fq='+e.currentTarget.getAttribute('data-key')+':'+sp;
226
             }
233
             }
227
            localStorage.setItem("prev", event.toElement.getAttribute('data-value') );
234
            localStorage.setItem("prev", e.currentTarget.getAttribute('data-value') );
228
           }else{
235
           }else{
229
            url1 = window.location.href
236
            url1 = window.location.href
230
            url1 = url1.split('&');
237
            url1 = url1.split('&');
231
            url1 = url1[0]+'&fq='+event.toElement.getAttribute('data-key')+':'+sp;
238
            url1 = url1[0]+'&fq='+e.currentTarget.getAttribute('data-key')+':'+sp;
232
           }
239
           }
233
           if((window.location.href.indexOf('minPrice') != -1) ){
240
           if((window.location.href.indexOf('minPrice') != -1) ){
234
             if((url1.indexOf('minPrice') == -1)){
241
             if((url1.indexOf('minPrice') == -1)){
235
                url1 = url1+'&minPrice='+document.getElementById('exTO').innerHTML+'&maxPrice='+document.getElementById('exFR').innerHTML;  
242
                url1 = url1+'&minPrice='+document.getElementById('exTO').innerHTML+'&maxPrice='+document.getElementById('exFR').innerHTML;  
236
             }
243
             }
237
           }
244
           }
238
           
245
           
239
           window.location.assign(url1);
246
           window.location.assign(url1);
240
           event.stopPropagation();
247
           e.stopPropagation();
241
           
248
           
242
         }
249
         }
243
         
250
         
244
         
251
         
245
         function applyFilter1(){
252
         function applyFilter1(){