Skip to content
Sales Igniter
Sales Igniter
  • Features
    • Features
    • Reviews ⭐⭐⭐⭐⭐
    • Demo
      • Live Stores
      • Live Demo
    • Screenshots
      • Magento 2 / Adobe Commerce
      • WooCommerce / WordPress
  • Pricing
    • Magento 2 / Adobe Commerce
    • WooCommerce / WordPress
    • Magento 1.9.x / OpenMage
    • Web Hosting
  • Help
    • Documentation
      • Magento 2
      • WooCommerce / WordPress
    • Screencast
    • FAQ
    • Blog
  • Account
    • My Account
    • My Account (Alternate)
  • Contact
    • Contact Sales Igniter
    • Custom Project Quote Request
Search
Sales Igniter
Sales Igniter
Search
  • Features
    • Features
    • Reviews ⭐⭐⭐⭐⭐
    • Demo
      • Live Stores
      • Live Demo
    • Screenshots
      • Magento 2 / Adobe Commerce
      • WooCommerce / WordPress
  • Pricing
    • Magento 2 / Adobe Commerce
    • WooCommerce / WordPress
    • Magento 1.9.x / OpenMage
    • Web Hosting
  • Help
    • Documentation
      • Magento 2
      • WooCommerce / WordPress
    • Screencast
    • FAQ
    • Blog
  • Account
    • My Account
    • My Account (Alternate)
  • Contact
    • Contact Sales Igniter
    • Custom Project Quote Request

General

12
  • Quickstart Guide
  • Calendar Widget
  • Protected: Install and Updates Magento 2.2
  • Protected: Install and Updates Magento 2.3.x – 2.4.x Regular Version
  • Protected: Install and Updates Magento 2.3.x – 2.4.x Pro Version
  • Protected: Install and Updates Multi Source Inventory Pro
  • Protected: Install and Updates Rental Multi-Vendor Marketplace
  • Protected: Install and Updates Amasty RFQ Integration
  • Calendar Settings
  • Rental Settings
  • Installing A Specific Version
  • Uninstall or Disable

Content Management

6
  • Spreadsheet Mass Import / Export (CSV)
  • Rental Product Pricing
  • Adding Rental Products
  • Editing Text & Emails
  • Multi-Vendor Marketplace Setup
  • Multi Inventory Setup

Order Management

4
  • Rental Contracts
  • Order Editing
  • Processing Orders
  • Rental Order Extensions

Internationalization

1
  • Languages and Currencies

Installing Extensions

1
  • Installing Third Party Extensions

Troubleshooting

3
  • Theme Integration
  • Module Conflicts
  • Troubleshooting Guide

Programming Guide

1
  • Programming Notes

Version Release Notes

1
  • Release Notes

Reports

1
  • Utilization Report
View Categories
  • Home
  • Doc
  • Magento 2 Rental
  • Programming Guide
  • Programming Notes

Programming Notes

6 min read

Rental Booking API Guide & Integrations #

Learn How To Program In Magento 2 #

Alan Storm has the best and most thorough Magento 2 documentation, we recomend following along with your IDE doing the sample projects to really see how Magento 2 works:  http://alanstorm.com/category/magento-2/

Mage Plaza has a series with a very thorough sample module that shows most parts of the Magento 2 system: https://www.mageplaza.com/magento-2-module-development/

Our Favorite Windows Developer Environment For Magento 2 #

We have tried quite a few Windows stacks for Magento 2 development including WAMP and AMPPS but please take a look at https://wtserver.wtriple.com/ it has speed on par with a real Linux machine because it uses Nginx and PHP-CGI with multiple running processes at a time. When I compared it with my Ubuntu Nginx PHP-FPM the speed was almost the same, whereas with WAMP and AMPPS the speed usually lagged behind about 50 – 70% from the Ubuntu VM.

Where Should Customizations Be Done? #

As is the standard in Magento, NEVER in the base module (vendor/salesigniter/releaserental2), you will need to create your own module and do your customizations there, otherwise your work would be overwritten upon updating the rental module. 

Notes On Our Rental Booking Module #

How Do I? #

1) Delete a reservation for an order? #

app/code/SalesIgniter/Rental/Api/StockManagementInterface.php inject this class

then use $this->StockManagement->deleteReservationsByOrderId($orderId)

2) Retrieve quantity available for a rental product for certain dates? #

app/code/SalesIgniter/Rental/Api/StockManagementInterface.php inject this class

then call it like $this->stockManagement->getAvailableQuantity($Product, $StartDate, $EndDate)

3) Get the rental dates for an order? #

inject app/code/SalesIgniter/Rental/Helper/Calendar.php

then $this->Calendarhelper->getDatesForOrder($order)

4) Retrieve total quantity of a rental product (without taking into account reservations)? #

app/code/SalesIgniter/Rental/Api/StockManagementInterface.php inject this class

then call it like $this->stockManagement->getSirentQuantity($Product)

5) Update the quantity or rental dates for an existing order? #

app/code/SalesIgniter/Rental/Api/StockManagementInterface.php inject this class

