Events Manager Integration
-
Hi ,
I’m using your plugin with events manager. It’s working perfectly to process event payments, however I’m trying to get events manager to add an additional items check box that will then pass the additional cost through to eway as they register for an event.I’m using this code
function my_em_add_paypal_surcharge($paypal_vars, $EM_Booking, $EM_Gateway_Paypal){ $EM_Tickets_Bookings = $EM_Booking->get_tickets_bookings(); $attendee_datas = EM_Attendees_Form::get_booking_attendees($EM_Booking); $attendee_list = ""; $count = 1; foreach( $EM_Tickets_Bookings->tickets_bookings as $EM_Ticket_Booking ){ $price = $EM_Ticket_Booking->get_price() / $EM_Ticket_Booking->get_spaces(); if( $price > 0 ){ $paypal_vars['item_name_'.$count] = wp_kses_data($EM_Ticket_Booking->get_ticket()->name); $paypal_vars['quantity_'.$count] = $EM_Ticket_Booking->get_spaces(); $paypal_vars['amount_'.$count] = round($price,2); } $subitem_count = ($count + 1); for( $i = 0; $i < $EM_Ticket_Booking->ticket_booking_spaces; $i++ ){ $fields = $EM_Booking->booking_meta['attendees'][$EM_Ticket_Booking->ticket_id][$i]; $amount = $fields['tshirt_amount']; $paypal_vars['item_name_'.$subitem_count] = wp_kses_data( 'Tshirt' ); $paypal_vars['quantity_'.$subitem_count] = 1; $paypal_vars['amount_'.$subitem_count] = round($amount,2); $count = $subitem_count; $subitem_count++; } $count++; } return $paypal_vars; } add_filter('em_gateway_paypal_get_paypal_vars','my_em_add_paypal_surcharge',1,3);
which is from a thread on the EM pro forum. I have modified it here:
function my_em_add_eway_surcharge($eway_vars, $EM_Booking, $EwayPaymentsEventsManager){ $EM_Tickets_Bookings = $EM_Booking->get_tickets_bookings(); $attendee_datas = EM_Attendees_Form::get_booking_attendees($EM_Booking); $attendee_list = ""; $count = 1; foreach( $EM_Tickets_Bookings->tickets_bookings as $EM_Ticket_Booking ){ $price = $EM_Ticket_Booking->get_price() / $EM_Ticket_Booking->get_spaces(); if( $price > 0 ){ $eway_vars['item_name_'.$count] = wp_kses_data($EM_Ticket_Booking->get_ticket()->name); $eway_vars['quantity_'.$count] = $EM_Ticket_Booking->get_spaces(); $eway_vars['amount_'.$count] = round($price,2); } $subitem_count = ($count + 1); for( $i = 0; $i < $EM_Ticket_Booking->ticket_booking_spaces; $i++ ){ $fields = $EM_Booking->booking_meta['attendees'][$EM_Ticket_Booking->ticket_id][$i]; $amount = $fields['tshirt_amount']; $eway_vars['item_name_'.$subitem_count] = wp_kses_data( 'Tshirt' ); $eway_vars['quantity_'.$subitem_count] = 1; $eway_vars['amount_'.$subitem_count] = round($amount,2); $count = $subitem_count; $subitem_count++; } $count++; } return $eway_vars; } add_filter('em_gateway_eway_get_eway_vars','my_em_add_eway_surcharge',1,3);
to try and get it to pass the payment on to eway but it isn’t working.
I’m not sure if I have it right so I thought I’d see if you could see any glaring issues.
Any help you could give me would be brilliant.Thanks
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘Events Manager Integration’ is closed to new replies.