Advertisement
eventsmanager

Override placeholder #_EVENTPRICERANGE

May 16th, 2013
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. add_filter('em_event_output_placeholder','my_em_placeholder_mod_price',1,3);
  2. function my_em_placeholder_mod_price($replace, $EM_Event, $result){
  3. if ( $result == '#_EVENTPRICERANGE' ) {
  4. $min = false;
  5. $max = 0;
  6. if( $EM_Event->get_bookings()->is_open() || !empty($show_all_ticket_prices) ){
  7. foreach( $EM_Event->get_tickets()->tickets as $EM_Ticket ){
  8. /* @var $EM_Ticket EM_Ticket */
  9. if( $EM_Ticket->is_available() || get_option('dbem_bookings_tickets_show_unavailable') || !empty($show_all_ticket_prices) ){
  10. if($EM_Ticket->get_price() > $max ){
  11. $max = $EM_Ticket->get_price();
  12. }
  13. if($EM_Ticket->get_price() < $min || $min === false){
  14. $min = $EM_Ticket->get_price();
  15. }
  16. }
  17. }
  18. }
  19. if( $min === false ) $min = 0;
  20. if( $min != $max ){
  21. $replace = ($min > 0) ? em_get_currency_formatted($min).' - '.em_get_currency_formatted($max):'FREE'.' - '.em_get_currency_formatted($max);
  22. }else{
  23. $replace = ($min > 0) ? em_get_currency_formatted($min):'FREE';
  24. }
  25. }
  26. return $replace;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement