Plugin Directory

Changeset 1349758


Ignore:
Timestamp:
02/13/2016 12:05:22 PM (10 years ago)
Author:
pco_58
Message:

Add new status and note to order

Location:
wc-return-product/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wc-return-product/trunk/readme.txt

    r1263958 r1349758  
    44Requires at least: 3.8.1
    55Tested up to: 4.2.4
    6 Stable tag: 1.2.2
     6Stable tag: 1.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3535== Changelog ==
    3636
     37= 1.3 =
     38* Add new order status
     39* Add note to order when products want to be returned
     40
    3741= 1.2.2 =
    3842* Fix 4.3 WP update
  • wc-return-product/trunk/wc_return_product.php

    r1263958 r1349758  
    88Plugin URL: http://castillogomez.com/
    99Description: Adds a form to order for return product
    10 Version: 1.2.2
     10Version: 1.3
    1111Author: Paco Castillo
    1212Author URI: http://castillogomez.com/
     
    1919 **/
    2020if (!function_exists('is_plugin_active_for_network'))
    21 require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
     21  require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
     22
    2223if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) || is_plugin_active_for_network('woocommerce/woocommerce.php') ) {
    2324
     25  require_once( plugin_dir_path( __FILE__ ) . '/includes/wc_functions.php' );
     26 
    2427  add_action('wp_head','wc_return_products_ajaxurl');
    2528
     
    3538    load_theme_textdomain('wc_return', plugin_dir_path( __FILE__ ) . 'languages');
    3639    wp_enqueue_script( 'wc_return_form', plugins_url( 'assets/wc_return_form.js', __FILE__ ) , array('jquery'), false, true );
     40    wc_create_custom_order_state();
    3741  }
    3842
     
    118122        $products = array();
    119123        $items = $order->get_items();
     124        // Create note for add to order
     125        $note = __('These products want to be returned: ', 'wc_return');
     126        $n_prod = 0;
    120127        foreach ($_POST['wc_products'] as $prod_id) {
    121128          $p = new WC_Product( (int)sanitize_text_field($prod_id) );
    122129          if ( $p ) {
     130            $note .= (!$n_prod) ? $p->get_title() : ', '.$p->get_title();
     131            $n_prod++;
    123132            array_push($products, $p->id );
    124133          }
     
    145154        $send = 1;
    146155        remove_filter( 'wp_mail_content_type', 'wc_return_form_set_html_content_type' );
     156
     157        // Change status and add note to order
     158        do_action('wc_before_send_email', $order_id, $note);
    147159
    148160        $json['send'] = $send;
Note: See TracChangeset for help on using the changeset viewer.