Hello!
Is there a way to keep clicking on a link and adding parameters up to a url?
Example:
Current URL: domain.com/category/param1:tag
And, after clicking a link or item with another parameter or tag, add it to that same url. The result would be:
New URL: domain.com/category/param1:tag/param2:tag
And so on:
New URL: domain.com/category/param1:tag/param2:tag/param3:tag
I’m currently thinking of a Javascript solution but I was wondering if there’s something in the Toolkit or PHP that might work server side, almost out of the box. The idea would be to then use all those parameters to filter a collection.
Thanks. 
What is your use case? Do you want to filter by multiple tags? Or do these different parameters to different fields in a page?
Yes, the objective is to filter by multiple tags.
Hm, I don’t really see the advantage of doing this. And I certainly wouldn’t use different params, but add each new tag as a comma separated value.
Since you can get your parameter values with the param() helper, you can build a variable that contains all values as a comma separated list and then build your tag link with this list, so that you would then end up with links like this_
blog/tag:blue,green,yellow,green,gray,white,blue
<?php foreach($page->children()->pluck('tags', ',') as $tag): ?>
<?php $param = (param('tag')) ? param('tag').','.$tag : $tag;?>
<a href="<?= $page->url() . '/tag:'.$param ?>"><?= $tag ?></a>
<?php endforeach ?>
Happy clicking 
1 Like
Awesome! I think I get the concept behind this. Let me get back in a couple of hours, after testing this. Thanks!
Ok, after playing around for a while with this I noticed that I need parameters because some of those tags are the same for different parameters/fields. For example:
Frame Material: Plastic, Metal.
Lens Material: Plastic, Glass, Polycarbonate.
In this case, there would be no distinction between Plastic in the frame and lens tag category, right?
True, but that’s why I asked above if you were using different fields or not and you said they were all tags, so I assumed one tag field, not multiple. If you use different fields, you have to use one parameter name per field and then a comma separated list for each parameter name.
The above should also work for multiple parameters, you would have to adapt it.
Also, I just said it’s doable, I didn’t say it’s a great idea to do it this way. Why don’t you use a form or JS powered buttons?
Now that I re-read your first questions I admit I got them all wrong and didn’t answer correctly.
The single parameter idea works perfectly, the thing is that multiple fields are a must.
Yeah, in the end a combination of these two will be the way to go. Thanks Sonja!