Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'wp_ajax_wcfm_repair_order', function() {
- $order_id = $_POST['order_id'];
- if($order_id) {
- do_action( 'wcfm_manual_order_reset', $order_id, true );
- $order_posted = get_post( $order_id );
- $the_order = wc_get_order( $order_id );
- do_action( 'wcfm_manual_order_processed', $order_id, $order_posted, $the_order );
- }
- die;
- });
- add_action( 'wcfm_order_details_after_order_table', function( $order ) {
- if( !wcfm_is_vendor() ) {
- echo '<a id="wcfm-order-' . $order->get_id() . '" data-order="' . $order->get_id() . '" href="#" class="wcfm_repair_order add_new_wcfm_ele_dashboard text_tip" style="float:left!important;color:#ffffff!important;margin-right:10px;" data-tip="' . __('Click to regenarate vendor orders', 'wcfm-gosend') . '"><span class="">' . __( 'Repair Vendor Orders', 'wc-frontend-manager-ultimate') . '</span></a>';
- echo '<div class="wcfm_clearfix"></div><br />';
- ?>
- <script>
- jQuery(document).ready(function($) {
- $('.wcfm_repair_order').click(function( event ) {
- event.preventDefault();
- var rconfirm = confirm( "Do you really want to do this?" );
- if( rconfirm ) {
- var data = {
- action : 'wcfm_repair_order',
- order_id : $('.wcfm_repair_order').data('order')
- }
- $.ajax({
- type: 'POST',
- url: wcfm_params.ajax_url,
- data: data,
- success: function(response) {
- window.location = window.location.href;
- }
- });
- }
- return false;
- });
- });
- </script>
- <?php
- }
- }, 500 );
Add Comment
Please, Sign In to add comment