Discount code for multiprice and multiseat events
-
Hi every one,
First thanks so much for this plugin who answer to all my needs !
Here my trouble. For each of my event I have 3 differents type room and for each room a different number of seat. So what i want it’s to initiate a discount code on the total and send in with a paypal button. I read many of the topics to install all of this, thanks for all your works, there is what i settle :
Registration form format:
<table class='eme_add_multibooking_form'> <tr><th scope='row'>Your Name*:</th><td>#_NAME</td></tr> <tr><th scope='row'>Your E-Mail*:</th><td>#_EMAIL</td></tr> <tr><th scope='row'>Your Phone number:</th><td>#_PHONE</td></tr> <tr><th scope='row'>Private deluxe room 650€</th><td>#_SEATS{1}</td></tr> <tr><th scope='row'>Double deluxe room 495€</th><td>#_SEATS{2}</td></tr> <tr><th scope='row'>Dormitory 395€</th><td>#_SEATS{3}</td></tr> <tr><th scope='row'>Coupon:</th><td>#_FIELD{01}</td> <tr><th scope='row'>Comment:</th><td>#_COMMENT</td></tr> #_CAPTCHAHTML[<tr><th scope='row'>Please fill in the code displayed here:</th><td>#_CAPTCHA</td></tr>] </table> #_SUBMIT
functions.php (change with plugin My Custom Functions):
/** * Add a hook for the Events Made Easy system to allow for coupon codes */ add_action('eme_insert_rsvp_action', 'my_eme_coupons',20,1); /** * Custom function to calculate coupon code discounts for events */ function my_eme_coupons($booking) { global $wpdb; $bookings_table = $wpdb->prefix.BOOKINGS_TBNAME; $where = array(); $fields = array(); // Grab the coupon code from the extra answers $event_id = $booking['event_id']; $booking_id = $booking['booking_id']; $answers = eme_get_answers($booking_id); $coupon = $answers[0]['answer']; $fullprice = $booking['price_id']; // Place here your VOUCHER CODE and PERCENT for the event $voucher = montgogerNoel; $percent = 10; // As long as the coupon code isn't empty, look for matches if ($coupon != '') { if ($coupon == $voucher) { //$price = 11111; $price = $fullprice-($fullprice*($percent/100)); $fields['booking_price'] = $price; $where['booking_id'] = $booking['booking_id']; $wpdb->update($bookings_table, $fields, $where); } } return; }
Payment form header format:
<div>#_RESPSPACES{1} space Delux</div> <div>#_RESPSPACES{2} space Double</div> <div>#_RESPSPACES{3} space Dorm</div> <div>[eme_if tag='#ESC_FIELD{1}' ] Use of vouchure code: #_FIELD{1} [/eme_if] </div> <strong>Total due: #_TOTALPRICE €</strong>
Ok if i don’t put the coupon code verification everything work properly
the http://chateaudemontgoger.com/events/8/yogaanddetox/#eme-rsvp-message give:
1 space Delux
2 space Double
1 space Dorm
Total due: 2035.00 €If I put the discount code, the system reconize the code but don’t make the operation propely and the #eme-rsvp-message page even don’t return any informations. If I put the line
$price = 11111;
for test the system return me the amount 11111 multiply by the total number of seat…Can you help me please…
- The topic ‘Discount code for multiprice and multiseat events’ is closed to new replies.