Support

Home Forums Event Espresso Premium Event price not shown correctly in event-list.php

Event price not shown correctly in event-list.php

Posted: February 18, 2013 at 7:10 am

Viewing 4 reply threads


Frank Grafenstein

February 18, 2013 at 7:10 am

Once you have a couple of events with multiple price-types, event-list-display.php shows always the cost of the first price_type of a specific event_id.
This may be in one case ‘standard’ price_type, but in another case the ‘reduced special’ price type.
This is due to the weak structure of mysql-tabele ‘event_prices’: Once there are multiple rows with the same event_id, SQL-select statement fetches always the first row (with the lowest table-id). This may be a standard price or even a special price.

This produces nonsens! Please change the table-structure (for eample add an price_type_id/-weight) or omitt the display of only a part of event-prices!

Sorry, I am not a professionell programmer, however this is of very low quality! I hope you can fix this very fast.

Thank you
Frank


Josh

  • Support Staff

February 18, 2013 at 8:48 am

Hi Frank,

Thanks for taking the time to leave this valuable feedback. We can address this in a future version of Event Espresso. In the meantime, you can change the price display in event_list_display.php to grab the first price in the array by using the event_price shortcode:

In event_list_display.php look for this:

<?php echo  $org_options['currency_symbol'].$event->event_cost; ?>

and replace with this:

<?php echo  $org_options['currency_symbol'].do_shortcode('[EVENT_PRICE event_id="'.$event_id.'" number="0"]'); ?>


Frank Grafenstein

February 18, 2013 at 12:20 pm

Useful hint. Thank you. It replaces an additional SELECT statement from event_prices-Table.
However, your suggestion hits the first row, if there are multiple for the same event_id.
In my case (I do not know how this happend, but it did happen) the standard price option corresponds first row for one event, but the second row for another event.

Right thing would be to replace column VARCHAR ‘price_type’ by an INTEGER ‘price_type’ (or at least to add such a column ‘price_type_int’), numbering the price_types. Sorting results using integer price_type would be much easier then varchar-price_type, for example you could fetch always price_type_int=1.

Something like that …

My workaround was the following:
1) Additional SELECT statement:
$sql = “SELECT * FROM “.EVENTS_PRICES_TABLE.” WHERE event_id = ‘”.$event_id.”‘”;
$events_costs = $wpdb->get_results($sql);
2) Sorting $events_costs by ‘event_cost’
(highest price corresponds to the standard price,
at least in my application).
3) Grabbing the row-id ‘j’ corresponding to the highest price.
4) Overwriting all $event->properties by $events_costs[j]->properties.

A little bit more processor work, but it rocks.
🙂

Hope, you will publish new event-listing-templates, which group recurrent events correctly, and show prices and other features correctly – very soon. This is really a basic feature of eventespresso plugin!

Kind regards
Frank


Josh

  • Support Staff

February 19, 2013 at 9:46 am

Hi Frank,

Thanks for the suggestion. We actually have an open ticket that will change it so it displays a range of prices on the event list.


Frank Grafenstein

February 20, 2013 at 6:31 am

Another (much more better) solution would be modifiing the sql-query in event-list.php, adding GROUP_CONCAT(), like:

GROUP_CONCAT(DISTINCT p.event_cost ORDER BY p.event_cost DESC) event_cost_concat,

Echo the first value in the concateneted-string!

But, attention: This works only, if you have different prices for each price_type!

Regards
Frank

Viewing 4 reply threads

The support post ‘Event price not shown correctly in event-list.php’ 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