Plugin Directory

Changeset 2913982


Ignore:
Timestamp:
05/17/2023 09:00:53 PM (3 years ago)
Author:
diurvan
Message:

Add custom number tracking

Location:
wc-tracking-status
Files:
16 added
5 edited

Legend:

Unmodified
Added
Removed
  • wc-tracking-status/trunk/css/style.bundle.css

    r2649946 r2913982  
    11.stepper {
     2  padding: 10px;
     3  font-size: 13px;
     4}
     5@media (min-width: 48em) {
     6  .stepper {
     7    padding: 20px;
     8  }
     9}
     10.stepper__list {
     11  width: 100%;
     12  margin: 0;
     13  padding: 0;
     14  list-style-type: none;
     15}
     16@media (min-width: 48em) {
     17  .stepper__list {
     18    display: flex;
     19    justify-content: space-between;
     20  }
     21}
     22.stepper__list__item {
     23  padding: 3px 5px;
     24  text-align: center;
     25  position: relative;
     26  display: flex;
     27  align-items: center;
     28}
     29@media (min-width: 48em) {
     30  .stepper__list__item {
    231    padding: 10px;
    3     font-size: 13px;
     32    flex-direction: column;
     33    flex: 1;
    434  }
    5   @media (min-width: 48em) {
    6     .stepper {
    7       padding: 20px;
    8     }
     35}
     36.stepper__list__item:after {
     37  content: "";
     38  display: block;
     39  position: absolute;
     40  z-index: 2;
     41}
     42@media (min-width: 48em) {
     43  .stepper__list__item:after {
     44    width: calc(100% - 100px);
     45    top: 28%;
     46    left: calc(50% + 50px);
     47    border-top: 2px dotted #e2dfda;
    948  }
    10   .stepper__list {
    11     width: 100%;
     49}
     50.stepper__list__item--done {
     51  color: limegreen;
     52  transition: all 0.1s;
     53}
     54@media (min-width: 48em) {
     55  .stepper__list__item--done:after {
     56    border-top-style: solid;
     57    border-top-width: 1px;
     58  }
     59}
     60.stepper__list__item--done:hover, .stepper__list__item--done:focus {
     61  /* text-decoration: underline; */
     62  cursor: pointer;
     63}
     64.stepper__list__item--current {
     65  color: #006dff;
     66}
     67.stepper__list__item--current:last-of-type:after, .stepper__list__item--current:only-of-type:after {
     68  height: 30%;
     69}
     70.stepper__list__item:last-of-type:after {
     71  display: none;
     72}
     73.stepper__list__item--pending {
     74  color: #807370;
     75}
     76.stepper__list__item--pending:after {
     77  height: 30%;
     78}
     79.stepper__list__title {
     80  margin: 1px 0 0;
     81}
     82@media (min-width: 48em) {
     83  .stepper__list__title {
    1284    margin: 0;
    13     padding: 0;
    14     list-style-type: none;
    1585  }
    16   @media (min-width: 48em) {
    17     .stepper__list {
    18       display: flex;
    19       justify-content: space-between;
    20     }
     86}
     87.stepper__list__icon {
     88  margin: 0 10px 0 0;
     89  height: 3em;
     90  width: 3em;
     91}
     92@media (min-width: 48em) {
     93  .stepper__list__icon {
     94    margin: 0 0 15px;
    2195  }
    22   .stepper__list__item {
    23     padding: 3px 5px;
    24     text-align: center;
    25     position: relative;
    26     display: flex;
    27     align-items: center;
    28   }
    29   @media (min-width: 48em) {
    30     .stepper__list__item {
    31       padding: 10px;
    32       flex-direction: column;
    33       flex: 1;
    34     }
    35   }
    36   .stepper__list__item:after {
    37     content: "";
    38     display: block;
    39     position: absolute;
    40     z-index: 2;
    41   }
    42   @media (min-width: 48em) {
    43     .stepper__list__item:after {
    44       width: calc(100% - 100px);
    45       top: 28%;
    46       left: calc(50% + 50px);
    47       border-top: 2px dotted #e2dfda;
    48     }
    49   }
    50   .stepper__list__item--done {
    51     color: limegreen;
    52     transition: all 0.1s;
    53   }
    54   @media (min-width: 48em) {
    55     .stepper__list__item--done:after {
    56       border-top-style: solid;
    57       border-top-width: 1px;
    58     }
    59   }
    60   .stepper__list__item--done:hover, .stepper__list__item--done:focus {
    61     /* text-decoration: underline; */
    62     cursor: pointer;
    63   }
    64   .stepper__list__item--current {
    65     color: #006dff;
    66   }
    67   .stepper__list__item--current:last-of-type:after, .stepper__list__item--current:only-of-type:after {
    68     height: 30%;
    69   }
    70   .stepper__list__item:last-of-type:after {
    71     display: none;
    72   }
    73   .stepper__list__item--pending {
    74     color: #807370;
    75   }
    76   .stepper__list__item--pending:after {
    77     height: 30%;
    78   }
    79   .stepper__list__title {
    80     margin: 1px 0 0;
    81   }
    82   @media (min-width: 48em) {
    83     .stepper__list__title {
    84       margin: 0;
    85     }
    86   }
    87   .stepper__list__icon {
    88     margin: 0 10px 0 0;
    89     height: 3em;
    90     width: 3em;
    91   }
    92   @media (min-width: 48em) {
    93     .stepper__list__icon {
    94       margin: 0 0 15px;
    95     }
    96   }
    97   .stepper__list__icon path {
    98     fill: currentColor;
    99   }
    100   .stepper__list__icon ellipse,
    101   .stepper__list__icon circle {
    102     stroke: currentColor;
    103   }
     96}
     97.stepper__list__icon path {
     98  fill: currentColor;
     99}
     100.stepper__list__icon ellipse,
     101.stepper__list__icon circle {
     102  stroke: currentColor;
     103}
  • wc-tracking-status/trunk/includes/admin/track-config.php

    r2682956 r2913982  
    416416                        </td>
    417417                    </tr>
     418
     419                    <tr valign="top">
     420                        <th scope="row" class="titledesc">
     421                            <label><?php echo __("Use Custom Number Tracking", 'diu-wc-tracking-status'); ?></label>
     422                        </th>
     423                        <td scope="row" cplspan="4">
     424                            <?php
     425                            $custom_number_trackink = get_option('diu_wc_custom_number_tracking');
     426                           
     427                            woocommerce_wp_checkbox(array(
     428                                'id'            => 'diu_wc_custom_number_tracking',
     429                                'label'         => __('', 'woocommerce' ),
     430                                'description'   => __( "Check to use custom Number Tracking on Order.", 'woocommerce' ),
     431                                'value'         => $custom_number_trackink,
     432                            ));
     433                            ?>
     434                        </td>
     435                    </tr>
    418436                   
    419437
     
    448466    register_setting('diu_wc_tracking_settings_group', 'diu_wc_use_bootstrap');
    449467    register_setting('diu_wc_tracking_settings_group', 'diu_wc_include_notes');
     468    register_setting('diu_wc_tracking_settings_group', 'diu_wc_custom_number_tracking');
    450469    $initial_terms = array (
    451470        '0' => array (
     
    485504});
    486505/* SECCION PARA AGREGAR EL ROL DE COURIER */
     506
     507/* AÑADE METABOX A LA ORDEN */
     508add_action( 'add_meta_boxes', 'diu_add_meta_boxes_number_tracking' );
     509if ( ! function_exists( 'diu_add_meta_boxes_number_tracking' ) )
     510{
     511    function diu_add_meta_boxes_number_tracking()
     512    {
     513                    if( get_option('diu_wc_custom_number_tracking') ){
     514        add_meta_box( 'wc_tracking_metabox', __('Number Tracking','diu-wc-tracking'), 'diu_add_meta_boxes_tracking_for_prepare', 'shop_order', 'side', 'core' );
     515                    }
     516    }
     517}
     518
     519if ( ! function_exists( 'diu_add_meta_boxes_tracking_for_prepare' ) )
     520{
     521    function diu_add_meta_boxes_tracking_for_prepare()
     522    {
     523        global $post;
     524
     525        $meta_field_data = get_post_meta( $post->ID, 'wc_tracking_number_tracking', true ) ? get_post_meta( $post->ID, 'wc_tracking_number_tracking', true ) : '';
     526
     527        echo '<input type="hidden" name="diu_wc_tracking_field_nonce" value="' . wp_create_nonce() . '">
     528        <p style="border-bottom:solid 1px #eee;padding-bottom:13px;">
     529            <input type="text" style="width:250px;" name="wc_tracking_number_tracking" placeholder="' . $meta_field_data . '" value="' . $meta_field_data . '"></p>';
     530    }
     531}
     532
     533// Save the data of the Meta field
     534add_action( 'save_post', 'diu_wc_tracking_save_order', 10, 1 );
     535if ( ! function_exists( 'diu_wc_tracking_save_order' ) )
     536{
     537    function diu_wc_tracking_save_order( $post_id ) {
     538        // Check if our nonce is set.
     539        if ( ! isset( $_POST[ 'diu_wc_tracking_field_nonce' ] ) ) {
     540            return $post_id;
     541        }
     542        $nonce = $_REQUEST[ 'diu_wc_tracking_field_nonce' ];
     543        if ( ! wp_verify_nonce( $nonce ) ) {
     544            return $post_id;
     545        }
     546
     547        // If this is an autosave, our form has not been submitted, so we don't want to do anything.
     548        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
     549            return $post_id;
     550        }
     551
     552        // Check the user's permissions.
     553        if ( 'page' == $_POST[ 'post_type' ] ) {
     554
     555            if ( ! current_user_can( 'edit_page', $post_id ) ) {
     556                return $post_id;
     557            }
     558        } else {
     559
     560            if ( ! current_user_can( 'edit_post', $post_id ) ) {
     561                return $post_id;
     562            }
     563        }
     564        // --- Its safe for us to save the data ! --- //
     565
     566        // Sanitize user input  and update the meta field in the database.
     567        update_post_meta( $post_id, 'wc_tracking_number_tracking', $_POST[ 'wc_tracking_number_tracking' ] );
     568    }
     569}
     570/* AÑADE METABOX A LA ORDEN */
  • wc-tracking-status/trunk/includes/front/track-view.php

    r2873207 r2913982  
    2020    $use_bootstrap = get_option('diu_wc_use_bootstrap');
    2121    $include_notes = get_option('diu_wc_include_notes');
     22 $custom_number_tracking = get_option('diu_wc_custom_number_tracking');
     23
    2224    if(empty( $use_bootstrap )){
    2325        wp_enqueue_style( 'diur-bootstrap-min', plugin_dir_url( __DIR__ ) . '../css/bootstrap.min.css' );
     
    2527    wp_enqueue_style( 'diur-bundle', plugin_dir_url( __DIR__ ) . '../css/style.bundle.css' );
    2628
    27     $html = ''; $order_id = 0;
     29    $order_id = 0;
    2830    if(isset($_POST["wc_tracking_order"]) && $_POST["wc_tracking_order"]!=''){
    2931        $order_id = $_POST["wc_tracking_order"];
     
    3335    }
    3436   
     37    // USE OWN CUSTOM NUMBER TRACKING FROM WC-TRACKING-STATUS
     38    if( $custom_number_tracking ){
     39        global $wpdb;
     40        $meta = $wpdb->get_results("SELECT * FROM `".$wpdb->postmeta."` WHERE meta_key='wc_tracking_number_tracking' AND meta_value='".$order_id."'");
     41        if (is_array($meta) && !empty($meta) && isset($meta[0])) {
     42            $meta = $meta[0];
     43        }       
     44        if (is_object($meta)) {
     45            $order_id = $meta->post_id;
     46        }
     47    }
     48    // USE OWN CUSTOM NUMBER TRACKING FROM WC-TRACKING-STATUS
    3549   
    3650    if($order_id != 0){
  • wc-tracking-status/trunk/readme.txt

    r2844512 r2913982  
    55557. Column and Bulk action for change order status
    56568. Better responsive experience on Front and more information from Order
     579. Custom Number Tracking. Allow to enable or not by using a control field
    5758
    5859== Frequently Asked Questions ==
     
    7071
    7172== Changelog ==
     73= 2.0.3 =
     74*Release Date - 17th May, 2023*
     75* We added the "Use Custom Number Tracking" checkbox to find order by this number (not use default WooCommerce Order Number).
     76* Show or hide metabox "Number Tracking" or edit order
     77
    7278= 2.0.2 =
    7379*Release Date - 22th February, 2022*
  • wc-tracking-status/trunk/wc-tracking-status.php

    r2844512 r2913982  
    66 * Author:      diurvan Consultores
    77 * Author URI:  https://diurvanconsultores.com
    8  * Version: 2.0.2
     8 * Version: 2.0.3
    99 * Requires at least: 5.5
    1010 * Tested up to: 6.2.2
Note: See TracChangeset for help on using the changeset viewer.