Page 1 of 1

Query Strings of a category index or advanced search page

Posted: Mon Aug 01, 2022 9:39 am
by radhavallabh
Hi dear ;
If we search for a item or if we click a category the querystring of the urls get passed on to all products listed which seems to make the URLS on the page look odd.
Eg:if i search fruit
?keyword=fruit should get assigned only to the advanced search page link but it gets assigned to the products too-
https://phoenixcart.org/demo/advanced_s ... ords=fruit

Same for the category page the cPath gets assigned as a querystring to all products-
Like in demo- Each product URL has the cPath
https://phoenixcart.org/demo/index.php?cPath=1_3

Please can you help fix this issue??

Thank you in advance;
Very Warm Regds./
radhavallabh

Re: Query Strings of a category index or advanced search page

Posted: Mon Aug 01, 2022 10:18 am
by ecartz
If you want to change the product listing template links, override the product listing template and change line 62: https://github.com/CE-PhoenixCart/Phoen ... ng.php#L62

E.g.

Code: Select all

      $listing['link'] = Product::build_link($listing['products_id'], []);
would have no extra query parameters.

Note that if you do this, some breadcrumb links will then be broken, as they won't know the previous links to show.

Code: Select all

      $listing['link'] = Product::build_link($listing['products_id'], [])->retain_query_except(['keyword', 'cPath']);
might be somewhat better.

Re: Query Strings of a category index or advanced search page

Posted: Mon Aug 01, 2022 1:56 pm
by radhavallabh
ecartz wrote: Mon Aug 01, 2022 10:18 am If you want to change the product listing template links, override the product listing template and change line 62: https://github.com/CE-PhoenixCart/Phoen ... ng.php#L62

E.g.

Code: Select all

      $listing['link'] = Product::build_link($listing['products_id'], []);
would have no extra query parameters.

Note that if you do this, some breadcrumb links will then be broken, as they won't know the previous links to show.

Code: Select all

      $listing['link'] = Product::build_link($listing['products_id'], [])->retain_query_except(['keyword', 'cPath']);
might be somewhat better.
Hi dear;

Code: Select all

      $listing['link'] = Product::build_link($listing['products_id'], [])->retain_query_except(['keywords', 'cPath']);
Worked like a charm :D
Thank you so much!!!
Very warm Regds./
radhavallabh