Plugin Directory

Changeset 2588940


Ignore:
Timestamp:
08/26/2021 03:31:31 AM (5 years ago)
Author:
buenvio
Message:

build: replace tested up to v5.8 of wordpress.

fix: only send order to buenvio when is selected.
feat: add shipped order status.

feat: require woocommerce to activate plugin.
avoid site crashing when buenvio is installed but woocommerce isn’t.

Location:
buenvio/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • buenvio/trunk/README.txt

    r2575495 r2588940  
    44Tags: woocommerce buenvio, buenvio, buenvio woocommerce, buenvio shipping, buenvio api, shipping rates, live rates, shipping method, flexible shipping, woocommerce shipping
    55Requires at least: 4.5
    6 Tested up to: 5.7
    7 Stable tag: 1.0.1
     6Tested up to: 5.8
     7Stable tag: 1.0.2
    88Requires PHP: 7.0
    99License: GPLv3 or later
     
    2020=== Este plugin solo funciona para envíos en República Dominicana ===
    2121
    22 = 1.0.1 0 2021-07-30 =
     22= 1.0.2 - 2021-08-25 =
     23* Funcionalidad: Se agregó estado de "Enviado" a las ordenes
     24* Corrección: Solo crear order en Buenvio cuando se ha seleccionado Buenvio como método de envío
     25
     26= 1.0.1 - 2021-07-30 =
    2327* Logo Buenvio
    2428
  • buenvio/trunk/buenvio.php

    r2547169 r2588940  
    1616 * Plugin Name:       Buenvio
    1717 * Plugin URI:        https://buenvio.com/
    18  * Description:       Integra buenvio a tu tienda!
    19  * Version:           1.0.0
     18 * Description:       Utiliza este plugin gratuito para integrar los envios con Buenvio a tu tienda woocommerce.
     19 * Version:           1.0.2
    2020 * Author:            Inspira Punto Do, E.I.R.L
    2121 * Author URI:        https://inspira.do/
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'BUENVIO_VERSION', '1.0.0' );
     38define( 'BUENVIO_VERSION', '1.0.2' );
    3939
    4040/**
  • buenvio/trunk/includes/class-buenvio-activator.php

    r2547169 r2588940  
    2323class Buenvio_Activator {
    2424    public static function activate() {
    25 
     25        $active_plugins = apply_filters('active_plugins', get_option('active_plugins'));
     26        if (!stripos(implode($active_plugins), 'woocommerce.php')) {
     27            deactivate_plugins( basename( __FILE__ ) );
     28            wp_die('<p>Debes tener <strong>Woocommerce</strong> instalado para poder utilizar el Plugin de Buenvio.</p>','Plugin Activation Error',  array( 'response'=>200, 'back_link'=>TRUE ) );     
     29        }
    2630    }
    27 
    28 }
     31  }
  • buenvio/trunk/includes/class-buenvio.php

    r2547169 r2588940  
    149149
    150150        //ORDER
    151         $this->loader->add_action('woocommerce_order_status_processing', $plugin_order, 'create_shipping_request');
     151        $this->loader->add_action('woocommerce_order_status_shipped', $plugin_order, 'create_shipping_request');
    152152        $this->loader->add_action('woocommerce_order_status_cancelled', $plugin_order, 'cancel_shipping_request');
    153153        $this->loader->add_action('woocommerce_order_details_after_order_table', $plugin_order, 'action_order_details_after_order_table');
     154
     155        //ADD CUSTOM RODER STATUS
     156        $this->loader->add_action('init', $plugin_order, 'register_shipped_order_status');
     157        $this->loader->add_filter('wc_order_statuses', $plugin_order, 'custom_order_status');
    154158
    155159        //CART
  • buenvio/trunk/public/class-buenvio-order.php

    r2547169 r2588940  
    3434    }
    3535   
     36    function register_shipped_order_status() {
     37        register_post_status( 'wc-shipped', array(
     38            'label'                     => 'Enviado',
     39            'public'                    => true,
     40            'exclude_from_search'       => false,
     41            'show_in_admin_all_list'    => true,
     42            'show_in_admin_status_list' => true,
     43            'label_count'               => _n_noop( 'Enviado <span class="count">(%s)</span>', 'Enviado <span class="count">(%s)</span>' )
     44        ) );
     45    }
     46
     47    function custom_order_status($order_statuses) {
     48        $order_statuses['wc-shipped'] = _x( 'Enviado', 'Estado de la ordern', 'woocommerce' );
     49        return $order_statuses;
     50    }
     51
    3652    function create_shipping_request( $order_id ) {
    3753        if(get_post_meta($order_id, 'tracking_code', true)) {
     
    4056
    4157        $order = wc_get_order( $order_id );
     58        if( !$order->has_shipping_method('Buenvio') ) {
     59            return;
     60        }
    4261
    4362        //SEND ORDER TO BUENVIO
     
    107126
    108127        $order = wc_get_order( $order_id );
     128        if( !$order->has_shipping_method('Buenvio') ) {
     129            return;
     130        }
    109131
    110132        $buenvio_data = get_option('buenvio');
Note: See TracChangeset for help on using the changeset viewer.