eventsmanager

add remove coupon to MB mode

Aug 6th, 2013
208
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1. go to /wp-content/plugins/events-manager-pro/add-ons/multiple-bookings/multiple-bookings.js
  2.  
  3. 2. add this snippet (below line 23 )
  4.  
  5. /**************************/
  6. $(document).on( 'click', '.em-cart-table a.em-cart-table-actions-remove-coupon', function(e){
  7. e.preventDefault();
  8. //var event_id = $(this).attr('rel');
  9. container = $(this).parents('.em-cart-table').first().parent();
  10. $.ajax({
  11. url: EM.bookingajaxurl,
  12. data: { 'action':'emp_checkout_remove_coupon' },
  13. dataType: 'jsonp',
  14. type:'post',
  15. beforeSend: function(formData, jqForm, options) {
  16. $('.em-booking-message').remove();
  17. container.append('<div id="em-loading"></div>');
  18. },
  19. success : function(response, statusText, xhr, $form) {
  20. $('#em-loading').remove();
  21. //show error or success message
  22. if(response.result){
  23. //$(document).trigger('em_cart_refresh');
  24. location.reload();
  25. }else{
  26. $('<div class="em-booking-message-error em-booking-message">'+response.message+'</div>').insertBefore(em_booking_form);
  27. $('html, body').animate({ scrollTop: em_booking_form.parent().offset().top - 30 }); //sends user back to top of form
  28. }
  29. }
  30. });
  31. return false;
  32. });
  33. /**************************/
  34.  
  35.  
  36. 3. go to your theme functions.php then add this snippet
  37. /**************************/
  38. add_action('wp_ajax_emp_checkout_remove_coupon','remove_coupon');
  39. function remove_coupon(){
  40.  
  41. $EM_Multiple_Booking = EM_Multiple_Bookings::get_multiple_booking();
  42. $result = true;
  43.  
  44. $EM_Multiple_Booking->booking_meta['coupon'] = array();
  45.  
  46. $EM_Multiple_Booking->calculate_price();
  47.  
  48. if( defined('DOING_AJAX') ){
  49. $return = array('result'=>$result, 'message'=>$feedback);
  50. echo EM_Object::json_encode($return);
  51. }else{
  52. wp_redirect(wp_get_referer());
  53. }
  54.  
  55. die();
  56. }
  57. /**************************/
  58.  
  59.  
  60. 4. create new directory/folders inside your theme
  61.  
  62. e.g.
  63. wp-content > themes > Your Theme > plugins > events-manager-pro > multiple-bookings > cart-table.php
  64.  
  65. copy the contents from this link - http://pastebin.com/jUnPZXXc
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×