Skip Navigation

[Resolved] insert a calendar in a post form to create a new post based on custom post type

This support ticket is created 3 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 12 replies, has 2 voices.

Last updated by andreaP-10 3 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#2192751
new appuntamento 02.JPG
new appuntamento 01.JPG

I created a custom post type named "appuntamenti" to allow a customer to shedule an appointment wit a medician
In the related custom post field I added a field named "data appuntamento" that contain the date and the hour the customer choice for the appointment
I finally created a post form to submit a new "appuntamento", putting it in a new page (see the attachement)
I whould like let the customer choice the date by a calendar like you can see in the attachement (it maked by a plugin named "Appointment Hour Booking" but I can use any other one) to show only the slot available
Is it possible? and if yes, how can I do this?
If is it not possible, do you have any suggestion to an alternative way?

#2192863

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

There is no such integration available but I think if you able to add the shortcode that should display the calendar picker then you can use it and we can save the date slots you picked in your desired format in to custom fields using the Toolset forms API.

At the moment, I do not have any recommendation for any other plugin that is why you will have to check which plugin best suits you as per your requirement.

#2192977

Hi Minesh, thanks for your prompt reply.
I have just another question: the post type is related one to many to the post type "medici". When the user schedule a new "appuntamento", he/she choice the medician too. How can I show the medician name in the notification I set when the user submit the form?
Thanks
AP

#2192985

Hi Minesh,
please disregard my last request. There was a specific option in the notification area. I apologize.
So, to close the ticket, could you help me write a code that writes the date taken from the plugin in the "date" field?

#2193787

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

So, to close the ticket, could you help me write a code that writes the date taken from the plugin in the "date" field?
==>
Can you please share details what plugin you are using - are you adding the date field within the Toolset form?

I could not able to share the code until I check what date field you are using and that plugin that you are going to use how it stores the data internally.

Can you please share problem URL where you added the date field within the form and tell me what content you want to save to what Toolset custom date field?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2200593

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

When I try to submit the form I get the following fatal error from the plugin "appointment-hour-booking" you are using:

Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 671088640 bytes) in /home/customer/www/odontoiatriaetica.net/public_html/wp-content/plugins/appointment-hour-booking/classes/cp-base-class.inc.php on line 87

Can you please check with plugin author why you get the fatal error?

I also notice that you can select multiple date and time slots using the booking calendar you are using but how do you want to save the content of multiple booking to single field "data-appuntamento"?

Can you please check with plugin author that how you can save the content selected using booking calendar to Types custom field?
We offer the Toolset form's API hook "cred_before_save_data" that we can use to grab the posted data of form and then convert it to Types custom field but again my main query is how you want to store multiple booking?
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_before_save_data

#2200783

Hi Minesh,
even though the "appointment-hour-booking" plugin is designed to allow the user to choose multiple slots, my intention is that the user can choose only one date and hour for his appointment from those available (I still have no idea how to identify available dates but I will address this topic later. One problem at a time 🙂 ).
This feature, along with the fatal error you got when submitting the form, suggests to me that this plugin is not what I need for
Any suggestion to choice a different way?
May can be a solution set one repeatable field in the custom field "appuntamenti" as, for example, "available slots"?
Thank you

#2200879

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

If you only want to allow user to select one booking at a time what if you create a radio custom field with available time slot options?

#2200883

Yes, but the date? Today I may have some availability, tomorrow others, etc. ..

#2200885

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

So - what if you try to use the two field one custom date field that offers date and one radio field that should offer the available time slots - will that work?

#2200893

Yes but how could I set only the available dates? for example, how can i exclude holidays or non available days? And how could I do this dinamically?

#2200899

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

There is no such feature available with Toolset. You will obviously have to find the best calendar plugin that offers you such feature and you can workaround in such way that on page 1 you should offer such calendar to select available dates and once its selected you should redirect user to page 2 that should hold the form and you can set the selected dates as URL param when you redirect to page 2 so on page 2 we will have access to to the selected dates and time-slot that is selected by user on page 1.

This is what I'm thinking but you will have you workout and do feasibility check that what is the best calendar plugin you should be using that suits best per your requirement.

#2200907

Ok. I will think about one of the solutions you suggest me. Thank you!