Solved

Drupal 7 Views filter via menu link

Posted on 2013-05-16
10
450 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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:
Arrow_1 earned 300 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:Arrow_1
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

864 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now