get_filtered_url
get_filtered_url is an Aurora Smarty template function that can be used to embed dynamic urls in listing pages, based on current path filters. This article explains usage of this Smarty function.
Introduction
This is Smarty Function to create URLs in Aurora for front-end Product Category/Listing pages.
This allows you to create links to (for example) /mens-trainers/co:red
in banners that automatically update when other filters are applied to the listing page and the page is refreshed.
Parameters
Parameter | Example | Required | Explanation |
---|---|---|---|
url | mens-trainers | Y | url to be included |
filter_abbreviations | co,si | Y | Comma separated list of filters and associated values to be copied from the current path. |
include_domain | false | N | true or false. Should the protocol relative domain be included? Default: false |
Output
The function will output a url as single string, or trigger a smarty error in case of failure, e.g. when a required parameter is not passed.
Example Usage
The below examples assume that the user is visiting the host: https://visitdomain.co.uk
Domain name not to be included
This is the example that can be used when you do not want to include the domain name.
{get_filtered_url url="mens-trainers" filter_abbreviations="co,si" include_domain=false}
Output:
- On this page: /mens/
This would be generated: /mens-trainers/ - On this page: /mens/co:red/
This would be generated: /mens-trainers/co:red/ - On this page: /mens/co:red,green/
This would be generated: /mens-trainers/co:red,green/ - On this page: /mens/si:6/
This would be generated: /mens-trainers/si:6/ - On this page: /mens/co:red/si:6/
This would be generated: /mens-trainers/co:red/si:6/ - On this page: /mens/br:nike/
This would be generated: /mens-trainers/ - On this page: /mens/br:nike/co:red/si:6/
This would be generated: /mens-trainers/co:red/si:6/
Domain name to be included
This is the example that can be used when you do want to include the domain name.
{get_filtered_url url="mens-trainers" filter_abbreviations="co,si" include_domain=true}
Output:
- On this page: /mens/
This would be generated: //visitdomain.co.uk/mens-trainers/ - On this page: /mens/co:red/
This would be generated: //visitdomain.co.uk/mens-trainers/co:red/ - On this page: /mens/co:red,green/
This would be generated: //visitdomain.co.uk/mens-trainers/co:red,green/ - On this page: /mens/si:6/
This would be generated: //visitdomain.co.uk/mens-trainers/si:6/ - On this page: /mens/co:red/si:6/
This would be generated: //visitdomain.co.uk/mens-trainers/co:red/si:6/ - On this page: /mens/br:nike/
This would be generated: //visitdomain.co.uk/mens-trainers/ - On this page: /mens/br:nike/co:red/si:6/
This would be generated: //visitdomain.co.uk/mens-trainers/co:red/si:6/
Updated about 2 years ago