Changeset 3271879
- Timestamp:
- 04/13/2025 06:04:03 PM (12 months ago)
- Location:
- cod24-shipping
- Files:
-
- 26 added
- 1 deleted
- 3 edited
-
tags/4.0.4/readme.txt (deleted)
-
tags/4.0.5 (added)
-
tags/4.0.5/assets (added)
-
tags/4.0.5/assets/css (added)
-
tags/4.0.5/assets/css/cod24-woo-admin.css (added)
-
tags/4.0.5/assets/css/sweetalert2.css (added)
-
tags/4.0.5/assets/index.php (added)
-
tags/4.0.5/assets/js (added)
-
tags/4.0.5/assets/js/city-select.js (added)
-
tags/4.0.5/assets/js/cod24-shcod-fee.js (added)
-
tags/4.0.5/assets/js/cod24-woo-admin.js (added)
-
tags/4.0.5/assets/js/sweetalert2.js (added)
-
tags/4.0.5/cod24-shipping.php (added)
-
tags/4.0.5/inc (added)
-
tags/4.0.5/inc/api (added)
-
tags/4.0.5/inc/api/class-cod24-api.php (added)
-
tags/4.0.5/inc/api/class-cod24-tipax-api.php (added)
-
tags/4.0.5/inc/class-cod24-settings.php (added)
-
tags/4.0.5/inc/class-cod24-shcod.php (added)
-
tags/4.0.5/inc/class-cod24-woo.php (added)
-
tags/4.0.5/inc/index.php (added)
-
tags/4.0.5/inc/shipping (added)
-
tags/4.0.5/inc/shipping/class-cod24-pishtaz.php (added)
-
tags/4.0.5/inc/shipping/class-cod24-special.php (added)
-
tags/4.0.5/inc/shipping/class-cod24-tipax.php (added)
-
tags/4.0.5/index.php (added)
-
tags/4.0.5/readme.txt (added)
-
trunk/cod24-shipping.php (modified) (2 diffs)
-
trunk/inc/class-cod24-woo.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cod24-shipping/trunk/cod24-shipping.php
r3267559 r3271879 3 3 Plugin Name: COD24 Shipping For Woocommerce 4 4 Description: This plugin is adding COD24 shipping methods to woocommerce. 5 Version: 4.0. 45 Version: 4.0.5 6 6 Author: COD24 7 7 Author URI: https://cod24.ir … … 27 27 public function __construct() 28 28 { 29 define('COD24_PLUGIN_VERSION', '4.0. 4');29 define('COD24_PLUGIN_VERSION', '4.0.5'); 30 30 define('COD24_PLUGIN_DIR', plugin_dir_path(__FILE__)); 31 31 define('COD24_PLUGIN_URL', plugin_dir_url(__FILE__)); -
cod24-shipping/trunk/inc/class-cod24-woo.php
r3257813 r3271879 6 6 * Package: COD24 Shipping 7 7 * Author: COD24 8 * Last Modified Time: 2025/0 3/18 16:02:438 * Last Modified Time: 2025/04/07 15:06:48 9 9 * License: GPL-2.0+ 10 10 * License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 48 48 // order metabox & ajax handler 49 49 add_action( 'add_meta_boxes' , array( &$this , 'order_detail_metabox' ) ); 50 add_action( 'save_post_shop_order', array( &$this , 'save_order_cod24_fields' ) );51 50 add_action( 'woocommerce_process_shop_order_meta', array( $this, 'save_order_cod24_fields' ) ); 52 51 … … 622 621 } 623 622 623 if( ! isset( $_POST['order_barcode_nonce'] ) ) { 624 return; 625 } 626 624 627 $order = wc_get_order( $order_id ); 625 628 $old_cod24_info = $order->get_meta('_cod24_info', true); 626 629 630 $total_weight = 0; 631 if( !empty( $order->get_items() ) ) 632 { 633 foreach ($order->get_items() as $item) { 634 if ($item['product_id'] > 0) 635 { 636 $quantity = $item['qty']; 637 $_product = $item->get_product(); 638 if (!$_product->is_virtual()) { 639 $total_weight += ( floatval( $_product->get_weight() ) * absint( $quantity ) ); 640 } 641 } 642 } 643 } 644 627 645 $shipping_types = array( 'post', 'tipax' ); 628 if( in_array( $old_cod24_info['shipping_type'], $shipping_types ))646 if( !empty( $old_cod24_info ) && isset( $old_cod24_info['shipping_type'] ) && ! empty( $old_cod24_info['shipping_type'] ) && in_array( $old_cod24_info['shipping_type'], $shipping_types ) && isset( $old_cod24_info['total_weight'] ) && ! empty( $old_cod24_info['total_weight'] ) && $old_cod24_info['total_weight'] > 0 ) 629 647 { 630 648 $cod24_info = array(); 631 649 $cod24_info['shipping_type'] = $old_cod24_info['shipping_type']; 650 $cod24_info['total_weight'] = $total_weight; 632 651 633 if( $old_cod24_info['shipping_type'] == 'post' )652 if( $old_cod24_info['shipping_type'] == 'post' && isset( $_POST['post_custom_total_weight'] ) && !empty( $_POST['post_custom_total_weight'] ) ) 634 653 { 635 636 654 // check total weight 637 655 $cod24_info['total_weight'] = floatval( sanitize_text_field( $_POST['post_custom_total_weight'] ) ); … … 657 675 } 658 676 } 659 elseif( $old_cod24_info['shipping_type'] == 'tipax' )677 elseif( $old_cod24_info['shipping_type'] == 'tipax' && isset( $_POST['tipax_custom_total_weight'] ) && !empty( $_POST['tipax_custom_total_weight'] ) ) 660 678 { 661 679 // check total weight … … 717 735 $order->update_meta_data( '_cod24_info', $cod24_info ); 718 736 $order->save(); 737 } 738 else 739 { 740 $cod24_info = array( 741 'total_weight' => ( $total_weight > 0 ) ? $total_weight : '', 742 'shipping_type' => 'post', 743 'serial' => '', 744 'barcode' => '', 745 'data' => '' 746 ); 747 748 $order->update_meta_data( '_cod24_info', $cod24_info ); 749 $order->save(); 719 750 } 720 751 } -
cod24-shipping/trunk/readme.txt
r3267559 r3271879 3 3 Tags: cod24, iran shipping, tipax, woocommerce shipping, shipping method 4 4 Requires at least: 5.0 5 Tested up to: 6. 76 Stable tag: 4.0. 45 Tested up to: 6.8 6 Stable tag: 4.0.5 7 7 License: GPL-2.0+ 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 43 43 44 44 == Changelog == 45 46 = 4.0.5 = 47 * Compatible with WP 6.8 48 * Bugs fixes when creating new order in the admin 45 49 46 50 = 4.0.4 =
Note: See TracChangeset
for help on using the changeset viewer.