Question

Briefly: I'm making a custom view, I want a field listing the two taxonomy terms associated with an NID to output as two distinct links which return arguments for the view (term1 to view/term1, term2 to view/term2. Rather, it outputs as one aggregated link (both term1 and term2 output view/term1%0Aterm2.

Am I doing something wrong or is this not possible?

Exhaustively:

I am constructing a view of products (with the page output at http://example.com/products) in an drupal ubercart site because the built-in ubercart catalog psuedo-view isn't doing it for me. Some of these products belong to more than one taxonomy term (within the same vocabulary) - for instance, product_example1 belongs to terms blue and glowinthedark, product_example2 red and glowinthedark, product-example3 just blue.

I've created an argument which limits the view based on terms like so: products/red, products/glowinthedark etc returns this nice view I made but only with products which are associated with taxonomy terms red, glowinthedark, etc - so works as it should. Views is awesome!

Now, I want each product shown in this view to link to the generated product/[term] page(s). Outputting the field "taxonomy:all terms" as a link with replacement argument products/[tid] works for one term (product_example3's field works for its one term: /products/blue (views is awesome!) , but, AND HERE'S THE PROBLEM, it DOESN'T FOR TWO TERMS (or I assume more than two terms). This is true whether the field is output as a list or using a simple seperator. So, for product_example one, the field lists both terms blue and glowinthedark (correctly separated as list items or with the chosen "," simple separator), but both terms output the relative link products/blue%0Aglowinthedark.

Is that clear? I haven't been able to google anyone with a similar situation, strangely, although I can't imagine I'm the first to run into this. I may just give up since it's not all that important and I can think of several less-satisfactory but still doable workarounds, but I thought you all might have some insight. The only thing that gives me hope is that when the "Link this field to its term page" check box is selected, views successfully outputs two separate line items with links to the two separate terms' pages.

I'm also posting this question on Drupal.org. Thanks for your time!

Was it helpful?

Solution

Hmmm... strange. I read your question carefully. However I am getting the results that you desire!

  • I have a taxonomy vocabulary that is multiple select (lets call it "Sector")
  • I have a taxonomy vocabulary that is single select (lets call it "Location")

In my fields section, I add Taxonomy: All Terms

  • In the settings for Taxonomy: All Terms I select "Output this field as a link". In there, I set the "Link Path" to product/[tid]
  • I make sure "Link this field to its term page" is NOT checked
  • I use a simple comma separator
  • "Limit terms to a specific vocabulary" checkbox does not matter. It would depend on your business requirements.

As required by you I get products/abc, products/xyz etc. one after another on a single line. This works even if a particular node has multiple terms from the same taxonomy vocabulary. I don't get any %0A stuff.

This works out of the box for me. I tried with both views 2.11 and views 3.0-alpha3

Try upgrading to the latest version of views and see if you have better luck?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top