• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Using Fullcalendar as a rental calendar help/advice

DHR

New member
Jul 19, 2022
1
0
1
Hello! I am stuck on something I am developing and looking for a nudge in the right direction.

I am unsure if I am allowed to post links to examples, so I will begin by saying I am trying to create a rental system for wordpress based on Keltic Rentals. After thinking about it, I don't think this is a wordpress question, as all the wordpress specific stuff I am able to figure out. Rather, this is specific to FullCalendar, PHP, and AJAX.

Foundation of functionality:
-User clicks on product (Products are a rental product type in woocommerce that I created with a daily rate, weekly rate, monthly rate, and weekend rate)
-User chooses Quantity
-User selects date range in FullCalendar for when they want to rent the equipment
-User selects delivery or pickup
-Price is calculated
-Checkout process

Overview of what I am having problems with:
The main part that I am stuck on is selecting the dates and calculating price. I already have the delivery section done and I believe I can figure out how to push the prices to the checkout and cart. But holding the stock and updating dates is where I am completely lost.

I expect this is how it should run:
-When the product page loads, the fullcalendar loads and displays the dates where the equipment is already rented out. I have this setup currently in FullCalendar to load rental dates from the SQL database from a table I created called "Rentals".
-The user chooses quantity and then uses the calendar to select the date range, along with delivery options
-When selecting the dates, the site will ensure there is enough quantity available for the rental period (I believe this can be done through javascript)
-After selection is confirmed, prices are then calculated in accordance to the above rates. For example, if someone selects a week, they get charged a week, if they select a weekend and two days, they are charges as such, if they choose a month, a day, and a weekend, they are charged accordingly and etc.
-Upon add to cart, a temporary rental is created to hold the rental until payment where it will become permanent

Descriptions of the problems:
1. When the page loads with the calendar and rental periods, when I choose a date range in fullcalendar, it "overwrites" the periods already in the calendar. For example, if I load the calendar and it has two rental dates populated, when I try to select a new date range it will remove the oldest rental period and show the new one. And then if you select a second one, it will replace the second rental period that was pre-populated. A third option will replace the first new choice, and etc.

-I need to somehow make the selection completely independent of the populated dates.
-It only overwrites it on the frontend, once you refresh, the database rental dates are populated again.
-I need the selection to be a different "event source" from the database, but then be saved in the database. Therefore I know the selected date range requires to be its own source, as it should be able to overwrite itself, but nothing else. Will temporary events require another table? Or is there a way to do this with AJAX?

2. I am unsure how I am able to create a temporary rental period based on the period being in a customer's cart.

3. I honestly have no idea how I am going to structure the pricing or how to determine if it falls on a weekend or weekday etc.


What I am asking:

1. Can anyone point me in the right direction to learn how to use FullCalendar more effectively? I am at a loss on how to fix it overwriting the pre-populated dates and be its own source.

2. What can I do to make a temporary rental that will be removed if the customer removes it from their cart and/or after a set amount of time?

3. Will this be best done through AJAX? SQL?

4. Anyone have an idea of how I can calculate that price?


Thank you to anyone who took the time to read my question.
And I would be more than thankful for any resources on this as well!
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock