This help article is focused on setting up redirection from website created using Wix.com to Rentlio Booking Engine. We will focus on redirection flow, for design and layout please consult appropriate Wix.com documentation.
For documentation purposes, examples are show on Modern Hotel template on Wix.com. Instructions are in the video.
Code to use below, please replace rbeUrl with your Booking Engine URL:
import wixLocation from 'wix-location';
$w.onReady(function () {
// Attach the click event to the button
$w(‘#button1’).onClick(() => {
redirectToBookingEngine();
});
});
function getDateString(date) {
return date.getDate().toString() + ‘-’ + (date.getMonth() + 1).toString() + ‘-’ + date.getFullYear().toString();
}function redirectToBookingEngine() {
// Replace the URL with your Booking Engine URL
const rbeUrl = ‘https://cuki.book.rentl.io';
// Get values from Wix page elements
let from = $w(‘#datePicker1’).value; // Ensure this is a date picker element
let to = $w(‘#datePicker2’).value; // Ensure this is a date picker element
let adults = $w(‘#input1’).value; // Ensure this is a valid input element if (from && to && adults) { // Validate values
let fromString = getDateString(from);
let toString = getDateString(to);
let fullUrl = `${rbeUrl}?from=${fromString}&to=${toString}&adults=${adults}`;
// Redirect to the constructed URL
wixLocation.to(fullUrl);
} else {
console.log(‘Please fill all the fields before proceeding.’);
}
}