I have created a search page uising exposed filters and views module. The user can choose from different values in order to get a table with specific results (returning node fields). This page is located under mysite.com/search. The problem is that I would like to put a simplified version of the search form on my homepage (lets say just the keyword search box + one or two checkboxes). This can be a block or a view. When the user presses the search button I would like to redirect him to the search page and show the results. Here the user shall be able to refine his search in an ordinary way. I guess this can be achieved by HTTP GET parameters and pointing to the actual search site. I was wondering however if I could do it without hardcoding the forms on my homepage, i.e. by using views, blocks, etc. I hope this makes sense. Any help will be appreciated.
Edit
The end result is that you want to have one form bring you to the search results page, and another advanced form on the search results page itself. This solution accomplishes this by creating two identical views with different filters for each form.
When someone uses the simplified form, they're taken to example.com/search, and when they're on that page and use the advanced form, they're taken to example.com/search/advanced. Because the views are identical with similar paths, the end user won't know the difference.
Here's how to accomplish this:
Create a view for the search results. Use the default display to set up the search results however you want. For filters, only put in automatic filters: don't put in the stuff you want the user to be able to filter by.
Create a new page display in that view. Give it a path of search. This is going to be the results page that a user hits when they use your simplified search form.
In this page display, override the filters. Set up and expose the filters you want for the simplified search form.
Override Expose form in block in the Basic settings for this display and set it to yes.
Create a new page display in the view, and give it a path of search/advanced. This is going to be the results page that a user hits when they use the advanced search form.
Override the filters for this display, set up and expose the filters you want for the advanced search form.
Override Expose form in block in the Basic settings for this display and set it to yes.
Now, you'll have two view pages, search and search/advanced, and two blocks, a simplified search form and an advanced search form.
Go to the block administration, and enable the simplified search block. Use the path specific visibility settings to set where you want the simplified search box to appear.
Now, enable the advanced search block. Use the path specific visibility settings to set the visibility to:
search
search/*
Let's say you wanted to create another simplified search block with a different set of filters (let's call this alternate). You can do that too: create another page display in your view as you did in steps 2-4 but instead of using the path search, give it a different path: search/alternate. You can add as many simplified forms with different filters as you want, and they'll all have the advanced search form and the same results when you use them.
Related
Here is a summary: I need the selective filters to update as the user selects options, but WITHOUT submitting the form.
Long Details:
I am using the contributed module Views Selective Filters to let users filter a view by automobile make, model, etc.
I am not sure if I missing something, this is a bug, or just something the module does not do. I have a page view with exposed filters and everything is working as expected. Now I need to make the exposed filters a block so that it can be placed on the homepage. The idea is that when users make changes to the exposed filter block on the homepage, the filters update as they choose, then when they have made all the selections they would hit submit and be taken to the page view with the results filters as chosen on the homepage.
The only time the filters update when values are selected is if I enable AJAX and choose the option to SUBMIT on any change to the filters. This works fine when the filters and results are on the same page (even in an exposed block). However, when used in my scenario it will take the user to the page view as soon as they change any filter.
Is there a way to force the selective filters to update without submitting the form?
I have a view in Drupal 7 with results including a field of date and another with price, I need to sort the results by means of these two fields when I click on the appropriate link (not button or dropbox radio), but the trick is I need add the different sort filter into two separate blocks, because each block will have a different per user context.
Besides the filters should be links. Any idea how to work this?
You can have different displays for all order variations and then use appropriate one depending on parameter passed with link. Of course, you can't just use block view, but create your custom block which will embed correct view depending on that parameter.
Other way would be altering view query. In you module add hook function for altering view and inside you should detect your view, check for parameter and alter order value.
You can create two block displays for the same view, each of them sorting the results with a different criteria. Once both blocks are created, enable them in the same theme region and establish the URLs in which each module should be displayed. This configuration can be set using the block configuration form.
I'm making a site wherein I want to show the current course that I'm gonna teach to my pupils.In this page there should also be links provided to my previous courses. Now when I'm done with this course I want to transfer it to a previous course or rather automatically create a link for it and get the new course content in it's place. I just think doing manually is kind of stupid. Rather I want to have a form where i can create my new course then click on make current course as previous and this course as new whenever i wish.How can I do this.Is this even possible
Pretty open question ... One way would be to work with views when showing a node.
In the view you should use a custom php field, which collects the record (nid) within the course-node table. And then create a link using the drupal path_alias function or by using node/nid ...
You could use panels-module as well. Where you have a view with the latest course, and under the latest course you have a view of a link to the latest course -1 . (I think you can set an offset in views to get the previous course) The view should accept an argument, namely the nid of the currently loaded node.
If you use this method, do check if your panels is giving the arguments to the views module.
Another way would be to use node reference as to what is the previous course (but you don't want it to be manual). The advantage of node_reference is that you don't need to enter your courses in a certain order. If you make it automatically, then the order in which you fill in the courses should be correct.
Easy man. Just create a content type called "course" and using CCK, add all the fields to capture information you want about the course.
Now you have the content. Using Views, create a simple view page displaying course content type and sort it on descending order, set it to display one item at a time and add a mini pager. That way the new course will be the first one displayed and the other ones will be behind it. You might need to customize the pager a bit ^^
I have a "Search" field in my website and I was wondering if I can assign my View to the search results, instead of using the default list.
Is this feasible ? How ?
thanks
It is possible to handle the search output by a view using the default search forms without exposing filters:
create a view of type content which displays all content types, display page
set Path: /search/node/%
add Contextual Filter "Search: Search Terms", then set "Provide default value" and "Raw value from URL" and "Path Component" to "3".
Now, every time you search for a node your view gets called instead of the default search result page because it is using the same path than the default search. The % is the argument which is handled by the Contextual Filter. Do not forget to set the filter to the 3rd component of the path which is the placeholder "%".
You can replace the default Search with a Views search instead. I haven't done this personally, but from what I've read it sounds straight forward. Create your "Search" View, then display it's "exposed filter" form instead of the default search form. More details here... http://groups.drupal.org/node/18582
Or, if you just want to make the search results look different, you can simply theme them, instead of using Views to do the searching. You can also control what fields (CCK and such) get displayed in the search results on the Display Fields > Search tab when editing the content type. I don't know the name of the template file for themeing search results of the top of my head, but if you have Theme Developer installed you can easily figure this out.
I've actually found the item "Search" in my Filters options in Views. I dunno how I could ignored it before. It actually exists, and works quite well. Solved.
You can use views to do search with exposed filters etc, but this is not a functionality that you can put on the search you have already. You can create a block in your search view and with theming replace what you got now with it instead.
This probably requires some work since the search box is usually not located in a region.
I'm displaying cars on a page created with a view and displays. I want to be able to create a form on the home page to allow people to select the 'make', which will then update the 'models' list based on the 'make' the user selects, 'year' to and from, and 'amount' to and from. What the user selects will of course alter the list of used cars, whether that's on the existing used cars page or a new page.
I would be happy to create a custom module if required, just need some direction.
Thanks !
When using views, what you need to do is to use exposed filtes. Inside your view you can setup filters like normally, only when you expose them, the user get to change the value of the filter.
How the filters will be themed to the user will depend on how you store the values, so it's a bit hard to say how to progress from there. It might be a bit tricky to get a select and not a textfield. Once you get select fields, this could probably be done with either some theming or form_alter, all you need is to add some js to change the options. The js part should be pretty normal, you will probably need to fetch the model names and values using ajax.