Price Alterators (for developers)
BEE Hotel Price Alterator is a BEE Hotel submodule for Drupal to provide a dynamic price Algorithm for your Hotel prices. With these dynamic prices, BEE Hotel will produce everyday new prices depending lenght of staying, number of people, high/low season, days to checkin, etc. You define the logic as “alterations”, BEE Hotel applies your logic to prices. The Drupal plugin system is giving you here full flexibility to build your own price algorithm, just as you would do manually.

Getting the modules
In an running Drupal enviroment:
composer updatecomposer require drupal/beehotelcd web/sites/DOMAINdrush en beehotel_pricealterator beehotel_pricealterators
“Price Alterator” main module
This is the main module where most of the job is done. Usually located inside modules/contributed, you only need to enable the module. This module will search for every valid Plugin of type “PriceAlterators” inside your Drupal instance. With this module, and related "Price Alterators" module you will be able to design your custom pricing algorith to produce dynamic prices for your Hotel. You have an overview of available alterators at https://YOURSITE/admin/beehotel/pricealterator/alterators.
This module is required by Bee Hotel.
“Price Alterators” module
The “Price Alterators” module is a container with a few alterators distributed with BEE Hotel. Once enabled, the module will provide Plugins of type “PriceAlterators” to the main “Price Alterator” module. When in need of having custom price alterators, you can override this module copying inside your /sites/YOURSITE/modules> or follow the cloning process below.
This module is to be manually enabled via drush or Drupal UI
Clone alterators
Bee Hotel comes with the beehotel_pricealterators sub-module, containing a few optional alterators. You can clone this module under your sites/YOURSITE/modules folder where you can create your own alterators.
How to create custom price alterators
- clone and rename the price algerator form, using the closest to your need from in the src/Form/ folder. IE: is you need a new Price Alterator to manage your Saturday check, you can clone
modules/beehotel_pricealterators/src/Form/SundayCheckin.php - change form class at wish.
- clone and rename plugin, using the closest to your need from in the /src/Plugin/PriceAlterator folder. IE: is you need a new Price Alterator to manage your Saturday check, you can clone
modules/beehotel_pricealterators/src/Plugin/PriceAlterator/SundayCheckin.php - change plugin at whish
- clone/create template, optional.
- add record to beehotel_pricealterators.routing.yml
- add record to beehotel_pricealteratore.module > beehotel_pricealterators_theme()
- clear cache ("
drush cr --uri https://YOURSITE") - enable and set up your new custom alterator at
admin/beehotel/vertical
Coding your custom price alterators
You or your Drupal team will take care of adding more price alterators or editing the existing ones as your own logic. Price alterators are files, plugin in the Drupal environment, where you can set value, conditions, weight, etc. You can have infinite alterators. Best practise would be limit every alternator at the very minimum alteration logic, without having more alterations inside the same alternator. Example: I want to alter the price for Sunday check ins and for night check in. I will create 2 files (plugin). Bee Hotel will add both logics:
- 100 base price
- 100 + 10 for sunday check in (ie:
DOMAIN/modules/bee_hotel/modules/beehotel_pricealterators/src/Plugin/PriceAlterator/SundayCheckin.php) - 110 + 20 for late check in (ie:
DOMAIN/modules/bee_hotel/modules/beehotel_pricealterators/src/Plugin/PriceAlterator/LateCheckin.php) - Clear cache (
drush cr) - Check alterated price: 130
Enabling alterators (two levels)
As Drupal plugin, price alterators can be enabled/disabled by the status value (set to 0 or 1) inside the @PriceAlterator docblock. (+ clear cache). Accepted status are:
Annotation status
Access to the code required.
- 0: "disabled". Won't appear at
admin/beehotel/vertical - 1: "enabled". Will appear at
admin/beehotel/vertical
Runtime status
Access to the admin/beehotel/vertical UI required.
- 0: "disabled". Will be greyed at
admin/beehotel/vertical - 1: "enabled". Will appear at
admin/beehotel/verticalas enabled
Set up alterators
You have an overview of available alterators at https://YOURSITE/beehotel/pricealterator/alterators. Most recent alterators can be set up with values you decide following the "Settings" link.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion