Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Holiday agency website


Reply


7 Posts   1347 Views

Avatar
freeyland

Community Member, 22 Posts

6 July 2007 at 11:37pm

Hi,

I have to make a holiday agency website for ski trips.
I've cretaed several page types:
* Holiday_holder: holds the type of holiday (example: group, individual,....)
* Country_holder: holds the country
* Resort: Information of the skiresort (amount of slopes, lifts, height,...)
* Hotel: Info about the hotel (price, ....)

So, a hotel will be located under: Holiday->Country->Resort->Hotel
(example: Group holidays -> France -> Les GEts -> Action Hotel)

Some questions:
1)Where do I best add the available booking periods for a hotel?
I also need to attach to each period, the available rooms for that period and also the roomtypes (2persons, 2children room / 2persons, 1child romm/......
I know you can have a many to may relationship, but how does this work. I can't find the right documentation for this.

2) Is there somewhere a demo available of the current e-commerce website?
Thx,
Frederick Eyland

Avatar
Sigurd

Forum Moderator, 628 Posts

7 July 2007 at 7:44pm

I'll leave someone else to answer #1 but with #2, yes, parentsinc.org.nz is a good demo of the shop . . .

Avatar
Willr

Forum Moderator, 5513 Posts

7 July 2007 at 11:10pm

http://demoshop.silverstripe.com is an another example of the e-commerce module

Avatar
freeyland

Community Member, 22 Posts

8 July 2007 at 6:16am

Can I also see a demo of the backend?

Avatar
xmedeko

Community Member, 94 Posts

9 July 2007 at 2:52pm

Edited: 09/07/2007 2:53pm

just a hint, maybe there are mistakes

class Period extends DataObject {
static has_one = array (
'Hotel' => 'Hotel';
);
}

class Hotel ... {
static has_many = array(
'Periods' => 'Period';
);

//usage
$periods = $this->Periods();
// or maybe
$periods = $this->getManyManyComponents('Periods');
// for more sophisticated queries
$periods = DataObject::get('Period',...);

Avatar
freeyland

Community Member, 22 Posts

9 July 2007 at 8:35pm

Edited: 09/07/2007 8:48pm

This is my hotel.php script

<?

/**
* Defines the Hotel page type
*/
class Hotel extends Page {
static $db = array(
'PriceInfo' => 'Text'
);
static $has_one = array(
   'Photo' => 'Image'
);

static has_many = array(
'Periods' => 'Period';
);

static $icon = "mysite/images/treeicons/hotel";
static $defaults = array(
      'ProvideComments' => false
   );
static $allowed_children = array('Room');

function getCMSFields() {
   $fields = parent::getCMSFields();
   $fields->addFieldToTab("Root.Content.Images", new ImageField('Photo'));
$fields->addFieldToTab("Root.Content.Price Info", new HTMLEditorField("PriceInfo","Give price information"));
   return $fields
}
}

class Hotel_Controller extends Page_Controller {

}

?>

Questions:
--------------
* Where do I add the code in the script:

class Period extends DataObject {
static has_one = array (
'Hotel' => 'Hotel';
);
}

* Where do I add the several available periods? Do I need to make for each period a node in the sitetree?

* To select the different periods available for hotel, I use TreeMultiselectField?

$periods = $this->getManyManyComponents('Periods');
$fields->addFieldToTab("Root.Content.Price Info", new TreeMultiselectField("Periods","Give the available
periods",$periods , $keyField, $labelField));

What do I put in $keyField ?

Avatar
Sean

Forum Moderator, 922 Posts

15 July 2007 at 12:38pm

You don't necessarily need to use TreeMultiSelect, for example you could use CheckboxSetField which would allow the same behaviour where a dropdown field wouldn't work since you're only selecting one component.

Cheers,
Sean