You are here:  » Filters, Sorting seem to be missing rewrite flag


Filters, Sorting seem to be missing rewrite flag

Submitted by Nic0904 on Mon, 2016-06-06 15:19 in

Hi David

Effect on URL and Breadcrumbs when using Hierarchy Categories and rewrite
I have noticed that when you use a filter or sort using anything other than default relevance the breadcrumb trail and URL changes to a more basic format. You lose the parent structure if you are in a sub category and the new breadcrumb trail does not give any extra info. The effect on the URL when using rewrite is similar

At first I thought it was something I had done, as I have made a lot of mods to the base code, so I checked on the demo site and duplicated the effect. Have included detail on how to reproduce below:

http://www.webpricecheck.co.uk

* Breadcrumb Trail
1. Select Domestic Appliances
2. Select Washing machines
3. See Breadcrumb trail like this
HOME / CATEGORY / DOMESTIC APPLIANCES / WASHING MACHINES AND DRYERS (1 TO 10 OF 1117)
4. Sort low to high
5. The breadcrumb trail now looks like this
HOME / CATEGORY:DOMESTIC APPLIANCES/WASHING MACHINES AND DRYERS (1 TO 10 OF 1117
6. The effect is the same for all filters and sorts

*URL
1. Select Domestic Appliances
2. Select Washing machines
3. See URL like this
http://www.webpricecheck.co.uk/category/Domestic-Appliances/Washing-Machines-and-Dryers/
4. Sort low to high
5. The URL now looks like this
http://www.webpricecheck.co.uk/search.php?q=category%3ADomestic+Appliances%2FWashing+Machines+and+Dryers&page=1&sort=priceAsc
6. The effect is the same for all filters and sorts

On further investigation I noticed the rewrite flag was missing from the URL after sorting ("&rewrite=1") Adding this to the URL above reactivates the rewriting of the URL

I am not sure if this is by design or a bug, any pointers to avoid this affect appreciated.

Thanks
Dave

Submitted by support on Tue, 2016-06-07 08:53

Hi Dave,

That's by design - after changing any of the search parameters a normal search.php URL is used. The presence of rewrite=1 in the URL (which would never normally be seen) is used by the navigation code as the que to create the search engine friendly pagination links for page 2, 3 etc. of the merchant / category / brand A-Z pages...

Cheers,
David.
--
PriceTapestry.com

Submitted by Nic0904 on Tue, 2016-06-07 15:26

Hi David,

I can see the logic of your design, but I would like to keep the breadcrumb trail visible especially for sort.

Could you give me a guide as to where I would need to make a change to retain the breadcrumb trail when using a sort or filter?

Thanks
Dave

Submitted by support on Tue, 2016-06-07 16:32

Hi Dave,

Sure - in search.php look for the following code at line 346:

    if (isset($parts[1]) && $rewrite)

...and REPLACE with:

    if (isset($parts[1]) && ($priceWhere==""))

Cheers,
David.
--
PriceTapestry.com

Submitted by Nic0904 on Wed, 2016-06-08 12:38

Hi David,

Many thanks for that, keeping the breadcrumb trail fits in far better with our design. This one works for sort, but we still lose the breadcrumbs if you use a filter.

Is there as simple a patch to make this work for filters too?

Thanks
Dave

Submitted by support on Wed, 2016-06-08 13:00

Hi Dave,

You could use just:

    if (isset($parts[1]))

...and that will use the rewritten format breadcrumbs for all index pages regardless of sort / filter...

Cheers,
David.
--
PriceTapestry.com