You are here:  » Pagination - problem


Pagination - problem

Submitted by Milano on Wed, 2015-03-25 14:49 in

Hi,

quick question... I just noticed that pagination does not work (products not found) while the friendly urls is enable - with disable is ok. I changed to the original files search.php, navigation.php and searchresults.php but does not work :(

In which file should I search?

Version: PT 15/01A (translated to Polish, changed url structure).

Regards,
Jack

Submitted by support on Wed, 2015-03-25 15:23

Hello Jack,

I know you've been running the script for several years and it sounds like you've applied changes successfully to a previous installation - but just wanted to check, is .htaccess in place in your new installation, based on a copy of htaccess.txt in the distribution?

As of the latest distribution both product / review / merchant / category / brand page URLs are generated by utility functions in includes/tapestry.php - look for the following functions:

tapestry_productHREF
(beginning at line 58)

tapestry_indexHREF
(beginning at line 293)

You may need to make changes to these functions to correspond with your template changes. if you're still not sure, if you could let me know an example URL from your new installation (I'll remove before publishing your reply) I'll check it out further with you of course...

Cheers,
David.
--
PriceTapestry.com

Submitted by Milano on Thu, 2015-03-26 10:32

Hi David,

I just found it :) Problem with pagination is when I change in .htaccess and includes/tapestry.php structure of product url by deleting "product/": example.com/product/test.html > example.com/test.html

In my .htaccess:
RewriteRule ^(.*).html$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [B,L]

In my includes/tapestry.php (line 66):
return $config_baseHREF.urlencode(tapestry_hyphenate($product["normalised_name"])).".html";

Wrong way to short product url? :)

Submitted by support on Thu, 2015-03-26 10:51

Hello Jack,

All it will be is that the modified line in .htaccess needs to go at the end of the file (last rule) to prevent it conflicting with the pagination rules, but should also preceeded with RewriteCond checks to ensure that it doesn't conflict with any other pages - have a go with the following:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).html$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [B,L]

Cheers,
David.
--
PriceTapestry.com

Submitted by Milano on Thu, 2015-03-26 11:18

Now it's working. Thank you! :D