Tuesday 17 October 2006 2:15:39 am
Good morning to everybody!
After a quite long pause using eZpublish, I'm back on it. I'm developing a travel web site, almost like lastminute.com or EDreams.
I have an object (travel_offer) with some attributes (name, publish_start, publish_end, tour_operator, ecc. ecc.).
This object is also a container for the prices (object: price). Object price has these attributes:
sell_mode: selection (how do we sell this package? on request or on a free sales basis?)
price_list: object relation with pricelists (net, gross, discounts, etc.)
treatment: object relation with treatments (full board, half board, etc.)
room_type: object relation with room_types (single, double, twin, etc)
departure_id: object relation with departure_cities (Rome, Milan, Venice, etc)
start_date: date object (first departure)
end_date: date object (last departure)
weekdays: selection (Mon, Tue, ..., Sun) prices: matrix (base price + several fees like airport taxes)
Suppose I've a travel offer, departing from Rome and Milan every Tuesday and every Saturday from 1st Nov to 31st Dec. I need to create one price object per each date, city: if I would write the code from scratch it would look like:
$oneday = 60 * 60 * 24; //Number of seconds in one day
foreach ( $departure_cities as $dep) {
for ( $i=$start_date; $i<$end_date; $i+=$oneday ) {
foreach ( $weekdays as $day ) {
if ( date ("D", $i ) == $day ) {
$object->setday = $day;
$object->setdate = $i;
$object->setcity = $dep;
$object->store();
}
}
}
}
In this way I could get in the "database" one row per date/day per departure city.
Why do I need this? Because I need to store with prices also informations related to allottments (how many seats on the plane and/or how many rooms we bought in advance) and I need the ability to change the prices for single departure city or date.
I was thinking about using the workflows, but I'd like to know if someone can point me to some kind of solution. In the meanwhile, I'm reading the eZpublish book, but it'd based on the older eZp 3.2 and I'm not sure that the solution I'll study will be working on 3.8.4 (the one I'm using now).
Ciao, Roberto
|