0

sorry in advance for the more than likely simple/beginner/waste of time question(s). Anyway, I'm working on building a business ratings site of sorts (Yes, I know, way overdone. Don't worry about it! :D). However, since I know very little programming and am completely new to Drupal (7), I don't quite know the best way to go about building the basic nodes, how to add an itemized search function to the site, or how to get the listings to show up in said search. I've done as many searches as I can think of, but I think the problem is that I don't know what I don't know, and therefore am searching the wrong things.

I guess for me those are all different ways of asking a similar question. How do I build the template node for the business page so that it can be searched for and sorted based on its characteristics. For instance, when creating the basic content type template, how would I build it so that the listing can be searched, for instance, by state?

I need to display the address of the business on its page simply because of the nature of the site. So, is there a way for a search to pick up on that, and display it in a search sorted by the state that it's in? Do I need to somehow link that field to a taxonomy term of some sort? Also, what module would be the best to use for adding that type of search to the site?

I'm not sure whether this is helpful, but the modules that I have installed so far in my journey toward building this site/solving this problem are: Views, CTools, Display Suite, and Custom Search. I'm guessing that I will be able to use custom search for the actual search function, but I haven't delved into using it yet since I haven't figured out how to build what it searches.

Sorry for what I'm sure is a silly post, and thank you in advance for any help anybody may have to offer.

1

The two major approaches to adding locations in Drupal 7 are location/gmap and addressfield/geocoder. Comparing these two sets of modules in detail is the subject of a book, Mapping with Drupal, and is outside the scope of this post. Unfortunately, both approaches are still under heavy development and in all honesty you will likely encounter a fair number of bugs either way. At the moment, I would choose the Location approach because it has working proximity search (show me all businesses within 100 km of me).

If I were approaching this project, rather than using the built-in Drupal search, I would use the Views modules and filters (exposed filters) to allow users to search. Once you are proficient with the Views module (Node One has an excellent series of screencasts on learning Views), you will probably find it easier to work with and customize than the basic Drupal search.

A few tips on location- If you do install the location module it provides a "location directory" view by default, though it is disabled. You can enable this view and play with it; it creates an index of all your nodes that have locations attached to them. This should give you some idea about how to build location-based search in Views.

If you do use location, choose Location CCK (which will eventually be named to fields for D7), not the Node Location submodule. They are mutually exclusive and Location CCK is the direction that the next major release of the Location module will take.

| improve this answer | |
  • Thanks for the tips. I'll definitely take a look at Location (CCK). I had another question that I think is related to this with regards to searching. If I want to allow search/sorting by other parameters such as prices, overall rating, and things of that nature, would I use Views for that as well? – Mrweiner Apr 5 '12 at 0:10
  • Yes. You can add any field on a content type as an exposed filter in Views and allow users to search based on that. Price, rating, etc. will all be fields on your content type, so this should be no problem. Example: I have a site that allows users to be filtered based on age, gender, etc. using Views exposed filters). – Patrick Kenny Apr 5 '12 at 0:16
  • Awesome. I think I installed view and subsequently forgotten that I had already found the answer to all of my questions. I don't think I could figure out how to access it before because I was so stuck on clicking content types under structure. Of course, obviously there's a link right to it. Must have been late. Thanks a bundle! – Mrweiner Apr 5 '12 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.