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   1330 Views

Avatar
freeyland

6 July 2007 at 11:37pm Community Member, 22 Posts

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

7 July 2007 at 7:44pm Forum Moderator, 628 Posts

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

Avatar
Willr

7 July 2007 at 11:10pm Forum Moderator, 5511 Posts

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

Avatar
freeyland

8 July 2007 at 6:16am Community Member, 22 Posts

Can I also see a demo of the backend?

Avatar
xmedeko

9 July 2007 at 2:52pm (Last edited: 9 July 2007 2:53pm), Community Member, 94 Posts

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

9 July 2007 at 8:35pm (Last edited: 9 July 2007 8:48pm), Community Member, 22 Posts

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

15 July 2007 at 12:38pm Forum Moderator, 921 Posts

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