How to show Easy Appointments via ajax call to WP admin-ajax.php in a multi-step form
do_shortcode('[ea_bootstrap width="800px" scroll_off="true" layout_cols="1"]');
wasn't successful. My initial attempt was to add this to my theme's functions.php file:
add_action('wp_ajax_get_reservation_form', 'get_reservation_form');
add_action('wp_ajax_nopriv_get_reservation_form', 'get_reservation_form');
function get_reservation_form () {
$eaBootstrap = require_once(WP_PLUGIN_DIR . '/easy-appointments/main.php');
echo $eaBootstrap;
}
I was able to confirm that $ea_app at the very end of main.php gets instantiated via the ajax call, but when trying to call ea_bootstrap function with code parameters, e.g.
$eaParams = array (
'location' => 1,
'service' => 1,
'worker' => 1,
'scroll_off' => true,
'layout_cols' => '1',
'width' => '800px'
);
$eaObject = new EAFrontend;
$eaObject->ea_bootstrap($eaParams);
my code returns an error => PHP Fatal error: Uncaught Error: Call to a member function get_options() on null.
Any idea what I'm doing wrong? Thank you very much in advance for your help,
Peter Did you get the shortcode working in admin-ajax?
I want to show our calendar on a tab that is loaded via admin-ajax and it shows the shortcode text in the tab:[ea_bootstrap width="700px" scroll_off="true" layout_cols="2" show_remaining_slots="1"] Instead of the shortcode content... So how can I register this shortcode to get it working even in ajax loaded tab?
Hi Jakub, can you please tell me where you want to render form?
Best regards,
Nikola
This is our test website: https://golf.listero.cz/golfova-hriste/ropice/ropice-golf-resort/?tab=teetime I want to show it on the “teetime” tab.
The same shortcode works fine here https://golf.listero.cz/golfova-hriste/ropice/ropice-golf-resort/
The teetime tab is loaded via admin-ajax.php
Other shortcodes works there. For example this tab https://golf.listero.cz/golfova-hriste/ropice/ropice-golf-resort/?tab=v-okoli is made by some other shortcode
Hi Jakub, I get it now. There is no easy solution for this but you can do something else. Create a empty page with just EA form. So you then you can include that page as iframe into that second tab. That will work without problem.
Best regards,
Nikola
Hi Nikola. Thank you very much for your answer. I was thinking about iframe as the last option. That is not really profesinal way to do that. Do you know any freelancer or profesional that would write a custom solution for us? I will need some more modifications. For example a dashboard for our users (listing owners) where they could manage their timeslots
If you want some customization I can also do that for you. Can you please share more info so we can calculate price and time. You can send it to nikolanbg[at]gmail[dot]com
Best regards,
Nikola
Please login or Register to submit your answer