Plugin Directory

Changeset 3143097


Ignore:
Timestamp:
08/28/2024 05:31:20 PM (19 months ago)
Author:
routedev
Message:

bugfix for older woo versions

Location:
routeapp/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • routeapp/trunk/includes/class-routeapp-woocommerce.php

    r3142452 r3143097  
    2424        if ($this->routeapp_route_enabled_extra_columns()) {
    2525            add_filter( 'manage_edit-shop_order_columns', array( $this, 'routeapp_add_order_route_columns_header' ), 20 );
    26             add_action( 'manage_shop_order_posts_custom_column',  array( $this, 'routeapp_manage_route_charge_posts_custom_column' ) , 99, 2 );
    27             add_action( 'restrict_manage_posts', array( $this, 'routeapp_display_admin_shop_order_route_protection_filter' ) , 99 );
    28             add_action( 'pre_get_posts', array( $this, 'routeapp_process_admin_shop_order_route_protection' ) , 99 );
    29 
    30             add_action( 'manage_woocommerce_page_wc-orders_custom_column',  array( $this, 'routeapp_manage_route_charge_posts_custom_column' ) , 99, 2 );
    31             add_action( 'manage_shop_order_custom_column',  array( $this, 'routeapp_manage_route_charge_posts_custom_column' ) , 99, 2 );
     26            add_action( 'manage_shop_order_posts_custom_column',  array( $this, 'routeapp_manage_route_charge_posts_custom_column' ));
     27            add_action( 'restrict_manage_posts', array( $this, 'routeapp_display_admin_shop_order_route_protection_filter' ) );
     28            add_action( 'pre_get_posts', array( $this, 'routeapp_process_admin_shop_order_route_protection' ));
     29
     30            add_action( 'manage_woocommerce_page_wc-orders_custom_column',  array( $this, 'routeapp_manage_route_charge_posts_custom_column_new' ) , 99, 2 );
     31            add_action( 'manage_shop_order_custom_column',  array( $this, 'routeapp_manage_route_charge_posts_custom_column_new' ) , 99, 2 );
    3232
    3333            add_filter( 'manage_woocommerce_page_wc-orders_columns', array( $this, 'routeapp_add_order_route_columns_header' ), 20 );
     
    5757
    5858    /**
     59     * Add their respective Route Protection and Route Charge values.
     60     *
     61     * @since 1.0.3
     62     * @return void
     63     */
     64    public function routeapp_manage_route_charge_posts_custom_column( $column ) {
     65        global $post;
     66        $order = wc_get_order( $post->ID );
     67
     68        if (  $column === 'route_charge' ) {
     69            echo wc_price( $this->routeapp_get_route_charge_fee( $order ), array( 'currency' => $order->get_currency() ) );
     70        } else if ( $column === 'route_protection' ) {
     71            echo $this->routeapp_order_has_route_protection_fee( $order ) ? "Yes" : "No";
     72        }
     73    }
     74
     75    /**
    5976    * Add their respective Route Protection and Route Charge values.
    6077    *
     
    6279    * @return void
    6380    */
    64     public function routeapp_manage_route_charge_posts_custom_column( $column,  $orderParam ) {
     81    public function routeapp_manage_route_charge_posts_custom_column_new( $column,  $orderParam ) {
    6582        global $post;
    6683
     
    87104    */
    88105   public function routeapp_get_route_charge_fee( $order ) {
     106       global $post;
    89107      $price = "";
    90108      if ( class_exists('Automattic\WooCommerce\Utilities\OrderUtil')
     
    93111         $price = $order->get_meta('_routeapp_route_charge');
    94112      } else {
    95          // Traditional CPT-based orders are in use.
    96          $price = get_post_meta($order->get_id(), '_routeapp_route_charge', true);
     113          $orderData = wc_get_order( $post->ID );
     114          if ($orderData) {
     115              // Traditional CPT-based orders are in use.
     116              $price = get_post_meta($order->get_id(), '_routeapp_route_charge', true);
     117          }
    97118      }
    98119     
     
    113134    */
    114135   public function routeapp_order_has_route_protection_fee( $order ) {
     136       global $post;
    115137       $route_protection = "0";
    116138       if ( class_exists('Automattic\WooCommerce\Utilities\OrderUtil')
     
    119141           $route_protection = $order->get_meta('_routeapp_route_protection');
    120142       } else {
    121            // Traditional CPT-based orders are in use.
    122            $route_protection = get_post_meta($order->get_id(), '_routeapp_route_protection', true);
     143           $orderData = wc_get_order( $post->ID );
     144           if ($orderData) {
     145               // Traditional CPT-based orders are in use.
     146               $route_protection = get_post_meta($orderData->get_id(), '_routeapp_route_protection', true);
     147           }
    123148       }
    124149       
  • routeapp/trunk/readme.txt

    r3142452 r3143097  
    66Requires at least: 4.0
    77Tested up to: 6.4.1
    8 Stable tag: 2.2.20
     8Stable tag: 2.2.21
    99Requires PHP: 5.6
    1010License: GPLv2 or later
     
    106106
    107107== Changelog ==
     108= 2.2.21 =
     109* Fix route information columns
     110
    108111= 2.2.20 =
    109112* Fix route information columns, display correct information
  • routeapp/trunk/routeapp.php

    r3142452 r3143097  
    1010 * Plugin URI:        https://route.com/for-merchants/
    1111 * Description:       Route allows shoppers to insure their orders with one-click during checkout, adding a layer of 3rd party trust while improving the customer shopping experience.
    12  * Version:           2.2.20
     12 * Version:           2.2.21
    1313 * Author:            Route
    1414 * Author URI:        https://route.com/
     
    2626 * Currently plugin version.
    2727 */
    28 define( 'ROUTEAPP_VERSION', '2.2.20' );
     28define( 'ROUTEAPP_VERSION', '2.2.21' );
    2929
    3030/**
Note: See TracChangeset for help on using the changeset viewer.