Back to Room Booking Pro Support

webworx.studio
webworx.studio

Hi,

I bought your plugin and I need the room quantity function, can you give me a hint where to start so I can extend it? Any help or guide would be great. Thanks!

  • Matthew
Briddle
Briddle

Hi Matthew,

Thank you for your purchase.

To remain compatible with future updates to my Room Booking Pro plugin you need to create a new plugin yourself that extends my Room Booking Pro plugin. Your plugin can overwrite or add functionality to my Room Booking Pro plugin. So start by creating a new (blank) plugin.

If you have never created a plugin for October CMS you can read the documentation at https://octobercms.com/docs/plugin

I will post some details here for extending my Room Booking Pro plugin to support room quantities later today (it is 09:45 here).

Briddle
Briddle

Hi Matthew,

Ok, let's start by detailing what we have:

  1. If a visitor searches available rooms on our website we check the availability of our rooms against the bookings in our database and only show the rooms that are vacant for the given period.
  2. If a visitor books a room, we add the booking to our database.

If we want to support room quantities we have to make some changes:

  1. If a visitor searches available rooms on our website we check the availability of our rooms against the bookings in our database and only show the rooms that are vacant for the given period. We have to overwrite this function. Instead of simply checking for a booking we have to count the number of bookings for this room and make sure it is below the room quantity. Thanks to October CMS we can do this from within our own plugin.
  2. If a visitor books a room, we add the booking to our database. No need to change anything here.
  3. We also need a way to store the room quantity for each room. We have to add a new field to our rooms (e.g. quantity) to store the number of rooms we have of the same type. Thanks to October CMS we can do this from within our own plugin.

Please see the docs here: https://octobercms.com/docs/plugin/extending and do let me know if you need further assistance so we can take it from there!

webworx.studio
webworx.studio

Hi, thanks for responding. This is great help. I'll be updating you here :)

webworx.studio
webworx.studio

Hi, I extended the Feature model successfully, my problem now is I don't know how to fetch the icons of each feature. Any hints? Thanks :)

// Features Icon
        FeatureModel::extend(function ($model){
            $model->attachOne['feat_icon'] = [
                'System\Models\File'
            ];
            $model->addFillable([
                'feat_icon',
            ]);
        });
        FeaturesController::extendFormFields(function($form, $model, $context){
            if (!$model instanceof FeatureModel) return;
            $form->addFields([
                'feat_icon' => [
                    'label' => 'Icon',
                    'mode' => 'image',
                    'type' => 'fileupload',
                    'span' => 'left',
                    'thumbOptions' => [
                        'mode' => 'auto',
                        'extension' => 'auto'
                    ],
                    'imgeWidth' => 'auto'
                ],
            ]);
        });
Briddle
Briddle

Hi Matthew,

Sorry I missed the notification for your reply here.

Room features use the Font Awesome library so you can simply use those names.

1-6 of 6