• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 487
  • Last Modified:

Drupal 7 Views filter via menu link

I think I am on the last leg of this drupal site, but I can't figure something out. I have a book feed that is pulling in from amazon. I have a created a categories. When the user clicks on sci-fi for example, i want the url to call my view [i am using Drupal 7]and pass the category value to that view, thus returning other titles in that category.

How can I accomplish this?
0
lfwebz
Asked:
lfwebz
  • 5
  • 3
  • 2
1 Solution
 
nanharbisonCommented:
Can we see this?
0
 
lfwebzAuthor Commented:
Sure, url is: http://feedsview2.lfwebz.com/

I am tickering so ignore the mess - but look at the Listing menu in the left sidebar, I want to use History for example, and have it point to to the view, which currently a block, but I can make a page is needed, and query/filter the view to find all the history related books.  There is a category field in the view that contacts the category/categories the book would fall into
0
 
nanharbisonCommented:
You either need to create a page for each category as a view, or create a page for each and stick the block on that page.
Do you know how to find the URL for a view? You have the ability to set it yourself, but it is usually what you named the view with dashes replacing spaces.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
lfwebzAuthor Commented:
that is possible what I am looking for, some guidance/steps to linking to the block and passing the variable "history" or "Romance" in the link that will then filter the view.
0
 
nanharbisonCommented:
As far as I know, you can't link to a block, it has to be in a node, or page.
0
 
lfwebzAuthor Commented:
Hi NanHarbison, yes I am fairly certain it can be done.

Does anyone have any concrete recommendations regard modules needed, process/steps of link a menu item to a view/passing variable to a view via link and filtering that view.
0
 
Aaron FeledyDrupal Developer and ConsultantCommented:
Create a page in views that displays all of your books. Add a percent sign to your path to represent the name of the category. Something like "categories/%". Add a contextual filter under the advanced settings of your view. Set the contextual filter to use the value of your category field. Now when you visit something like yoursite.com/categories/history, the view will generate a page that only displays books that have "history" as the value of that field.
0
 
lfwebzAuthor Commented:
but the big issue is how do i link up my menu?

so i have a menu link as follows:
Fiction
Romance
History

What do I put on the fiction link or wait, so the link would just point to mysite.com/cat/fiction ---sorry I think I sort of see this, need to test - back later
0
 
Aaron FeledyDrupal Developer and ConsultantCommented:
Yes, I think you're getting it.
0
 
lfwebzAuthor Commented:
Wow that worked Arrow_1.  Thanks so much, I have another question.  The contextual filter does not search in the category field if there is more than one value.  The category field is like this: "Fiction > Historical | Fiction > Literary".  If I put only Literary for example, it works.  I am going to post this as another question, because you answered my original one.  Thanks so much!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now