@@ -286,7 +286,7 @@ var unbxdSearchInit = function(jQuery, Handlebars){
286
286
, searchButtonSelector : '#search_button'
287
287
, type : "search"
288
288
, getCategoryId : ""
289
- , initPageLoad : true
289
+ , deferInitRender : [ ]
290
290
, spellCheck : '' //
291
291
, spellCheckTemp : '<h3>Did you mean : {{suggestion}}</h3>'
292
292
, searchQueryDisplay : ''
@@ -464,7 +464,7 @@ var unbxdSearchInit = function(jQuery, Handlebars){
464
464
465
465
this . params . query = this . $input . val ( ) . trim ( ) ;
466
466
467
- if ( this . options . initPageLoad )
467
+ if ( this . options . deferInitRender . indexOf ( 'search' ) === - 1 )
468
468
jQuery ( this . options . searchResultContainer ) . html ( '' ) ;
469
469
470
470
this . setPage ( 1 )
@@ -488,10 +488,10 @@ var unbxdSearchInit = function(jQuery, Handlebars){
488
488
finalParams = this . _processURL ( urlqueryparams ) ;
489
489
}
490
490
491
- if ( ! this . options . initPageLoad
491
+ if ( this . options . deferInitRender . indexOf ( 'search' ) > - 1
492
492
&& finalParams . extra . hasOwnProperty ( 'page' )
493
- && finalParams . extra . page > 1 )
494
- finalParams . extra . page = finalParams . extra . page - 1 ;
493
+ && finalParams . extra . page >= 1 )
494
+ finalParams . extra . page = finalParams . extra . page + 1 ;
495
495
496
496
497
497
if ( this . options . type == "search" ) {
@@ -508,7 +508,7 @@ var unbxdSearchInit = function(jQuery, Handlebars){
508
508
509
509
this . $input . val ( this . params . query != "*" ? this . params . query : "" ) ;
510
510
511
- if ( this . options . initPageLoad )
511
+ if ( this . options . deferInitRender . indexOf ( 'search' ) === - 1 )
512
512
jQuery ( this . options . searchResultContainer ) . html ( '' ) ;
513
513
514
514
this . setPage ( "page" in finalParams . extra ? finalParams . extra . page : 1 )
@@ -545,7 +545,7 @@ var unbxdSearchInit = function(jQuery, Handlebars){
545
545
546
546
self . params . query = self . options . sanitizeQueryString . call ( self , self . input . value ) ;
547
547
548
- if ( self . options . initPageLoad )
548
+ if ( self . options . deferInitRender . indexOf ( 'search' ) === - 1 )
549
549
jQuery ( self . options . searchResultContainer ) . html ( '' ) ;
550
550
551
551
if ( typeof self . options . setDefaultFilters == "function" )
@@ -566,7 +566,7 @@ var unbxdSearchInit = function(jQuery, Handlebars){
566
566
567
567
self . params . query = self . options . sanitizeQueryString . call ( self , this . value ) ;
568
568
569
- if ( self . options . initPageLoad )
569
+ if ( self . options . deferInitRender . indexOf ( 'search' ) === - 1 )
570
570
jQuery ( self . options . searchResultContainer ) . html ( '' ) ;
571
571
572
572
if ( typeof self . options . setDefaultFilters == "function" )
@@ -588,7 +588,7 @@ var unbxdSearchInit = function(jQuery, Handlebars){
588
588
589
589
self . params . query = self . options . sanitizeQueryString . call ( self , self . input . value ) ;
590
590
591
- if ( self . options . initPageLoad )
591
+ if ( self . options . deferInitRender . indexOf ( 'search' ) === - 1 )
592
592
jQuery ( self . options . searchResultContainer ) . html ( '' ) ;
593
593
594
594
self . clearFilters ( true ) . setPage ( 1 )
@@ -1070,7 +1070,7 @@ var unbxdSearchInit = function(jQuery, Handlebars){
1070
1070
this . currentNumberOfProducts = 0 ;
1071
1071
jQuery ( this . options . spellCheck ) . hide ( ) ;
1072
1072
jQuery ( this . options . searchQueryDisplay ) . empty ( ) ;
1073
- if ( this . options . initPageLoad )
1073
+ if ( this . options . deferInitRender . indexOf ( 'search' ) === - 1 )
1074
1074
jQuery ( this . options . searchResultContainer ) . empty ( ) ;
1075
1075
1076
1076
jQuery ( this . options . facetContainerSelector ) . empty ( ) ;
@@ -1229,25 +1229,25 @@ var unbxdSearchInit = function(jQuery, Handlebars){
1229
1229
}
1230
1230
} else {
1231
1231
jQuery ( this . options . spellCheck ) . hide ( ) ;
1232
- if ( this . options . initPageLoad )
1232
+ if ( this . options . deferInitRender . indexOf ( 'search' ) === - 1 )
1233
1233
jQuery ( this . options . searchResultContainer ) . empty ( ) ;
1234
1234
this . paintProductPage ( obj ) ;
1235
1235
facetsAlso && this . paintFacets ( obj ) ;
1236
1236
}
1237
1237
}
1238
1238
, paintOnlyResultSet : function ( obj ) {
1239
- if ( this . options . initPageLoad )
1239
+ if ( this . options . deferInitRender . indexOf ( 'search' ) === - 1 )
1240
1240
jQuery ( this . options . searchResultContainer ) . empty ( ) ;
1241
1241
this . paintProductPage ( obj ) ;
1242
1242
}
1243
1243
, paintAfterSpellCheck : function ( obj ) {
1244
- if ( this . options . initPageLoad )
1244
+ if ( this . options . deferInitRender . indexOf ( 'search' ) === - 1 )
1245
1245
jQuery ( this . options . searchResultContainer ) . empty ( ) ;
1246
1246
this . paintProductPage ( obj ) ;
1247
1247
this . paintFacets ( obj ) ;
1248
1248
}
1249
1249
, paintAfterFacetChange : function ( obj ) {
1250
- if ( this . options . initPageLoad )
1250
+ if ( this . options . deferInitRender . indexOf ( 'search' ) === - 1 )
1251
1251
jQuery ( this . options . searchResultContainer ) . empty ( ) ;
1252
1252
this . paintProductPage ( obj ) ;
1253
1253
this . paintSelectedFacets ( ) ;
@@ -1491,10 +1491,10 @@ var unbxdSearchInit = function(jQuery, Handlebars){
1491
1491
1492
1492
this . paintSelectedFacets ( ) ;
1493
1493
1494
- if ( ! this . options . initPageLoad && this . params . extra . page > 1 ) {
1494
+ if ( this . options . deferInitRender . indexOf ( 'search' ) > - 1 && this . params . extra . page > 1 ) {
1495
1495
this . params . extra . page = this . params . extra . page - 1 ;
1496
1496
}
1497
- this . options . initPageLoad = true ;
1497
+ this . options . deferInitRender = [ ] ;
1498
1498
1499
1499
if ( typeof this . options . onFacetLoad == "function" ) {
1500
1500
this . options . onFacetLoad . call ( this , obj ) ;
0 commit comments