Changeset 2465699
- Timestamp:
- 01/30/2021 10:02:12 PM (5 years ago)
- Location:
- deliveryplus-by-invisible-dragon
- Files:
-
- 10 edited
- 1 copied
-
tags/1.2.2 (copied) (copied from deliveryplus-by-invisible-dragon/trunk)
-
tags/1.2.2/bin/deploy.sh (modified) (1 diff)
-
tags/1.2.2/class.DeliveryPlus_Shipping_Method.php (modified) (5 diffs)
-
tags/1.2.2/id-delivery.php (modified) (1 diff)
-
tags/1.2.2/readme.txt (modified) (1 diff)
-
tags/1.2.2/tests/test-replacements.php (modified) (1 diff)
-
trunk/bin/deploy.sh (modified) (1 diff)
-
trunk/class.DeliveryPlus_Shipping_Method.php (modified) (5 diffs)
-
trunk/id-delivery.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/tests/test-replacements.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
deliveryplus-by-invisible-dragon/tags/1.2.2/bin/deploy.sh
r2251671 r2465699 6 6 # it does not exit with a 0, and I only care about the final exit. 7 7 set -eo 8 9 # TODO: Move to a function to pull out of id-delivery.php 10 env PLUGIN_VERSION=1.3 8 11 9 12 # Common cleanup actions. -
deliveryplus-by-invisible-dragon/tags/1.2.2/class.DeliveryPlus_Shipping_Method.php
r2402544 r2465699 53 53 'default' => '0.00', 54 54 'desc_tip' => true 55 ),56 'filter' => array(57 'title' => __('Filter'),58 'type' => 'deliveryplus_filter',59 'description' => __('Add filtering rules to determine if this rate is to be displayed on the page'),60 'default' => '[]',61 'context' => 'shipping_method'62 55 ) 63 ); 56 ); 57 58 // Shipping classes 59 if($instance_id > 0) { 60 $shipping_classes = WC()->shipping()->get_shipping_classes(); 61 if (!empty($shipping_classes)) { 62 foreach ($shipping_classes as $shipping_class) { 63 if (!isset($shipping_class->term_id)) { 64 continue; 65 } 66 $this->instance_form_fields['class_cost_' . $shipping_class->term_id] = array( 67 'title' => sprintf(__('"%s" shipping class cost'), esc_html($shipping_class->name)), 68 'type' => 'text', 69 'placeholder' => __('N/A'), 70 'description' => __('This cost will be added for each item which has this shipping class') 71 ); 72 } 73 74 } 75 } 76 77 $this->instance_form_fields['filter'] = array( 78 'title' => __('Filter'), 79 'type' => 'deliveryplus_filter', 80 'description' => __('Add filtering rules to determine if this rate is to be displayed on the page'), 81 'default' => '[]', 82 'context' => 'shipping_method' 83 ); 64 84 65 85 // GravityForms Integration … … 156 176 if($this->instance_id == sanitize_text_field($_GET['instance_id'])) { 157 177 158 if( acf_validate_save_post(true) ) { 159 acf_save_post( "woo_ship_" . $this->instance_id ); 160 } 178 if( function_exists('acf_validate_save_post') ) { // ACF may not be installed 179 if (acf_validate_save_post(true)) { 180 acf_save_post("woo_ship_" . $this->instance_id); 181 } 182 } 161 183 162 184 } … … 290 312 $total_flat_area = 0; 291 313 314 $additional_cost = 0; 315 292 316 foreach ( $package['contents'] as $item_id => $values ) { 293 317 if ( $values['quantity'] > 0 && $values['data']->needs_shipping() ) { … … 311 335 $weight = $prod->get_weight('edit'); 312 336 if($weight){ $total_weight += $weight * $values['quantity']; } 337 338 $shipping_class = $values['data']->get_shipping_class(); 339 if(!empty($shipping_class)) { 340 $shipping_class = get_term_by( 'slug', $shipping_class, 'product_shipping_class' ); 341 $charge = $this->get_option( 'class_cost_' . $shipping_class->term_id ); 342 if($charge) { 343 $additional_cost += $charge * $values['quantity']; 344 } 345 } 313 346 } 314 347 } … … 363 396 364 397 // Do the math. 365 return $sum ? WC_Eval_Math::evaluate( $sum ) : 0;398 return ($sum ? WC_Eval_Math::evaluate( $sum ) : 0) + $additional_cost; 366 399 367 400 } -
deliveryplus-by-invisible-dragon/tags/1.2.2/id-delivery.php
r2403850 r2465699 7 7 Author URI: https://invisibledragonltd.com/ 8 8 License: Private 9 Version: 1. 2.19 Version: 1.3 10 10 Requires PHP: 5.6 11 11 12 WC requires at least: 3.913 WC tested up to: 4.6.012 WC requires at least: 4.6 13 WC tested up to: 5.0 14 14 */ 15 15 16 define('ID_DELIVERY_VERSION', '1. 2');16 define('ID_DELIVERY_VERSION', '1.3'); 17 17 18 18 add_action( 'plugins_loaded', array( 'DeliveryPlusPlugin', 'get_instance' ) ); -
deliveryplus-by-invisible-dragon/tags/1.2.2/readme.txt
r2403850 r2465699 65 65 = 1.2.1 = 66 66 * Bugfix 67 68 = 1.3 = 69 * Actually works without Advanced Custom Fields 70 * Rate per each shipping class 67 71 68 72 == Upgrade Notice == -
deliveryplus-by-invisible-dragon/tags/1.2.2/tests/test-replacements.php
r2282505 r2465699 14 14 public function get_height($mode){ return 3; } 15 15 public function get_length($mode){ return 4; } 16 public function get_shipping_class(){} 16 17 17 18 } -
deliveryplus-by-invisible-dragon/trunk/bin/deploy.sh
r2251671 r2465699 6 6 # it does not exit with a 0, and I only care about the final exit. 7 7 set -eo 8 9 # TODO: Move to a function to pull out of id-delivery.php 10 env PLUGIN_VERSION=1.3 8 11 9 12 # Common cleanup actions. -
deliveryplus-by-invisible-dragon/trunk/class.DeliveryPlus_Shipping_Method.php
r2402544 r2465699 53 53 'default' => '0.00', 54 54 'desc_tip' => true 55 ),56 'filter' => array(57 'title' => __('Filter'),58 'type' => 'deliveryplus_filter',59 'description' => __('Add filtering rules to determine if this rate is to be displayed on the page'),60 'default' => '[]',61 'context' => 'shipping_method'62 55 ) 63 ); 56 ); 57 58 // Shipping classes 59 if($instance_id > 0) { 60 $shipping_classes = WC()->shipping()->get_shipping_classes(); 61 if (!empty($shipping_classes)) { 62 foreach ($shipping_classes as $shipping_class) { 63 if (!isset($shipping_class->term_id)) { 64 continue; 65 } 66 $this->instance_form_fields['class_cost_' . $shipping_class->term_id] = array( 67 'title' => sprintf(__('"%s" shipping class cost'), esc_html($shipping_class->name)), 68 'type' => 'text', 69 'placeholder' => __('N/A'), 70 'description' => __('This cost will be added for each item which has this shipping class') 71 ); 72 } 73 74 } 75 } 76 77 $this->instance_form_fields['filter'] = array( 78 'title' => __('Filter'), 79 'type' => 'deliveryplus_filter', 80 'description' => __('Add filtering rules to determine if this rate is to be displayed on the page'), 81 'default' => '[]', 82 'context' => 'shipping_method' 83 ); 64 84 65 85 // GravityForms Integration … … 156 176 if($this->instance_id == sanitize_text_field($_GET['instance_id'])) { 157 177 158 if( acf_validate_save_post(true) ) { 159 acf_save_post( "woo_ship_" . $this->instance_id ); 160 } 178 if( function_exists('acf_validate_save_post') ) { // ACF may not be installed 179 if (acf_validate_save_post(true)) { 180 acf_save_post("woo_ship_" . $this->instance_id); 181 } 182 } 161 183 162 184 } … … 290 312 $total_flat_area = 0; 291 313 314 $additional_cost = 0; 315 292 316 foreach ( $package['contents'] as $item_id => $values ) { 293 317 if ( $values['quantity'] > 0 && $values['data']->needs_shipping() ) { … … 311 335 $weight = $prod->get_weight('edit'); 312 336 if($weight){ $total_weight += $weight * $values['quantity']; } 337 338 $shipping_class = $values['data']->get_shipping_class(); 339 if(!empty($shipping_class)) { 340 $shipping_class = get_term_by( 'slug', $shipping_class, 'product_shipping_class' ); 341 $charge = $this->get_option( 'class_cost_' . $shipping_class->term_id ); 342 if($charge) { 343 $additional_cost += $charge * $values['quantity']; 344 } 345 } 313 346 } 314 347 } … … 363 396 364 397 // Do the math. 365 return $sum ? WC_Eval_Math::evaluate( $sum ) : 0;398 return ($sum ? WC_Eval_Math::evaluate( $sum ) : 0) + $additional_cost; 366 399 367 400 } -
deliveryplus-by-invisible-dragon/trunk/id-delivery.php
r2403850 r2465699 7 7 Author URI: https://invisibledragonltd.com/ 8 8 License: Private 9 Version: 1. 2.19 Version: 1.3 10 10 Requires PHP: 5.6 11 11 12 WC requires at least: 3.913 WC tested up to: 4.6.012 WC requires at least: 4.6 13 WC tested up to: 5.0 14 14 */ 15 15 16 define('ID_DELIVERY_VERSION', '1. 2');16 define('ID_DELIVERY_VERSION', '1.3'); 17 17 18 18 add_action( 'plugins_loaded', array( 'DeliveryPlusPlugin', 'get_instance' ) ); -
deliveryplus-by-invisible-dragon/trunk/readme.txt
r2403850 r2465699 65 65 = 1.2.1 = 66 66 * Bugfix 67 68 = 1.3 = 69 * Actually works without Advanced Custom Fields 70 * Rate per each shipping class 67 71 68 72 == Upgrade Notice == -
deliveryplus-by-invisible-dragon/trunk/tests/test-replacements.php
r2282505 r2465699 14 14 public function get_height($mode){ return 3; } 15 15 public function get_length($mode){ return 4; } 16 public function get_shipping_class(){} 16 17 17 18 }
Note: See TracChangeset
for help on using the changeset viewer.