Sorting on multiple price fields

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
thinsoldier
Forum Contributor
Posts: 367
Joined: Fri Jul 20, 2007 11:29 am
Contact:

Sorting on multiple price fields

Post by thinsoldier »

I'm trying to make a kind of "vacation rental" listings site and I've been asked to make it handle multiple price values:
Price per night
Price per week
Price per month

Just adding those 3 fields is easy of course but where it gets complicated is it has to be able to sort the search results by price.

I've been looking for examples of this on other sites and I've found this one
http://www.homeaway.com/search/caribbea ... n:9/page:2 (you may need to do another search manually and sort it by price)

It claims to allow sorting by price but when I do that initially it seems to sort them but as you look through there are a number of items that seem out of place based on their price.

How do you think this site is sorting it's results?

The other complication is the possibility of going with a mix price ranges along with single price fields.
For example
$100 - $200 per night
$600 - $850 per week
$3000 per mont

How should I approach sorting my results?
Warning: I have no idea what I'm talking about.
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Sorting on multiple price fields

Post by Jade »

Personally I would put this into context with what the person is searching for. If they're looking to rent a place for less than a week I'd show them nightly rates and then maybe have a comparison column that shows what they'd save if they rented it for a whole week. That way you can show them the prices that are most relevant to the time period they're looking to rent.
Post Reply