then use $this->StockManagement->saveReservation($reservation,$data) look at the method saveFromArray phpdoc in this class to see what $data array expects

6) Do my Own Time & Date Calculations? #

In your class at the top add:

Use League\Period\Period;

Then in your code:
$period = new Period($start, $end);
$period2 = new Period($start2, $end2);
// check if overlaps
$period->overlaps($period2);
More examples and API: http://period.thephpleague.com/examples/

Rental Calendar Info #

1) How does the rental calendar widget work? #

app/code/SalesIgniter/Rental/etc/widget.xml is where it is configured in XML this calls the class:

app/code/SalesIgniter/Rental/Block/Widget/CalendarWidget.php which makes the calendar

2) What are the principles behind our datepicker? #

app/code/SalesIgniter/Rental/view/frontend/web/js/pprdatepicker.js extends via JavaScript prototype the Magento 2 jquery datepicker with various functions necessary for rentals. This is then set to “pprdatepicker” in app/code/SalesIgniter/Rental/view/frontend/requirejs-config.js

3) How does the product page show the calendar and the rental dates get passed from the calendar to the cart? #

On the customer side product page, the calendar is added via app/code/SalesIgniter/Rental/Plugin/Catalog/Template.php aroundFetchView plugin method there are lines:

if ( $subject ->getNameInLayout () === 'product.info.options.wrapper' && $this -> _helperRental-> isFrontend ()) {
  /** @var pQuery\DomNode $dom */
  $dom = pQuery:: parseStr( $html );
  return $this-> _hideStartEndCustomOptions ( $dom) ;
}

This goes to the hideStartEndCustomOptions method which hides the custom options and adds the calendar with this line: $dateFields[0]->parent->append($this->getCalendar()

The calendar html is generated from: app/code/SalesIgniter/Rental/Block/Widget/CalendarWidget.php getHtmlCalendar method

When rent is clicked, app/code/SalesIgniter/Rental/Observer/PrepareOptionsObserver.php this observer takes the dates from the buy request (buy request takes any extra data from the product page form) and saves it to the start and end date custom options.

4) How are rental prices calculated? #

app/code/SalesIgniter/Rental/Model/Product/Price.php getFinalPrice method, if we are on the product page of the customer side ajax is used but it uses this same method. Ajax can be found here: app/code/SalesIgniter/Rental/Controller/Ajax/Price.php

5) How does the customer side calendar load disabled dates (dates which are booked or set disabled by the admin)? #

app/code/SalesIgniter/Rental/view/frontend/web/js/pprdatepicker.js has an ajax call:

$.ajaxq('booked', {
                url: this.options.updateBookedUrl,
                data: dataFormSerialized,

here it is calling app/code/SalesIgniter/Rental/Controller/Ajax/Booked.php which gets all the booked dates, disabled dates, first date available, etc and returns it as a json object. You can see this ajax call if you go to inspect element > network tab in your browser.

Misc Notes On Our Rental Module #

1) How are the pricing and serial grids added to the product edit page? #

app/code/SalesIgniter/Rental/Ui/DataProvider/Product/Form/Modifier/ReservationAdvancedPricing.php

Backend Model For Saving: app/code/SalesIgniter/Rental/Model/Attribute/Backend/RentalPrice.php

app/code/SalesIgniter/Rental/Ui/DataProvider/Product/Form/Modifier/SerialNumbers.php

Backend Model For Saving: app/code/SalesIgniter/Rental/Model/Attribute/Backend/SerialNumbers.php

3) How is the jQuery UI theme set in the code? #

app/code/SalesIgniter/Rental/view/frontend/templates/widgets/calendar.phtml

‘SalesIgniter_Rental::css/datepicker/’ . $themeStyle . ‘/jquery-ui.theme.css’

4) How are qty booked and available added to the products > catalog grid? #

app/code/SalesIgniter/Rental/Ui/Component/Listing/Column/QtyAvailable.php

app/code/SalesIgniter/Rental/Ui/Component/Listing/Column/QtyBooked.php

app/code/SalesIgniter/Rental/view/adminhtml/ui_component/product_listing.xml adds the columns look at the xml:

<column name=”qty” class=”SalesIgniter\Rental\Ui\Component\Listing\Column\Qty”>…</column>

5) How are start date and end date added to the sales > orders grid?  #

app/code/SalesIgniter/Rental/view/adminhtml/ui_component/sales_order_grid.xml adds the columns

app/code/SalesIgniter/Rental/Plugin/AdditionalFields/Provider.php plugin is used to join the reservationorders table that has the start_date and end_date for the grid

6) Admin Edit Product Rental fields how does it disable/enable the setting based on the checkbox “use config settings” and add validation? #

app/code/SalesIgniter/Rental/Ui/DataProvider/Product/Form/Modifier the files in this folder correspond to the config settings, they are injected via the app/code/SalesIgniter/Rental/etc/adminhtml/di.xml file with code like:

<item name =”minPeriod” xsi:type =”string” > SalesIgniter\Rental\Ui\DataProvider\Product\Form\Modifier\MinPeriod </item>

