Using this module on the taxonomy_term view
archard - February 22, 2008 - 23:42
| Project: | Views Filter Block |
| Version: | 5.x-1.4 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
This module doesn't work with the taxonomy_term view, because the URL for the view is taxonomy/term, so when you submit the filter it goes to a URL like 'taxonomy/term?filter=xxx'. Obviously this will result in a 404 error. Is there any way to get around this to use this module with the taxonomy_term view?

#1
#2
It's not obvious to me.
What do you mean by: ?filter=xxx. Do you mean the views op and filter fragments, like filter0=xxx? If so, I don't understand the problem.
#3
If you use the taxonomy_term view, it will override all of your term pages to whatever you set in the view. So let's say you have a term page with a URL 'colors/green' using the taxonomy_term view. The actual URL entered in the view configuration is 'taxonomy/term', so if I tried to use this module on that page, I would get a 404 error because when I hit submit I would be redirected to 'taxonomy/term?filter=xxx' rather than 'colors/green?filter=xxx'.
So clearly this module takes the URL defined in the view and appends the filter argument onto that, but that won't work for dynamic views like the taxonomy_term view. So maybe it should take the current URL rather than the one defined in the view?
#4
It can't take the current URL, because this module puts the view in a block, and that block might be on any page, which is usually not the URL you want. it must take the URL of the view. If taxonomy_term is changing the URL of the view, I guess we need to figure out how it's changing it.
#5
Well it doesn't really change the URL of the view... it just accepts whatever alias you have for the term page and outputs the view on that page. The URL 'taxonomy_term" doesn't actually exist and I'm sure it's just like a placeholder because something has to be entered for a URL.
Say I had a taxonomy_term view and the current term page has an alias of 'colors/green'. If I submit any exposed filter from the block this module creates I'll be redirected to 'taxonomy/term?filterx=blahblah', resulting in a 404 page error. But if manually enter the URL 'colors/green?filterx=blahblah', the correct filters show up.
#6
Try $view->url in the argument handling code:
$view->url = "taxonomy/term/".arg(2);
(in fact it is a common usage of the views api, to avoid hard coding the urls)
#7
Thanks PHP code worked like a charm! Saved me some headaches that's for sure.
#8
#9
Automatically closed -- issue fixed for two weeks with no activity.