Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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

#5 2009-01-26 13:30:25

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

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.

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

#7 2009-01-26 15:41:48

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

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.

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

#9 2009-01-26 17:32:11

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

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:

  1. the lowest price
  2. 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.

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

#11 2009-01-26 18:30:32

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,730
Website

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 &pound;(after)

range – this is really important and must be present for the range to work correctly
&pound; – don’t use straight symbols (like € or £) but entity ones e.g. &pound; & &euro;
(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

Board footer

Powered by FluxBB