Solved

Drupal 7 Views filter via menu link

Posted on 2013-05-16
10
448 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

706 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

20 Experts available now in Live!

Get 1:1 Help Now