Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Drupal 7 Views filter via menu link

Posted on 2013-05-16
10
Medium Priority
?
465 Views
Last Modified: 2013-05-17
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
Comment
Question by:lfwebz
  • 5
  • 3
  • 2
10 Comments
 
LVL 17

Expert Comment

by:nanharbison
ID: 39172099
Can we see this?
0
 

Author Comment

by:lfwebz
ID: 39172281
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
 
LVL 17

Expert Comment

by:nanharbison
ID: 39172332
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
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 

Author Comment

by:lfwebz
ID: 39172351
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
 
LVL 17

Expert Comment

by:nanharbison
ID: 39172371
As far as I know, you can't link to a block, it has to be in a node, or page.
0
 

Author Comment

by:lfwebz
ID: 39172514
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
 
LVL 13

Accepted Solution

by:
Aaron Feledy earned 1200 total points
ID: 39173084
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
 

Author Comment

by:lfwebz
ID: 39173125
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
 
LVL 13

Expert Comment

by:Aaron Feledy
ID: 39173131
Yes, I think you're getting it.
0
 

Author Comment

by:lfwebz
ID: 39175374
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

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for those that are having major problems with users upload files such as pictures to their profile. The solution is simple and has to do with correcting the directory paths. With some experimenting and testing i got it fixed. Note…
RTL (right to left) web applications aiming for audiences speaking languages like Hebrew or Arabic, are generally more complicated than the same applications aiming for audiences speaking Latin based languages. The main difference lies of course …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question