Support

Home Forums Event Espresso Premium Ticket Selector Shortcode not showing error message.

Ticket Selector Shortcode not showing error message.

Posted: October 29, 2016 at 10:10 am

Viewing 7 reply threads


Atharveda

October 29, 2016 at 10:10 am

Hi,

We have used this short code “[ESPRESSO_TICKET_SELECTOR event_id=event id]” on a custom template but there is some issue with the error message box. As you can see here: http://adheds.staging.wpengine.com/events/sdf/ if you will hit the “Register Now” button without choosing quantity, then only page refresh with no alert or no warning to choose the quantity. However on the default page it is working fine.

Please let me know how to fix it so that when user clicks the the button without selecting the quantity of the ticket, we can show the error/warning to the user.

Thanks.


Tony

  • Support Staff

October 31, 2016 at 7:16 am

Hi there,

Where do you have that shortcode set?

Are you using do_shortcode() to run the above or adding the shortcode within a visual content builder?


Atharveda

November 1, 2016 at 4:17 am

Hi Tony,

We have created a new single-espresso_events.php template which overrides yours template, and we are using do_shortcode() function in order to get the desire outcomes of the shortcode.

Thanks,
Atharveda


Josh

  • Support Staff

November 1, 2016 at 7:36 am

Instead of using the do_shortcode() function, you can call the ticket selector function ( espresso_ticket_selector() )directly. Shortcodes are not recommended to be used within templates.


Atharveda

November 2, 2016 at 1:51 am

Hi Josh,

Thanks for your reply. However I have added the function espresso_ticket_selector() directly into the template instead of do_shortcode() as per your comments, but it is still not working as you can see here: http://adheds.staging.wpengine.com/events/sdf/ Will you please check again. Below is the format I have used into the template:

<?php echo espresso_ticket_selector($postId); ?>

<?php echo espresso_ticket_selector($event_id = $postId); ?>


Josh

  • Support Staff

November 2, 2016 at 4:29 pm

Since Event Espresso doesn’t automatically load its error message script on every page, we’ll probably need to see the full template code that’s in use to be able to offer you some advise on how to get that error message to appear. Is that something you can post into a paste bin or a gist, then link here?


Atharveda

November 3, 2016 at 2:01 am

OK. Thanks Josh.

Please find the link of template code: http://pastebin.com/saN1q1bt


Josh

  • Support Staff

November 3, 2016 at 3:08 pm

Wow, no loop there, or any WordPress functions to load styles in the header or scripts to the footer?

So on which ever pages where you’re displaying an ESPRESSO_TICKET_SELECTOR short code, you add this to the top of the template right after the opening PHP tag:
EE_Registry::instance()->REQ->set_espresso_page( true );
Then later, somewhere where there’s a loop, you add this:

global $wp_query;
$wp_query->in_the_loop = true;

If you can add a real WordPress loop in that template the above might help. And you most likely will need to change near the top of the page where you have all the scripts and styles, you change it to use the
<?php wp_head(); ?>
function, and likewise the same near the bottom of the template with:
<?php wp_footer(); ?>

Viewing 7 reply threads

The support post ‘Ticket Selector Shortcode not showing error message.’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso