Contents
- Rental Booking API Guide & Integrations
- 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?
- How Do I?
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?
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?
$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?
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?
if ( $subject ->getNameInLayout () === 'product.info.options.wrapper' && $this -> _helperRental-> isFrontend ()) { /** @var pQuery\DomNode $dom */ $dom = pQuery:: parseStr( $html ); return $this-> _hideStartEndCustomOptions ( $dom) ; }
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)?
$.ajaxq('booked', { url: this.options.updateBookedUrl, data: dataFormSerialized,
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?
if ( $this ->_helperRental -> isBackendAdminOrderEdit () && $subject -> getNameInLayout() === 'items' ) { /** @var pQuery\DomNode $dom */ $dom = pQuery:: parseStr( $html ); return $this-> _appendCalendarAdmin ( $dom) ; }