Support

Home Forums Event Espresso Premium All venues show up in my cart

All venues show up in my cart

Posted: October 2, 2013 at 9:10 am


Sarah Rogers

October 2, 2013 at 9:10 am

Hello,

I’m using the venue shortcode in my theme and it works perfectly – except in my cart where it shows ALL of my venues.

http://kindragoehler.com/mbi/funny/event-registration/?regevent_action=show_shopping_cart

Is there a way to hide this?

Thank you!


Tony

  • Support Staff

October 2, 2013 at 1:54 pm

Hi Sarah,

Which venue shortcode are you using? It looks like just [ESPRESSO-VENUE]

All venues are shown when no event_id is set, either manually, globally or through the URL.

So in order to only show one event you need pass the shortcode a Venue ID or an Event ID which has a venue assigned to it.

https://eventespresso.com/wiki/shortcodes-template-variables/#venue

So the shortcode [ESPRESSO-VENUE id=4] would load the venue with id 4.
[ESPRESSO-VENUE event_id=27] would load the venue assigned to event with ID 27.


Sarah Rogers

October 2, 2013 at 2:28 pm

Do you mean something like this?

<?php echo do_shortcode("[ESPRESSO_VENUE event_id=" . $event->id . "]"); ?>


Josh

  • Support Staff

October 2, 2013 at 3:46 pm

Usually it’s:

<?php echo do_shortcode('[ESPRESSO_VENUE event_id="' . $event_id . '"]'); ?>

Note the single and double quotes. The variable for the event ID will depend on what is already set.

Is the event_id variable is set/coded into the theme?


Sarah Rogers

October 2, 2013 at 3:53 pm

Thanks Josh the event_id variable isn’t coded into the theme by this part – it’s outside the loop, if you will. I know how to get around that in WordPress – but not in EE ๐Ÿ™‚


Dean

October 3, 2013 at 1:50 am

Hi,

On the shopping cart page the event details are held in an array called $result.

So if you wanted to show the event venues I would use something like

id . ‘”]’);
}
?>

There is already a foreach loop in the shopping-cart.php that you can add the shortcode into if needed.

However I havent tested that fully, and it may not work in a sidebar, it depends on how you have things set up.


Sarah Rogers

October 3, 2013 at 9:21 am

Hey Guys,

I don’t want any venues to show in my shopping cart. Right now I’m using just the <?php echo do_shortcode("[ESPRESSO_VENUE]"); ?> in my sidebar outside the EE “loop”. Any idea about how to hide the venues when the shopping cart is invoked?


Sidney Harrell

October 3, 2013 at 10:10 am

Wrap that do_shortcode in a conditional, if ($_GET[‘regevent_action’]==’show_shopping_cart’).

<?php if ($_GET['regevent_action']=='show_shopping_cart') {
   echo do_shortcode("[ESPRESSO_VENUE]");
 } ?>


Josh

  • Support Staff

October 3, 2013 at 10:19 am

Hi Sarah,

Here’s one idea:

<?php 
global $this_event_id;

if (isset($this_event_id))
echo do_shortcode("[ESPRESSO_VENUE]"); 

?>


Sarah Rogers

October 3, 2013 at 10:29 am

Hi Josh – that solution worked PERFECTLY!

Thank you. You guys have provided awesome support ๐Ÿ™‚

I’ve recommended EE to several of my clients and I’m actually starting another project using it today.

The support post ‘All venues show up in my cart’ 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