Events Made Easy › Forums › How do I … › Add custom field or amount into Paypal calculation?
Tagged: calculated paypal button, paypal, RSVP, rsvp action, update rsvp
- This topic has 8 replies, 3 voices, and was last updated 11 years ago by Anonymous.
-
AuthorPosts
-
Tue 10 Dec 2013 at 06:19 #44100AnonymousInactive
In a nutshell, I have an RSVP event that has a lunch or dinner or both associated with a ticket. I am wanting to collect the fees for the event, and whatever meals are selected in the form at the time the form is submitted.
Is it possible to add in the costs of the custom field (lunch field or dinner field) to the ticket price and get one payment button sent to paypal which includes the total cost?
Also, can we do any other calculation necessary before the payment button is created? Perhaps in the hooks/filters?
Thanks again for such a flexible plugin!
Tue 10 Dec 2013 at 16:57 #50926FrankyKeymasterCan’t you use multiprice events for this?
Concerning hooks/filters: there are no hooks foreseen (yet) before the payment button is created. If you can convince me that this is needed in certain cases, I can add one.
Tue 10 Dec 2013 at 17:00 #50927AnonymousInactiveCould be good for something like discount coupon codes
Tue 10 Dec 2013 at 19:18 #50928AnonymousInactiveI can, but only partly, because the counters for the meals are added to the counter for tickets, so setting the max number of tickets is almost impossible.
We have a capacity maximum for many of our venues and several meals per event of which a person can attend one, some or none. Every time they add a meal, the total counter for the event also increments, so one person deciding to attend 3 meals, actually increments the counter to look like 4 attendance tickets are sold.
If I could tell the plugin which variables should be counted in the total payment, and just apply #_SEATS to the maximum limit that would work great, and could be more flexible for different situations. (But also may not be easy! 🙂 )
(My other post today id=2108#post-8729 probably illustrates more of what I am trying to accomplish – thanks a TON for offering a fix on that on!! )
Hopefully this makes sense.
Tue 10 Dec 2013 at 20:24 #50929FrankyKeymasterIt seems what you want here is multiseat+multiprice options (a number of seats per price). That’s (like many other things) on my to-do list …
Tue 10 Dec 2013 at 20:31 #50930AnonymousInactiveOh my, I am sure that it seems the work is never done! 🙂 I know I appreciate what you have provided – thanks again , I am willing to be patient.
Mon 16 Dec 2013 at 12:17 #50931AnonymousInactiveI came up with a way to deal with our registration as described above by using the
eme_insert_rsvp_action() and only counting some of the #_SEATSxx fields in my booking_seats total (works really nicely and gives the proper amount of seats left available for the event). The paypal link generator also still works fine because it calculates the total amt due by including all of the #_SEATSxx, so all is well there also.
The only problem I am seeing is that if someone UPDATES the registration, this action is not seen, so eme recalculates the total booking with all of the #_SEATSxx instead of just some of them.
Is it possible to add another action for when a booking is updated so that I can repeat the adjustment before it is saved? (ie. eme_UPDATE_rsvp_action )
Mon 16 Dec 2013 at 18:36 #50932FrankyKeymastereme_update_rsvp_action hook added, see:
http://plugins.trac.wordpress.org/changeset/823337
and to fix $booking not being defined there:
Mon 16 Dec 2013 at 22:03 #50933AnonymousInactiveThanks Franky!
I added the changesets and it was not updating, but I thought it may be the timing. So I set the action with the following priority, and then it worked.
add_action(’eme_update_rsvp_action’, ‘count_only_attendance_tickets_on_update’,20,1);
I included the function that worked for me below, if you see any reason that I should not be reassigning the $booking the way that I do, please let me know.
As I said earlier, this still allowed for paypal $ amts to work and kept the available seats accurate.
Thanks again for all of your help.
—-
If anyone is interested, here is the code I used for the insert/update of the reservation:
add_action('eme_update_rsvp_action', 'count_only_attendance_tickets_on_update',20,1);
function count_only_attendance_tickets_on_update($booking) {
global $wpdb;
$bookings_table = $wpdb->prefix.BOOKINGS_TBNAME;
$where = array();
$fields = array();
$event_id = $booking['event_id'];
if ($event_id == 9467) { /* put in the event_id that needs processing */
//echo 'EVENT ID='.$event_id .' Booking_id = '.$booking['booking_id'];
$seats=preg_split("/||/",$booking['booking_seats_mp']);
/* use only attendance tickets,#_SEATS1 and #_SEATS2, array values 0 and 1 */
$tix_tot = $seats[0] + $seats[1];
$fields['booking_seats'] = $tix_tot;
// echo 'Attendence tix_tot =' . $tix_tot;
$where['booking_id'] = $booking['booking_id'];
$wpdb->update($bookings_table, $fields, $where);
}
return;
} -
AuthorPosts
- The forum ‘How do I …’ is closed to new topics and replies.