Jump to content

Pagination is not working properly while enabling layered navigation block


Recommended Posts

Hi,

 

While working on PS 1.5 I found that pagination on product listing does not work properly when I enable "layered navigation block".

When I disable "layered navigation block" block, pagination works fine.

 

Is there any solution to solve this issue.

 

Please help me.

 

 

Thanks in advance.

Link to comment
Share on other sites

  • 5 months later...

Hi,

I have a similar issue:

Rebuilding index didn't help.

 

Here is what I found out:

 

I have a website URL like this:

http://mydomain.com/en/20-categoryname#/price-21-9807

Meaning, layered navigation first page, prices between 21 and 9807 (just an example)

 

The generated links for the pagination look like this:

http://mydomain.com/en/20-categoryname#/page-3

nothing happens on a click because of the #

 

if I  manually remove the "#" (meaning the anchor) and reload the page, the new page is loaded.

but the new pagination link look bad again:

http://mydomain.com/en/20-categoryname/page-3#/page-1

-> The problem is the url generating algo.

I guess you can find the problem here

blocklayered.js, aroung 238:
var location = window.location.href.replace(/#.*$/, '');
and following

$(this).attr('href', location+current_friendly_url.replace(/\/page-(\d+)/, '')+'/page-'+page);

in my opinion the regex is kind of wrong, but I couldn't find a better matching one.

 

Hope this helps somebody to find a solution. Right now: Pagination + Layered Navigation doesn't work..

Edited by Pete78 (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 11 months later...
  • 4 months later...
  • 1 month later...

Just refound this thread because I had the problem again for another shop:

 

In that case it was a javascript error which broke the pagination:

 

So not a guarantee but it might be aproblem:

 

Please look into blocklayerd.js in /themes/yourtheme/js/modules/blocklayered

 

find

function stopAjaxQuery() {
	if (typeof(ajaxQueries) == 'undefined')
		ajaxQueries = new Array();
	for(i = 0; i < ajaxQueries.length; i++){		
	 ajaxQueries[i].abort();
	}
	ajaxQueries = new Array();
} 

and add another check to that function

function stopAjaxQuery() {
	if (typeof(ajaxQueries) == 'undefined')
		ajaxQueries = new Array();
	for(i = 0; i < ajaxQueries.length; i++){
		if (typeof(ajaxQueries[i]) != 'undefined')
			ajaxQueries[i].abort();
	}
	ajaxQueries = new Array();
}

Maybe your theme doesn't need this fix...just another hint.

Edited by Pete78 (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...