Skip to content

Commit c8f0eed

Browse files
author
Praveen Kumar
committed
Merge pull request #24 from sharathk2u/master
Made the changes for category page refresh issue if using taxonomy feed
2 parents 085824c + 3b2daa6 commit c8f0eed

File tree

1 file changed

+32
-21
lines changed

1 file changed

+32
-21
lines changed

unbxdSearch.js

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -519,27 +519,38 @@ var unbxdSearchInit = function(jQuery, Handlebars){
519519
,hashChangeInterval : null
520520
,ajaxCall : null
521521
,init : function(){
522-
this.isHashChange = !!("onhashchange" in window.document.body);
523-
524-
this.$input = jQuery(this.options.inputSelector);
525-
this.$input.val('');
526-
this.input = this.$input[0];
527-
528-
this.setEvents();
529-
530-
this.reset();
531-
532-
this.params.categoryId = this.options.type == "browse" && typeof this.options.getCategoryId == "function" ? this.options.getCategoryId() : "";
533-
534-
if(this.params.categoryId.length > 0){
535-
if(typeof this.options.setDefaultFilters == "function")
536-
this.setDefaultParams(this.params);
537-
538-
this.setPage(1)
539-
.setPageSize(this.options.pageSize);
540-
541-
this.callResults(this.paintResultSet);
542-
}else if(this.options.type == "search" && this.input.value.trim().length){
522+
this.isHashChange = !!("onhashchange" in window.document.body);
523+
this.$input = jQuery(this.options.inputSelector);
524+
this.$input.val('');
525+
this.input = this.$input[0];
526+
this.setEvents();
527+
this.reset();
528+
this.params.categoryId = this.options.type == "browse" && typeof this.options.getCategoryId == "function" ? this.options.getCategoryId() : "";
529+
if(this.params.categoryId.length > 0){
530+
if(this.getQueryParams()["category-id"] == this.params.categoryId){
531+
var cur_url = this.getUrlSubstring()
532+
, urlqueryparams = this.getQueryParams(cur_url)
533+
, decodedParams = !/[^A-Za-z0-9\+\/\=]/g.test(cur_url) ? this.getQueryParams(this.decode(cur_url)) : {}
534+
, queryparamcount = Object.keys(urlqueryparams).length
535+
, decodedParamscount = Object.keys(decodedParams).length
536+
, finalParams = null ;
537+
if (!this.options.noEncoding && decodedParamscount > 0) {
538+
finalParams = this._processURL(decodedParams)
539+
} else {
540+
finalParams = this._processURL(urlqueryparams)
541+
}
542+
this.params = finalParams;
543+
this.setPage("page" in finalParams.extra ? finalParams.extra.page : 1).setPageSize("rows" in finalParams.extra ? finalParams.extra.rows : this.options.pageSize);
544+
if (typeof this.options.setDefaultFilters == "function")
545+
this.setDefaultParams(this.params);
546+
this.callResults(this.paintResultSet)
547+
}else{
548+
if (typeof this.options.setDefaultFilters == "function")
549+
this.setDefaultParams(this.params);
550+
this.setPage(1).setPageSize(this.options.pageSize);
551+
this.callResults(this.paintResultSet)
552+
}
553+
}else if(this.options.type == "search" && this.input.value.trim().length){
543554
if(typeof this.options.setDefaultFilters == "function")
544555
this.setDefaultParams(this.params);
545556

0 commit comments

Comments
 (0)