Jump to content
Larry Ullman's Book Forums

Database Schema For Different Prices At Different Times Of The Year


Recommended Posts

Hello,

 

I'm building a site for a villa where they will be taking online bookings, it's mostly straightforward but I'm trying to find the best way to calculate a different price for different seasons (calculated by the day), bearing in mind that one booking could straddle two seasons.

 

Any ideas?

 

Cheers,

 

Jon

Link to comment
Share on other sites

Interesting question. Two options in my mind. One, just create four season columns in the database with the price for each season set. Then you'd use PHP to compare the chosen dates against the season dates (i.e., the definition of a season would be written into PHP). And the PHP code could decide how to handle a straddler.

 

Or you could create a table that stores date ranges and prices (so X records for X seasons per year). You'd then need to use some logic in PHP to get the dates for multiple seasons and apply the right rates.

Link to comment
Share on other sites

 Share

×
×
  • Create New...