eventsmanager

Custom SubTotal for coupon

Nov 17th, 2014
425
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Note: using multiple bookings mode
  3.  
  4. 1. paste this snippet at the end of your theme functions.php
  5. OR
  6. 2. using ftp, go to wp-content then create new folder name mu-plugins and then open this folder and
  7. 3. create new php file name functions.php then edit and paste this snippet > save
  8. 4. go to Events > Bookings and under Recent Bookings click on the Gear Icon and Drag new 'Sub Total' to the left
  9. */
  10.  
  11. function my_em_bookings_table_cols_template_subtotal($template, $EM_Bookings_Table){
  12. $template['sub_total'] = 'Sub Total';
  13. return $template;
  14. }
  15. add_action('em_bookings_table_cols_template', 'my_em_bookings_table_cols_template_subtotal',10,2);
  16.  
  17. function my_em_custom_booking_form_cols_subtotal($val, $col, $EM_Booking, $EM_Bookings_Table, $csv){
  18.  
  19. if( $col == 'sub_total' ){
  20. if( get_option('dbem_multiple_bookings') ){
  21. $EM_Multiple_Booking = EM_Multiple_Bookings::get_main_booking($EM_Booking);
  22. if( $EM_Multiple_Booking !== false ){
  23. $EM_Booking = $EM_Multiple_Booking;
  24. }
  25. }
  26. $val = em_get_currency_formatted($EM_Booking->booking_price);
  27. }
  28.  
  29. return $val;
  30. }
  31. add_filter('em_bookings_table_rows_col','my_em_custom_booking_form_cols_subtotal', 10, 5);
RAW Paste Data