Support

Home Forums Pre-Releases Prices 'From' Price range on single event page.

Prices 'From' Price range on single event page.

Posted: May 23, 2015 at 2:57 am

Viewing 21 reply threads


Arjan

May 23, 2015 at 2:57 am

Hi!

I have a question regarding events with multiple ticket variations and attached prices.

I have an event with three prices: €28,- / €15,- / €5,-

The problem is that when I look at the single event page, I can see “prices from: €28,-” while this should be “prices from: €5,-”

How can I resolve this?

Thanks alot in advance.


Arjan

May 23, 2015 at 3:38 am

Link to the event: http://www.zeeheldentheater.nl/new/events/pindakaas-met-sambal-2-0-4-2/


Lorenzo Orlando Caum

  • Support Staff

May 25, 2015 at 9:17 am

Hi Arjan, I’m seeing different pricing than what was shared in your example. Were you able to resolve this issue?


Lorenzo


Arjan

May 26, 2015 at 2:15 am

Hello Lorenzo,

Thanks for your reply.

I’m going to share with you this event example:
http://www.zeeheldentheater.nl/new/events/pindakaas-met-sambal-2-0-4-2/

There are multiple issues now:
1. Prices for this event start at €4.25 and it show ‘from €8.50’ on the frontend.
2. The start time of the event shows 2 hours earlier on the frontend of the site than in the backend Event settings.
3. This event starts at Thursday 10th of June, but the 10th of June is on a Wednesday in 2015. The time in WordPress is set to ‘Amsterdam’ which is correct since I’m in The Netherlands.
4. Event Description Text filled in on the backend as paragraphs (written with hard Enter between lines) show as 1 big lump of text on the front end.

Screenshots of this Event settings:
image 1
image 2

Thanks


Arjan

May 26, 2015 at 2:20 am

Code I used for prices and date of event.
code


Dean

May 26, 2015 at 5:04 am

Hi,

1) This is custom code, so I would advise you to re-examine it. For instance, the first_ticket() does not necessary mean the first one in order, usually it means the first one created http://take.ms/p71EW
That is also only used by legacy code, so it is basically deprecated code.

You may want to try primary_datetime() or use datetimes_ordered() then loop through the resulting array looking for the datetime name, then pull the ticket from that.

2) Please try setting the time to UTC+2

3) The above may assist with this, but also please check your custom code as I am unsure what your day_conversation() and month_conversation() functions refer to.

