Plugin Directory

Changeset 3142456


Ignore:
Timestamp:
08/27/2024 06:28:31 PM (18 months ago)
Author:
anzia
Message:

version 1.6.3 -27-August-2024

  • Tested: Compatible With WooCommerce 9.2.3
  • Tested: Compatible With WordPress 6.6.1
  • Compatible: compatible with woo commerce HPOS
Location:
ni-woocommerce-admin-order-columns
Files:
9 added
3 edited

Legend:

Unmodified
Added
Removed
  • ni-woocommerce-admin-order-columns/trunk/includes/ni-order-columns-init.php

    r2649109 r3142456  
    22if ( ! defined( 'ABSPATH' ) ) { exit;}
    33if( !class_exists( 'Ni_Order_Columns_Init' ) ) {
    4     class Ni_Order_Columns_Init{
     4    include_once("niocowoo-function.php");
     5    class Ni_Order_Columns_Init extends NiOCoWoo_Function{
     6        var $is_hpos_enable = false;
    57        function __construct(){
    6             add_filter('manage_edit-shop_order_columns', array(&$this,'ni_add_custom_column'), 11);
    7             add_action( 'manage_shop_order_posts_custom_column' ,  array(&$this,'ni_add_custom_column_content'), 11, 2 );
    8            
    9            
     8            $this->is_hpos_enable =$this->is_hpos_enabled() ;
     9
     10            if ($this->is_hpos_enable){
     11                add_filter( 'manage_woocommerce_page_wc-orders_columns', array(&$this,'ni_add_custom_column'), 11);
     12                add_action( 'manage_woocommerce_page_wc-orders_custom_column'  ,  array(&$this,'ni_add_custom_column_content_hpos'), 11, 2 );
     13            }else{
     14               
     15                add_filter('manage_edit-shop_order_columns', array(&$this,'ni_add_custom_column'), 11);
     16                add_action( 'manage_shop_order_posts_custom_column' ,  array(&$this,'ni_add_custom_column_content'), 11, 2 );
     17               
     18            }
    1019           
    1120           
    1221        }
     22       
    1323        function ni_add_custom_column($columns){
    1424            $new_columns = array();
     25
     26           
    1527           
    1628            foreach ( $columns as $column_name => $column_info ) {
     
    8092
    8193        }
     94        function ni_add_custom_column_content_hpos($column, $post_id){
     95           
     96            $the_order = wc_get_order( $post_id );
     97
     98            //error_log(print_r($the_order, true));
     99            switch ( $column ) {
     100                case 'order_products' :
     101                 $order_items = $the_order->get_items();
     102                 
     103                 $admin_url =  admin_url("post.php")."?post=niproductid&action=edit";
     104                 
     105                 $prodct_name = '';
     106                 $prodct_names = array();
     107                 foreach( $order_items as $product ) {
     108                   
     109                    $product_id = isset( $product['product_id'])?$product['product_id']:0;
     110                   
     111                    $product_sku =   get_post_meta($product_id,'_sku',true);
     112                     
     113                     $product_name =  isset( $product['name'])?$product['name']:'';
     114                     $product_qty =  isset( $product['qty'])?$product['qty']:'';
     115                   
     116                    if ($product_sku  != ''){
     117                        $prodct_names[] =  '<a target="_blank" href="'.  str_replace ("niproductid", $product_id,$admin_url) .'">'.$product_name.'</a>' . ' ('. $product_sku  .')' .' x '. $product_qty;
     118                    }else{
     119                    $prodct_names[] =  '<a target="_blank" href="'.  str_replace ("niproductid", $product_id,$admin_url) .'">'.$product_name.'</a>' .' x '. $product_qty;
     120                    }   
     121                     
     122                 }
     123                 
     124                echo $product_list = implode( ', ', $prodct_names );
     125                break;
     126                case 'customer_ip_address' :
     127                echo $customer_ip = $the_order->get_customer_ip_address();
     128                break;
     129                case 'payment_method_title' :
     130                    echo    $payment_method = $the_order->get_payment_method_title();
     131                break; 
     132                case 'tax_total' :
     133                echo wc_price($the_order->get_total_tax());
     134                break; 
     135            }
     136
     137        }
    82138       
    83139    }
  • ni-woocommerce-admin-order-columns/trunk/ni-woocommerce-admin-order-columns.php

    r3095547 r3142456  
    55Description: Ni WooCommerce Admin Order Columns add the order product columns in admin order list.
    66Author: anzia
    7 Version: 1.6.2
     7Version: 1.6.3
    88Author URI: http://naziinfotech.com/
    99Plugin URI: https://wordpress.org/plugins/ni-woocommerce-admin-order-columns/
     
    1111License URI: http://www.gnu.org/licenses/agpl-3.0.html
    1212Requires at least: 4.7
    13 Tested up to: 6.5.3
     13Tested up to: 6.6.1
    1414WC requires at least: 3.0.0
    15 WC tested up to: 8.9.1
    16 Last Updated Date: 31-May-2024
     15WC tested up to: 9.2.3
     16Last Updated Date: 27-August-2024
    1717Requires PHP: 7.0
    1818
     
    2222        public function __construct(){ 
    2323           
     24            add_action( 'before_woocommerce_init',  array(&$this,'before_woocommerce_init') );
     25            add_action('plugins_loaded', array($this, 'plugins_loaded'));
     26        }
     27        function before_woocommerce_init(){
     28            if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
     29                \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
     30            }   
     31         }
     32        function plugins_loaded(){
    2433            include_once('includes/ni-order-columns-init.php');
    2534            $ni_order_columns_init = new Ni_Order_Columns_Init();
    26    
    27             add_action( 'before_woocommerce_init',  array(&$this,'before_woocommerce_init') );
    2835        }
    29          function before_woocommerce_init(){
    30             if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
    31                 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, false );
    32             }   
    33          }
    3436    }
    3537    $obj = new Ni_WooCommerce_Admin_Order_Columns();
  • ni-woocommerce-admin-order-columns/trunk/readme.txt

    r3095557 r3142456  
    22Contributors: anzia
    33Tags: product columns, order columns, admin columns, custom admin columns, sold item
    4 Stable tag: 1.6.2
     4Stable tag: 1.6.3
    55License: GPLv3 or later
    66License URI: http://www.gnu.org/licenses/agpl-3.0.html
    77Requires at least: 4.7
    8 Tested up to: 6.5.3
     8Tested up to: 6.6.1
    99WC requires at least: 3.0.0
    10 WC tested up to: 8.9.1
    11 Last Updated Date: 31-May-2024
     10WC tested up to: 9.2.3
     11Last Updated Date: 27-August-2024
    1212Requires PHP: 7.0
    1313
     
    3030</ul>
    3131
     32<p>
     33<strong>Note</strong>: This plugin is fully compatible with both WooCommerce's new High-Performance Order Storage (HPOS) and the legacy WordPress posts storage. Whether you are utilizing HPOS or the traditional storage method, you can rely on this plugin to work seamlessly with your current setup.
     34</p>
     35
    3236== Installation ==
    3337
     
    5458
    5559== Changelog ==
     60
     61= version 1.6.3 -27-August-2024 =
     62* Tested: Compatible With WooCommerce 9.2.3
     63* Tested: Compatible With WordPress 6.6.1
     64* Compatible: compatible with woocommerce HPOS
    5665
    5766= version 1.6.2 - 31-May-2024 =
Note: See TracChangeset for help on using the changeset viewer.