Plugin Directory

Changeset 1545049


Ignore:
Timestamp:
12/03/2016 12:25:59 PM (9 years ago)
Author:
pco_58
Message:

Added textarea to form and filter for buttom and form

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

Legend:

Unmodified
Added
Removed
  • wc-return-product/trunk/includes/wc_functions.php

    r1452033 r1545049  
    7070    $order->add_order_note($note, 0);
    7171}
     72
     73/**
     74 *
     75 * Filter button return form
     76 *
     77 */
     78add_filter( 'wc_return_order_button', 'wc_return_order_button_callback', 10, 1 );
     79function wc_return_order_button_callback( $button )
     80{
     81    return $button;
     82}
     83
     84/**
     85 *
     86 * Filter HTML form
     87 *
     88 */
     89add_filter( 'wc_return_order_form', 'wc_return_order_form_callback', 10, 1 );
     90function wc_return_order_form_callback( $form )
     91{
     92    return $form;
     93}
  • wc-return-product/trunk/readme.txt

    r1452034 r1545049  
    44Requires at least: 3.8.1
    55Tested up to: 4.4.2
    6 Stable tag: 1.3.4
     6Stable tag: 1.4.0
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1717
    1818You can specify order statuses for the WC Return form will be available.
     19
     20Filter for return button: 'wc_return_order_button'
     21Filter for return form: 'wc_return_order_form'
     22
     23Action before send email: 'wc_before_send_email'
     24
    1925
    2026**If you find a bug or want to make an upgrade fill free to do it at [GitHub](https://github.com/pacocastillo/WC-Return-Products)**
     
    3440
    3541== Changelog ==
     42
     43= 1.4.0 =
     44* Added textfield in form
     45* Added WP filters
    3646
    3747= 1.3.4 =
  • wc-return-product/trunk/wc_return_product.php

    r1452034 r1545049  
    88 * Plugin URL: http://castillogomez.com/
    99 * Description: Adds a form to order for return product
    10  * Version: 1.3.4
     10 * Version: 1.4.0
    1111 * Author: Paco Castillo
    1212 * Author URI: http://castillogomez.com/
     
    5757
    5858    $products = $order->get_items();
    59     echo '<a class="button return-form-product" href="#">' . __('Return order','wc_return') . '</a>';
     59    echo apply_filters( 'wc_return_order_button', '<a class="button return-form-product" href="#">' . __('Return order','wc_return') . '</a>' );
     60    ob_start();
    6061    ?>
    6162    <form id="wc-form-return" action="" method="post">
     
    7273      </select>
    7374      <small><?php _e('You can select multiple by holding down the CMD or Ctrl key.','wc_return'); ?></small>
     75      <textarea name="wc_message" id="wc_message" cols="30" rows="10" placeholder="<?php _e('Explain the reasons for your return', 'wc_return') ?>"></textarea>
    7476      <input type="hidden" name="order" value="<?php echo $order->id; ?>" />
    7577      <input type="hidden" name="customer" value="<?php echo $order->billing_email; ?>" />
     
    7880    <div class="message"></div>
    7981    <?php
     82    $form = ob_get_clean();
     83    echo apply_filters( 'wc_return_order_form', $form );
    8084  }
    8185
     
    8993    {
    9094      global $woocommerce;
     95
    9196      $customer = $woocommerce->customer;
    9297      $json = array();
     
    134139        }
    135140        include_once(dirname(__FILE__) . "/template/email_items.php");
     141
     142        if ( $_POST['wc_message'] != '' ) {
     143          $note .= '<br><br>';
     144          $note .= '<p>'.__('And the explanation:', 'wc_return').'</p>';
     145          $not .= apply_filters( 'the_content', $_POST['wc_message'] );
     146        }
    136147       
    137148        include_once(dirname(__FILE__) . "/template/email_footer.php");
Note: See TracChangeset for help on using the changeset viewer.