Changeset 2632724
- Timestamp:
- 11/19/2021 05:09:47 PM (4 years ago)
- Location:
- midwest-logistics/trunk
- Files:
-
- 4 edited
-
classes/class-ml-settings-orders.php (modified) (1 diff)
-
classes/class-wc-ml-shipping-method.php (modified) (15 diffs)
-
midwest-wholesale.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
midwest-logistics/trunk/classes/class-ml-settings-orders.php
r2481617 r2632724 350 350 function Midwest_Logistics_add_order_error_page( ) { 351 351 $settings_order_errrors = new ML_Settings_Orders(); 352 $orders = $settings_order_errrors->get_orders(); 353 354 355 $menuText = 'Orders With Errors '; 356 if(count($orders) > 0) { 357 $menuText .= '<span class="update-plugins"><span class="plugin-count">' . count($orders) . '</span></span>'; 358 } 359 352 360 353 add_submenu_page('midwest-logistics-options', 'Orders With Errors', 'Orders With Errors', "manage_options", "midwest-logistics-order_errors", array($settings_order_errrors,"settings_page") );361 add_submenu_page('midwest-logistics-options', 'Orders With Errors', $menuText , "manage_options", "midwest-logistics-order_errors", array($settings_order_errrors,"settings_page") ); 354 362 } 355 363 -
midwest-logistics/trunk/classes/class-wc-ml-shipping-method.php
r2529939 r2632724 14 14 private $saved_data; 15 15 16 16 17 17 18 18 public function __construct() { … … 21 21 $this->method_description = __( 'Link your current shipping zone rates to Midwest Logistics shipping options.' ); // 22 22 $this->enabled = "yes"; // This can be added as an setting but for this example its forced enabled 23 24 23 24 25 25 $shipping_options = new WC_ML_Shipping_Options(); 26 26 $this->shipping_options = $shipping_options->get_options(); 27 27 28 28 if($shipping_options->get_api_code() <> "200") { 29 29 $this->error_message = $shipping_options->get_api_error(); 30 30 } 31 add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) ); 31 32 32 33 $this->init(); 33 34 34 35 } 35 36 … … 41 42 */ 42 43 function init() { 44 $this->init_settings(); //load saved settings 43 45 $this->init_form_fields(); 44 $this->init_settings(); //load saved settings 45 46 47 46 48 // Save settings in admin if you have any defined 47 49 add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) ); 48 50 } 49 51 function init_form_fields() { 50 52 51 53 $data = $this->get_settings(); 52 54 53 55 $shipping_options = array(); 54 56 if(is_array($this->shipping_options)) { … … 57 59 } 58 60 } 59 61 60 62 if($this->error_message == "") { 61 63 $this->form_fields = array( … … 83 85 } 84 86 } // End init_form_fields() 85 87 86 88 function process_admin_options() { 87 89 $default_shipping = filter_input(INPUT_POST,"woocommerce_midwest_logistics_default_shipping"); 88 90 $default_shipping = sanitize_text_field($default_shipping); 89 91 90 92 $enable_mapping = filter_input(INPUT_POST,"woocommerce_midwest_logistics_enable_mapping"); 91 93 $enable_mapping = sanitize_text_field($enable_mapping); 92 94 93 95 $ML_WC_rate_link = isset($_POST["ML_WC_rate_link"]) == true ? $_POST["ML_WC_rate_link"] : []; 94 96 95 97 $data = array( 96 98 "default_shipping" => $default_shipping, … … 99 101 ); 100 102 update_option($this->data_name,serialize($data)); 103 104 $this->init_form_fields(); //reinitialize the form fields with the new data 101 105 } 102 106 function get_settings() { … … 126 130 parent::generate_settings_html($form_fields,true); 127 131 $this->generate_zone_table(); 128 132 129 133 ?> 130 134 </div> … … 148 152 .ml-shipping-setting label { 149 153 font-weight: bold; 150 154 151 155 } 152 156 .ml-shipping-setting .description { … … 161 165 } 162 166 } 163 164 167 168 165 169 function generate_zone_table() { 166 170 $this->saved_data = $this->get_settings(); … … 174 178 //var_dump($zone); 175 179 ?> 176 180 177 181 <h2><?php _e("Zone: " .$zone["zone_name"]) ?></h2> 178 182 <table class="wp-list-table widefat fixed striped table-view-list"> … … 191 195 $this->generate_usps_shipping_html($shipping_method); 192 196 193 197 194 198 } else { 195 199 $this->generate_general_zone_shipping_html($shipping_method); 196 200 } 197 198 201 202 199 203 } 200 204 ?> … … 207 211 } 208 212 private function generate_general_zone_shipping_html($shipping_method) { 209 213 210 214 $instance_id = $shipping_method->get_instance_id(); 211 215 if(empty($this->saved_data)) { … … 239 243 } 240 244 $rates_selected = $this->saved_data["rate_links"]; 241 245 242 246 $instance_id = $shipping_method->get_instance_id(); 243 247 require_once( MIDWESTLOGISTICS_PATH . 'classes/class-ml-ups-shipping.php' ); … … 296 300 } 297 301 $rates_selected = $this->saved_data["rate_links"]; 298 302 299 303 $instance_id = $shipping_method->get_instance_id(); 300 304 require_once( MIDWESTLOGISTICS_PATH . 'classes/class-ml-usps-shipping.php' ); 301 305 $ups_class = new ML_USPS_Shipping($instance_id); 302 306 $services = $ups_class->get_services(); 303 307 304 308 ?> 305 309 <tr> … … 346 350 <?php 347 351 } 348 352 349 353 } 350 354 -
midwest-logistics/trunk/midwest-wholesale.php
r2529939 r2632724 4 4 * Plugin URI: https://plugins.skynet-solutions.net/ 5 5 * Description: Midwest Wholesale Plugin allows you to automatically add Woocommerce orders into the Midwest Logistics order system. 6 * Version: 1.1.1 86 * Version: 1.1.19 7 7 * WC requires at least: 3.0.0 8 8 * WC tested up to: 5.2.2 -
midwest-logistics/trunk/readme.txt
r2632290 r2632724 5 5 Tested up to: 5.7.1 6 6 Requires PHP: 5.4 7 Stable tag: 1.1.1 87 Stable tag: 1.1.19 8 8 License: GPLv3 9 9 … … 109 109 110 110 == Changelog == 111 = 1.0.19 (2021-05-11) = 112 * Update - When hovering over the Midwest Logistics menu the Orders with Errors menu now shows a count. The count is the number of WooCommerce orders that could not be put into Midwest Logistics. If there is no count there are no orders that need to be reviewed. 113 * Fix - Fixed issue with Midwest Logistics WooCommerce shipping settings not saving properly. 114 111 115 = 1.0.18 (2021-05-11) = 112 116 * Update - Added support for WooCommerce USPS and UPS plugins.
Note: See TracChangeset
for help on using the changeset viewer.