0

I need to create a view block type and show only the title of my node and its image but they are related by their taxonomy.

The image is attached to the node.

The node has its taxonomy_field field.

I have two taxonomy vocabularies: products, services.

The block will be placed on pages where have as URL: "taxonomy/term/tid" But these have their path URL alias, that is: " products/title-taxonomy " Then, the block is configured to only in scrambled URLs such as " products/* "

When creating my view I have the following configurations:

Fields: - Title - field_image

relationships: - Content: Taxonomy terms on node - Vocabulary: Products

Contextual Filter: - Content: Has taxonomy term ID (with depth) - Provide default value -> Type: Taxonomy Term ID from URL -> Load default filter from term page

But, when I activate the block in the content region does not show me any results. Change the setting of contextual filter by:

  • Content: Has taxonomy term ID
  • Provide default value -> Type: PHP Code -> return arg (2); This value would only take the url: taxonomy / term / tid that is covered by his alias and would return the tid value.

But I get an empty result. Even in the preview of the view, if I put a value directly, does not generate any results.

What is it I'm doing wrong? Or need some more configuration?

2
  • Where is the image. Is it attached to the node, on another node, or is it a taxonomy image?
    – Triskelion
    Commented Mar 12, 2013 at 18:05
  • @Triskelion The image is attached to the node. When the node is create, have a image field.
    – Eduardo
    Commented Mar 12, 2013 at 18:10

2 Answers 2

0

OK, I do it!.. My solution is use the module Taxonomy Display for D7. Related a view with taxonomy page and It's work!

1
  • Consider explaining your answer so that others can understand what you just did.
    – niksmac
    Commented Mar 13, 2013 at 3:07
0

If the title and image you are showing in the block are the same as the title and image of the displayed node, then you do not have to relate the block to the node through taxonomy.

Delete the relationship, and the contextual filter. Set up a contextual filter on Content:NID, and configure it to Provide default value -> Node ID from URL.

1
  • I have a menu with path of taxonomy terms. The menu is autogenerate in base of taxonomy. So, when I create a node with its taxonomy, this attached with taxonomy path but only I view the title of my node, but I need to show Title and image of my node related
    – Eduardo
    Commented Mar 12, 2013 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.