The validation file is: app/code/SalesIgniter/Rental/view/adminhtml/web/js/form/element/rental-period.js

7) How are the rental dates added to the admin create order page? How are the dates stored in session? #

app/code/SalesIgniter/Rental/Plugin/Catalog/Template.php the lines

if ( $this ->_helperRental -> isBackendAdminOrderEdit () && $subject -> getNameInLayout() === 'items' ) {
  /** @var pQuery\DomNode $dom */
  $dom = pQuery:: parseStr( $html );
  return $this-> _appendCalendarAdmin ( $dom) ;
}

When go button is clicked there is an event bound in app/code/SalesIgniter/Rental/view/adminhtml/web/js/pprdatepicker.js

el.find(‘.sirent-go’).click(function () {

which further down uses ajax to call app/code/SalesIgniter/Rental/Controller/Adminhtml/Ajax/ChangeGlobalDates.php which updates the session dates

8) How is the rent button added? #

app/code/SalesIgniter/Rental/Plugin/Catalog/Template.php _renameButtons function

9) How do products have start and end dates tied to them?  #

Dates are saved as custom options. Rental products get added a start and end date to the custom options using: app/code/SalesIgniter/Rental/Plugin/Product/Initialization/Helper/CustomOptionsInit.php and app/code/SalesIgniter/Rental/Plugin/Product/AroundProductRepositorySave.php aroundSave plugin. This means that when you add a rental product in the admin the custom options are auto-added for you as placeholders for the start and end date.

10) How is a reservation stored in the db when an order is placed? #

app/code/SalesIgniter/Rental/Plugin/Sales/Api/OrderManagementInterface.php aroundPlace plugin is used which calls app/code/SalesIgniter/Rental/Api/StockManagementInterface.php reserveOrder method which directs to the reserveOrder method of app/code/SalesIgniter/Rental/Model/StockManagement.php

11) How are rental pricing tables rendered?  #

app/code/SalesIgniter/Rental/Plugin/Pricing/RenderPlugin.php aroundRenderAmount method checks if a product is a rental product. If it is, it calls app/code/SalesIgniter/Rental/Model/Product/PriceCalculations.php getPriceListHtml method to get the price table.

What are your Feelings

  • Happy
  • Normal
  • Sad

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
Programming NotesProgramming Notes
Table of Contents
  • Rental Booking API Guide & Integrations
    • Learn How To Program In Magento 2
    • Our Favorite Windows Developer Environment For Magento 2
    • Where Should Customizations Be Done?
  • Notes On Our Rental Booking Module
    • How Do I?
      • 1) Delete a reservation for an order?
      • 2) Retrieve quantity available for a rental product for certain dates?
      • 3) Get the rental dates for an order?
      • 4) Retrieve total quantity of a rental product (without taking into account reservations)?
      • 5) Update the quantity or rental dates for an existing order?
      • 6) Do my Own Time & Date Calculations?
    • Rental Calendar Info
      • 1) How does the rental calendar widget work?
      • 2) What are the principles behind our datepicker?
      • 3) How does the product page show the calendar and the rental dates get passed from the calendar to the cart?
      • 4) How are rental prices calculated?
      • 5) How does the customer side calendar load disabled dates (dates which are booked or set disabled by the admin)?
    • Misc Notes On Our Rental Module
      • 1) How are the pricing and serial grids added to the product edit page?
      • 3) How is the jQuery UI theme set in the code?
      • 4) How are qty booked and available added to the products > catalog grid?
      • 5) How are start date and end date added to the sales > orders grid? 
      • 6) Admin Edit Product Rental fields how does it disable/enable the setting based on the checkbox “use config settings” and add validation?
      • 7) How are the rental dates added to the admin create order page? How are the dates stored in session?
      • 8) How is the rent button added?
      • 9) How do products have start and end dates tied to them? 
      • 10) How is a reservation stored in the db when an order is placed?
      • 11) How are rental pricing tables rendered? 

Rental Newsletter

Learn about the latest rental industry news, features added to our rental system, and receive special offers. Subscribe now.

loader

OVERVIEW
Home
Features
Pricing
Live Stores
FAQs
Blog
Contact Us
INDUSTRIES SERVED
Audio Video, Computer, Electronics
Baby Equipment Rental System
Car Reservation Software
Clothing, Dress, Purse Rental
Heavy Equipment, Construction
Hotel, Property & Vacation Rentals
Inflatable Bounce House
Movies, Video Games, Board Games
Party & Event Rental Software
Sporting Equipment
Watches and Jewelry Rental
LATEST UPDATES
How to Start An Equipment Rental Business
Rental Pricing: How Much Should I Charge To Make The Most Profit?
How to add Bookings and a Rental Calendar to a Magento 2 website?
10 Brilliant Rental Software Apps You’ll Love
ADDITIONAL LINKS
Terms & Conditions
Free Rental Contract Agreements
Free Rental Pricing Calculator
Awesome Rental Business Resources List
Affiliate Program
Social Media

Copyright © 2026 Sales Igniter. All Rights Reserved

Loading...

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.