Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Holiday agency website

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

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

Page: 1
Go to End
Author Topic: 1324 Views
  • freeyland
    Avatar
    Community Member
    22 Posts

    Holiday agency website Link to this post

    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

  • Sigurd
    Avatar
    Forum Moderator
    628 Posts

    Re: Holiday agency website Link to this post

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

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Holiday agency website Link to this post

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

  • freeyland
    Avatar
    Community Member
    22 Posts

    Re: Holiday agency website Link to this post

    Can I also see a demo of the backend?

  • xmedeko
    Avatar
    Community Member
    94 Posts

    Re: Holiday agency website Link to this post

    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',...);

  • freeyland
    Avatar
    Community Member
    22 Posts

    Re: Holiday agency website Link to this post

    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 ?

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Holiday agency website Link to this post

    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

    1324 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.