Advertisement
eventsmanager

Placeholder to Get Payment Gateway

Feb 22nd, 2013
385
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. This snippet will add new placeholder #_PAYMENTGATEWAYTRANSID
  3. to display the payment gateway transaction id.
  4. */
  5. add_filter('em_booking_output_placeholder','my_em_get_payment_type_id',1,3);
  6. function my_em_get_payment_type_id($replace, $EM_Booking, $result){
  7.     global $wp_query, $wp_rewrite, $wpdb;;
  8.     switch( $result ){
  9.         case '#_PAYMENTGATEWAYTRANSID':
  10.             $replace = '';
  11.                         $sql = $wpdb->prepare( "SELECT transaction_gateway_id FROM ".EM_TRANSACTIONS_TABLE." WHERE booking_id= '".$EM_Booking->booking_id."' ");
  12.                         $gateway = $wpdb->get_var($sql);
  13.                         $replace = $gateway;
  14.             break;
  15.     }
  16.     return $replace;
  17. }
  18.  
  19.  
  20. /**
  21. This snippet will add new placeholder #_PAYMENTGATEWAY
  22. to determine what gateway is used when the event is booked.
  23. */
  24. add_filter('em_booking_output_placeholder','my_em_get_payment_type',1,3);
  25. function my_em_get_payment_type($replace, $EM_Booking, $result){
  26.     global $wp_query, $wp_rewrite, $wpdb;;
  27.     switch( $result ){
  28.         case '#_PAYMENTGATEWAY':
  29.             $replace = '';
  30.                         $sql = $wpdb->prepare( "SELECT transaction_gateway FROM ".EM_TRANSACTIONS_TABLE." WHERE booking_id= '".$EM_Booking->booking_id."' ");
  31.                         $gateway = $wpdb->get_var($sql);
  32.                         $replace = $gateway;
  33.             break;
  34.     }
  35.     return $replace;
  36. }
Advertisement
RAW Paste Data Copied
Advertisement