Hi,

I came across the issue at #326182: Expose filters as simple list of text links? which is pretty much what I'm looking for but was curious as to how to do this with attachments as mentioned in the attached issue. What I want to do is have any list of results filtered by a geographical "region" (setup as a vocabulary) and want to be able to filter this at any point in the browsing of "categories" (setup as a different vocabulary) and I want to be able to select the region using links rather than the dropdown select/submit process that the filters use now.

Does anyone have a view of whether this is doable with attachments? Happy to jump in and try it but would be nice to know that what I'm trying to do is possible. Even though the attached issue does what I need in this case I think I'm going to need to reuse the solution with other options that won't work in this case so getting the attachment working would be nice.

What I've tried so far is cloning the glossary view to play with, and have added a "Taxonomy: Term ID" argument to the Defaults display with the following settings changed/used:

Action to take if argument is not present: Display all values
Validator options -> Validator: Taxonomy term
Validator options -> Vocabularies: Regions (i.e. the vocabulary I want to sub filter on)
Validator options -> Argument type: Term name/synonym converted to Term ID

This means that I can go to /browse_by_name/a/central and get a list of nodes (in my situation "Classifieds") that start with A and are in the central region. I thought I would need this to setup the links that I will eventually be creating.

Next I thought I would create an attachment which I've renamed as "Region Filter" and would as a first step show the region terms attached to the nodes. I've overridden the fields to show only "Taxonomy: Term" and limited using a filter to the "Taxonomy: Vocabular = Regions" to only show terms from that vocab.

My question so far is:

How do I get rid of duplicates? At the moment if I have three nodes tagged with "Central" I'm getting the term three times. I've tried using "Distinct: Yes" and using "Taxonomy: Term" as the grouping field (this was actually worse as it still didn't group but put all three instances of "Central" with a title of "Central"???) I'm going to try the solution in #541464: Duplicate taxonomy terms but in the meantime does anyone know how to get rid of duplicates?

Thanks,
Anthony

Comments

dawehner’s picture

You could try to use argument summary by taxonomy term.
Then you could list all taxonomy terms together with the amount of nodes of the taxonomy term.

malks’s picture

Hi Dereine,

Thanks for the reply, that got me a bit closer I think... now if I go to the base url (browse_by_name) or use the glossary links (i.e. browse_by_name/a) then my links appear as they should in summary style. The only problem is if I then click on one of my links, the view goes to the right spot but now that there is an argument for that term the summary (which only works if no arguments are provided) it shows the list of nodes that match. I tried not to have any fields defined for that attachment but then views wouldn't allow me to save it. How does the standard glossary view do it? I don't get how when you click on say "A" the glossary attachment doesn't load.

OK, since actually typing that, I think I get that it does it by not inheriting the arguments, so I tried this but now if I do click on one of the glossary links my regions attachment doesn't update. So back to the original question is there a way to not show the query results for my new attachment?

Thanks,
Anthony.

malks’s picture

OK, closer again with a bit of CSS, but it strikes me as a bit hacky... is there a better way to hide it? It also seems a bit brittle and may break other views that rely on the same classes but the CSS code below does the trick for now.

.view-display-id-attachment_1 .views-table {
  display: none;
}
dawehner’s picture

I think there are enough css classes and Ids to get only the element you need. For me css is a good way .

malks’s picture

It does the job, but there are no id attributes only class attributes. Is there anyway in the views interface to insert an id attribute? I'm worried that something else may use the same classes and I'll be hiding something inadvertantly?

Anthony.

dawehner’s picture

<div class="view view-test4 view-id-test4 view-display-id-page_1 view-dom-id-3">

This is the wrapper div for a view. Where test4 is my viewname. I think thats enough css classes for you.

malks’s picture

Status: Active » Fixed

Ah yes that makes sense, should be plenty. Thanks for your help Dereine.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.