Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-01-26 11:49:22
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Restaurant Guide (Filtering by...)
Hi!
I have to create a website for a city guide.
The Guide includes Restaurants, Shops, Things to do, all distributed into categories.
Each Category will need Subcategories.
For example:
MINAVO (a Japanesse restaurant)
Will be in the RESTAURANT Categorie, and inside the Japanesse subcategorie.
I wanted to know if there is a way to filter searches.
If someone visits the site I want them to be able to search for a restaurant by selecting the type of food, the price range etc… and when they clic on SEARCH the restaurants with those things he selected will be displayed.
Those restaurants will be the Articles posted, using the title field for the name of the restaurant, description, etc…
Is there a way to filter articles in this way?
Do you know if there is a Plugin for something like this?
Do you have any other ideas on how to do this?
Thanks!!!
Offline
#2 2009-01-26 12:42:20
- ultramega
- Member
- Registered: 2006-02-26
- Posts: 221
Re: Restaurant Guide (Filtering by...)
Filtering could be propably achieved with some kind custom field macig, for which there is few plugins which may help. I think someone was building real estate site or something like that which had quite similar filtering needs, try to search the forum. About categorizing, I think restaurants could also be a section, and japanese, italic, thai… those could be categories?
Offline
#3 2009-01-26 12:59:22
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: Restaurant Guide (Filtering by...)
mmm, yes, I could use custome fields to write the type of restaurant, but then, can I make a search only in the custom field?
I will try to search for what you are saying.
Thanks
Offline
#4 2009-01-26 13:24:37
- ultramega
- Member
- Registered: 2006-02-26
- Posts: 221
Re: Restaurant Guide (Filtering by...)
Aah, no. I meaned: sections = different types of activities (shops, restaurants, events…) – then inside section categories would separate different type shops, restaurants etc…
Custom field could propably be used for the filtering, I haven’t yet tested but I think this might help, (see the video!) http://forum.textpattern.com/viewtopic.php?id=23996
Offline
Re: Restaurant Guide (Filtering by...)
With a bunch of custom fields as described above to hold your data (e.g. one for type of food, one or two for price / price range perhaps), you could try a variant of the cheating search technique that I proposed. There a few other threads linked from it too.
EDIT: Alternatively, try the excellent tru_tags, or perhaps smd_tags which offers some advanced filtering by tag / category / whatever. As the icing on the cake you could use smd_fuzzy_find if there are no exact matches so visitors could filter their results via a traditional search box that can guide them in the right sort of direction based on stuff they might type (rightly or wrongly!).
Last edited by Bloke (2009-01-26 13:37:51)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#6 2009-01-26 15:39:56
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: Restaurant Guide (Filtering by...)
Even if Bloke himself doesen’t mention it, I think another useful plugin could be smd_query
Offline
Re: Restaurant Guide (Filtering by...)
redbot wrote:
Even if Bloke himself doesen’t mention it, I think another useful plugin could be smd_query
Oh yeah, forgot about that one!
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#8 2009-01-26 17:10:06
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: Restaurant Guide (Filtering by...)
Thanks!
I have been reading all those posts for a wile, and they will be pretty helpfull.
But I have another problem I will try to explain with this image
http://www.edwardkinsellaillustration.com/search.jpg
the user can select some options and the clic on search, and all the articles that have that criteria will be shown.
Is that posible?
not sure how to create something like that.
Offline
Re: Restaurant Guide (Filtering by...)
mlarino wrote:
http://www.edwardkinsellaillustration.com/search.jpg
The first two are “easy” because they will have direct analogues, i.e. when someone selects “New York”, you could do a simple comparison on your search results page using <txp:article_custom location="your_extracted_variable_here" /> (you can use adi_gps for this, it’s great!). There’s a one-to-one mapping between what the user selects and what you ask the database for.
The tricky one is the price because you have a range of price values. In order to do any serious database stuff, you really need to have two prices per item:
- the lowest price
- the highest price
So in your example, low_price = 30 and hi_price = 40.
What you really need is some logic that intercepts whatever value is passed to your search form on the URL (e.g. http://site.com/section/search?location=New+York&food_type=Italian&price=30_40). If you engineer it so that your HTML <option>values are something like:
<select name="price">
<option value="5_10">5 - 10 $</option>
<option value="10_20">10 - 20 $</option>
<option value="20_30">20 - 30 $</option>
...
you can split the price URL variable at the underscore. You then have your low price and hi price variables and can use some of the tools listed above to ask the database for the relevant articles.
That’s how I’d approach it, but I’m sure someone will come up with something more cunning.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#10 2009-01-26 17:47:53
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: Restaurant Guide (Filtering by...)
I see…
And can I make the search for those 2 things at the same time?
Location, and price?
The only search I ever builded was only to search words in articles, not sure what code to use to search with all those variables listed.
Also, do all those variables have to be CUSTOM FIELDS, sections, categories, TAGS?
Not sute how to organize this, and just thinking about it is giving me a headeach! hehe
Offline
Re: Restaurant Guide (Filtering by...)
Searches using one or the other criteria are no problem, searching for several at once is more difficult and requires more trickery. Here are two threads on matching two categories at once.
You might also want to give glz_custom_fields (original release infos) a try as it has a tag called txp:glz_custom_fields_search_form which builds drop-downs like in your image that can work in combination. Here’s an excerpt from the help:
<txp:glz_custom_fields_search_form results_page="listings" searchby="Area,City,Price" />
This builds a nice search form on the front-end (only selects so far).
results_page – which page (section) should the submit button take the user to (default by default)
searchby (MUST BE SET) – which custom fields should we search by and in what order? (empty by default)
It also has a way of dealing with price ranges (never tried it though). Again from the help:
If you want to define ranges, do the following for the range name (custom set name): Price range £(after)
range – this is really important and must be present for the range to work correctly
£ – don’t use straight symbols (like € or £) but entity ones e.g. £ & €
(after) – don’t leave any spaces after the measuring unit and (after). This basically says where to add the measuring unit – (before) is default. You might have £10-£20 but 10m3-20m3
Ranges are defined 10-20, 21-30 etc. (no measuring units – they get pulled from the custom set name).
One caveat, you have to purchase the plugin, but it is well worth it. You then use custom fields for everything you need to search like this.
TXP Builders – finely-crafted code, design and txp
Offline
#12 2009-01-27 20:51:53
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: Restaurant Guide (Filtering by...)
Thanks everyone for your help, those plugins where really helpfull, They have some issues with 4.0.8 so I will try to find .7 or .6
I will try to implement all this to the searches and see how it goes, I will probably need more help so I will come back here :)
Thanks!
Offline
#13 2009-01-29 09:30:40
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: Restaurant Guide (Filtering by...)
Hello again,
I was trying to structure the site and encounter some problems doing it, I hope you guys can help me.
I am trying to use “sections” “categories” “child categories” and “custom fields” (with the plugins glz_custom_fields + sed_section_fields)
The problem I see is how to use all this to organize in an easy way for my client to upload its content.
For example:
These are the type of articles that will be published with their subdivisions inside:
1.-Restaurants (filters: “price range” “Atmosfere” “Location” “type of food”)
a.- Spanish food
b.- Italian food
c.- Asian food
d.- Contemporary food
e.- Mexican food
f.- etc…
2.-Entertainment (filters: “Location” “type of entertainment”)
a.- Theater
b.- Movies
c.- Clubs
d.- Casino
e.- Music
f.- etc…
3.-Shoping (filters: “Location” “type of shop”)
a.- Jewelry
b.- Flowers
c.- Books
d.- Toys
e.- Clothing
f.- etc…
4.-Beauty & Health (filters: “Location” “type of service”)
a.- Hair Dressers
b.- Spa
c.- Gyms
d.- Medical Centers
e.- etc…
As you can see there is alot of clasification to be done, and dont know what to put in sections, what in categories, child categories, or custome fields.
And make it all searchable by filtering to make it really easy for a user to find something, and also for my client to upload it to the correct place.
Has anyone done something this complicated? or has any idea how it can be done?
Thanks!
Last edited by mlarino (2009-01-29 10:02:17)
Offline
Re: Restaurant Guide (Filtering by...)
I think if you’re going to filter by more than two items at once you should definitely investigate glz_custom_fields, which will mean you will use custom fields more.
Looking at what you’ve written, it looks like every entry has a distinct location and a type that don’t overlap (a hairdressing restaurant is very unlikely) and some have extra information such as “atmosphere” (spelling!) and “price range”, which you might get away with just providing as information (or order-by sort value) rather than as a search criteria.
One suggestion:
- use your 1,2,3,4 headings as parent categories and the a, b, c, d, e, f, as child categories, as you’ve written them out here [ = type ]
- you could use “location” for the other category [ = location ]. Again you could use parent and children categories for towns and districts, regions and towns or whatever.
- maybe you use a grading/price-bracketing system ,e.g. 1-to-5 stars/dots/currency-symbol rather than concrete amounts to reduce the amount of editing you need to do later. As prices change over time, you then only need to change the explanation of the price brackets for each star rather than the prices in every article. You’d only need to change them if a particular shop goes upmarket. You could then use a custom field for this and use it as a “sortby” value rather than a filter.
- “atmosphere” is very subjective, so you might get away without making it a filter criteria but rather an “informative” item.
This is just one way, there are others too.
Last edited by jakob (2009-01-29 10:23:13)
TXP Builders – finely-crafted code, design and txp
Offline
#15 2009-01-29 10:49:21
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: Restaurant Guide (Filtering by...)
Thanks Jakob!
The price range is used for search, because that way someone can search for a Japanese restaurant between 30$-40$, depending on how much they want to spend.
Is something my client wants, because all the competitor websites use it. (but I will try to explain to him that they could be sorted)
Atmosphere could go only in the info, maybe using icons… That way I could use more than one Atmosphere per restaurant (Romantic + Modern)
When you say use =type as one Category and =location as another, they will all be displayed in the “Category 1” and “Category 2” in the Write tab right?
There is no way of separating both Categories with their Childs? (one in Cat.1 and the other in Cat.2?)
Because there will be a really Big amount of locations. Forgot to mention that in Location “Madrid” there will be sub-locations “23 districts” (all need to be used for filtering)
and in the near future, they will want to incorporate “Barcelona” with some more sub-locations. (Maybe Locations can be a Categorie, but sub-locations custome fields?
What do you guys think?
Is it posible to create a method to search by all this fields at the same time? like the one I posted before?
http://www.edwardkinsellaillustration.com/search.jpg
Last edited by mlarino (2009-01-29 11:04:44)
Offline