Support

Home Forums Event Espresso Premium Price Range in Accordion?

Price Range in Accordion?

Posted: May 28, 2014 at 11:46 am


Russ Reynolds

May 28, 2014 at 11:46 am

Hello,

Is it possible to have the price shown for the events in the accordion display a range rather than just the first price?

If so, how?

Thank you.


Dean

May 29, 2014 at 1:08 am

Hi Russ,

You could do it but you would need to edit the template file.

We have a code snippet here (https://gist.github.com/sethshoultes/f05ae8b0c2f549a94d67) that can be used to create a range. This can be added to either the themes functions.php or even to the accordion template itself.

In that Gist is another line that needs to be added in as well:

<?php do_action('action_hook_espresso_price_range', $event_id);?>

It is important to note that this needs to be changed to this:

do_action('action_hook_espresso_price_range', $event->id);

SO in the templates index.php I would change the current price line to the following

?>
<p id="p_event_price-<?php echo $event->id ?>" class="event_price event-cost"><span class="section-title"><?php  echo __('Price: ', 'event_espresso'); ?></span> <?php do_action('action_hook_espresso_price_range', $event->id); ?></p>
<?php

(yes breaking out of PHP is needed for a reason I cannot currently fathom)

Updates to the template would over write these changes.


Russ Reynolds

May 29, 2014 at 6:41 am

Thank you.

I tried changing the code in plugins/espresso-template-category-accordion/index.php file and I am getting errors.

This is the current price line:

echo '<p id="p_event_price-'. $event->id .'" class="event_price event-cost"><span class="section-title">'.__('Price: ', 'event_espresso').'</span> ' . $org_options['currency_symbol'].do_shortcode('[EVENT_PRICE event_id=' . $event->id . ' number="0"]'); '</p>';

Do I replace the whole line with your code (I tried that and I get errors). Or do I still need the echo part (also tried that).

Thank you.


Dean

May 29, 2014 at 6:43 am

Hi,

You need to replace the whole line. Did you add the function (https://gist.github.com/sethshoultes/f05ae8b0c2f549a94d67) to your themes functions.php ?


Russ Reynolds

May 29, 2014 at 6:46 am

Sorry…disregard. When I pasted the code in the file there were some leading spaces or something that was throwing the code off.

Everything works properly, thanks!

The support post ‘Price Range in Accordion?’ 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