Posted: November 15, 2013 at 1:08 pm
Hello I looked through the forum and could not find this topic. I would like to show the price before surcharge on the EVENT_LIST page. That is, if an item is $10 with 5% surcharge, I would like the event list page to show $10, not $10.50. Then when they register they can see the full price in their cart total. I’ve already tweaked the PHP file with a few nice changes, so cutting a pasting code is no problem. Thanks for your help. Greg Reimer |
|
Hi Devon, My EVENT_LIST page doesn’t show a surcharge. The surcharge only appears on the event page. I’ve tried to make it appear in the Event List, but cannot. I’m not sure what settings your have. What add-ons are you using? |
|
I’m working to solve a problem with the way event prices display. https://eventespresso.com/forums/2012/04/standard-pricing-not-consistant/ When I do not use the substituted code, the event price does not include the surcharge and shows $10. But it does not show the price at the top (first) of the list. When I do use the substituted code so that the top (first) price is always shown, it includes the surcharge amount ($10.50) in the price. So… is there a way I can show the top (first) price in the list and have it not include the surcharge amount? Thanks. http://www.academieduello.com/school/workshops/workshops-calendar/ Here’s the page I’m working with (if that helps). Prices that show $63 are actually $60 items that have 5% tax included. I want to show just the $60, which is the first price in the list. Greg |
|
|
Hi, Not with that shortcode or even the base function it uses as it combines all the costs together. The only way I can think of getting what you need is via an SQL query. An alternative option would be to show a price list or price range on the event list: List |
I’m not too swift on creating SQL queries. Can you offer one? Thanks. |
|
|
You can use the code below: |
I’ll try it out. Much appreciated! Thanks. |
|
Well, when I paste it into functions.php it takes down my entire site. Blank white page. ? |
|
|
It is not recommended to test out code changes on a live site, as minor errors in code (we are after all only human) can crash a site. If you have not done so already, please edit the file where you added the code via FTP and remove the code. I would suggest using the Plugin idea Sidney said. Also try this code, it has been modified slightly to remove the error. function espresso_return_single_price_sans_surcharge($event_id, $number=0) { do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); global $wpdb, $org_options; $number = $number == 0 ? '0,1' : $number . ',' . $number; $results = $wpdb->get_results("SELECT event_cost FROM " . EVENTS_PRICES_TABLE . " WHERE event_id='" . $event_id . "' ORDER BY id ASC LIMIT " . $number); if ($wpdb->num_rows > 0) { foreach ($results as $result) { if ($result->event_cost > 0.00) { $event_cost = $result->event_cost; } else { $event_cost = '0.00'; } } } else { $event_cost = '0.00'; } $event_cost = number_format( $event_cost, 2, '.', ''); return $event_cost; } function get_espresso_price_sans_surcharge_sc($atts) { extract(shortcode_atts(array('event_id' => '0', 'number' => '0'), $atts)); $event_id = "{$event_id}"; $number = "{$number}"; ob_start(); echo espresso_return_single_price_sans_surcharge($event_id, $number); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; } add_shortcode('EVENT_PRICE_SANS_SURCHARGE', 'get_espresso_price_sans_surcharge_sc'); Something like this would be used in the event_list_display.php <?php echo $org_options['currency_symbol'] . do_shortcode('[EVENT_PRICE_SANS_SURCHARGE event_id="' . $event_id . '" number="0"]'); ?> Please note, that if you do not understand the code or how to add the code, you may need to refer to a web developer for assistance. |
Thanks, that did it. You’ve been extremely helpful. Much appreciated. Greg |
|
|
Sorry, lost track of the starting and closing braces. I’ve cleaned up the gist on github for any future viewers of this thread. |
The support post ‘Event List: Show Price before Surcharge’ 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.