4) Did you type in the text initially, or paste it in? Can you test with a default theme please? (Theme Test Drive plugin is very useful for this! https://wordpress.org/plugins/theme-test-drive/ )


Arjan

May 26, 2015 at 6:33 am

Hi Dean,

Thanks for your reply.

Issues 2,3 are resolved now. The UTC+2 did the trick and the Day display error was a misinterpreted translation from the foreign coders in functions.php

Still dealing with 1 and 4.

4 I am going to test and look for a solution myself.

Regarding 1: Do you have a correct line of code to display ‘Prices: From’ as in where the cheapest price would be €4,25 it would display ‘Prices from: €4,25’ ?

Using EE4.

Thanks alot.


Lorenzo Orlando Caum

  • Support Staff

May 26, 2015 at 11:01 am

Hi Arjan, I have an example for the events table view template add-on but you should be able to adapt it for your use case. See this tutorial:

https://gist.github.com/lorenzocaum/ef6afefd07c9c5f6f681


Lorenzo


Arjan

May 28, 2015 at 4:30 am

Hi Lorenzo,

I used your code to display “pricing from” but it still doesn’t show the cheapest price.

In this example I have 20 tickets of €4.25 but it still shows pricing from €8.50
http://www.zeeheldentheater.nl/new/events/pindakaas-met-sambal-2-0-4-2/


Arjan

May 28, 2015 at 4:30 am

I used the following code:

<?php
foreach ( $datetimes as $datetime ) {
$startdat = $datetime->start_date_and_time();
}

// grab array of EE_Ticket objects for event
$tickets = espresso_event_tickets_available( $post->ID, FALSE, FALSE );
// grab first ticket from array
$ticket = array_shift( $tickets );
$ticket_price = $ticket instanceof EE_Ticket ? $ticket->pretty_price() : ”;
$ticket_price_data_value = $ticket instanceof EE_Ticket ? $ticket->price() : ”;
$tickets_price_free_check = $ticket_price_data_value == 0 ? __(‘Free’,’event_espresso’) : $ticket_price;
// grab primary datetime for event
$first_datetime = espresso_event_date_obj( $post->ID );
$tickets_left = $first_datetime instanceof EE_Datetime ? $first_datetime->tickets_remaining() : 0;
$tickets_left = $tickets_left === INF ? __(‘unlimited’,’event_espresso’) : $tickets_left;

?>
<p class=”starting_from_pricing event-<?php echo $post->ID; ?>”>Prijzen v.a.<?php echo $tickets_price_free_check; ?></p>


Arjan

May 28, 2015 at 4:59 am

After testing it seems that it displays the price of the ticket that is created first and not the ticket that has the lowest price, which is what I want.


Lorenzo Orlando Caum

  • Support Staff

May 28, 2015 at 7:17 am

Try this instead:

https://eventespresso.com/topic/ee4-upcoming-events-widget-to-show-ticket-price-lowest-if-more-than-one/#post-148213


Lorenzo


Arjan

May 29, 2015 at 4:13 am

That code didn’t work for me. I’ve adjusted it with help from my colleague and this works:

<?php
$events = EEM_Event::instance()->get_all();
$e = $events[get_the_ID()];
$tickets = $e->first_datetime()->tickets();
$ticket_prices = array();
foreach ($tickets as $ticket ) {
array_push($ticket_prices, $ticket->price());
}
$lowest_price = min($ticket_prices);
echo ‘Prices from €’ . $lowest_price;
?>


Arjan

May 29, 2015 at 4:13 am

That code didn’t work for me. I’ve adjusted it with help from my colleague and this works:

<?php
$events = EEM_Event::instance()->get_all();
$e = $events[get_the_ID()];
$tickets = $e->first_datetime()->tickets();
$ticket_prices = array();
foreach ($tickets as $ticket ) {
array_push($ticket_prices, $ticket->price());
}
$lowest_price = min($ticket_prices);
echo ‘Prices from €’ . $lowest_price;
?>

Thanks for your help!


Dean

May 29, 2015 at 5:04 am

Hi,

Anything else we can help with or may we mark this as resolved?


Arjan

May 29, 2015 at 6:00 am

There’s one more thing;

Is there a piece of code which I can use to display only the full event description text on the frontend?


Lorenzo Orlando Caum

  • Support Staff

May 29, 2015 at 9:07 am

Hi Arjan, events are stored as custom post types so you can display the content if you know the post ID (event ID). This also works for the excerpt (event summary).


Lorenzo


Arjan

June 1, 2015 at 9:22 am

I see, but this code displays all the info of an event, and I just need the full text description. (not the excerpt)

<?php
// Start the Loop.
while ( have_posts() ) : the_post();
// Include the post TYPE-specific template for the content.
espresso_get_template_part( ‘content’, ‘espresso_events’ );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}
endwhile;
?>


Arjan

June 2, 2015 at 6:40 am

Last issue is solved!


Lorenzo Orlando Caum

  • Support Staff

June 2, 2015 at 11:57 am

Hi Arjan, I’m curious if I misunderstood your prior question. Could you let us know how to resolved your prior issue regarding getting the event description?


Lorenzo


Arjan

June 3, 2015 at 2:45 am

Hi Lorenzo. sure.

First is used this code to display the event description:
<?php echo $post->post_content;?>

But then the text came out as a big lump of text without paragraphs.

Then I used this and that did the trick
<?php echo apply_filters('the_content', $post->post_content);?>

After that I had to filter out the event text description by hiding all the other elements with CSS. (ticket selector, etc.)

Would be nicer if you just had template tags for displaying individual elements.


Lorenzo Orlando Caum

  • Support Staff

June 3, 2015 at 9:10 am

Thanks Arjan, that is what I was referring to.

Enjoy your week!


Lorenzo

Viewing 21 reply threads

The support post ‘Prices 'From' Price range on single event page.’ 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