Worldwide zones needs handling
This commit is contained in:
parent
e25d876779
commit
44b2834d73
|
@ -27,7 +27,7 @@
|
|||
<td class="wc-shipping-zone-name"><a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-shipping&zone_id=0' ) ); ?>"><?php esc_html_e( 'Worldwide', 'woocommerce' ); ?></a></td>
|
||||
<td class="wc-shipping-zone-region"><?php esc_html_e( 'Shipping methods added here apply to all regions without a zone.', 'woocommerce' ); ?></td>
|
||||
<td>–</td>
|
||||
<td class="wc-shipping-zone-actions"></td>
|
||||
<td class="wc-shipping-zone-actions"><a class="wc-shipping-zone-view tips" data-tip="<?php _e( 'View Zone', 'woocommerce' ); ?>" href="admin.php?page=wc-shipping&zone_id=0"><?php _e( 'View', 'woocommerce' ); ?></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -8,7 +8,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
* Represents a single shipping zone
|
||||
*
|
||||
* @class WC_Shipping_Zone
|
||||
* @version 2.5.0
|
||||
* @version 2.6.0
|
||||
* @package WooCommerce/Classes
|
||||
* @category Class
|
||||
* @author WooThemes
|
||||
|
|
|
@ -57,23 +57,21 @@ class WC_Shipping_Zones {
|
|||
public static function get_zone_by( $by = 'zone_id', $id = 0 ) {
|
||||
global $wpdb;
|
||||
|
||||
$raw_zone = false;
|
||||
|
||||
switch ( $by ) {
|
||||
case 'zone_id' :
|
||||
$raw_zone = $wpdb->get_row( $wpdb->prepare( "SELECT zone_id, zone_name, zone_order FROM {$wpdb->prefix}woocommerce_shipping_zones WHERE zone_id = %d LIMIT 1;", $id ) );
|
||||
break;
|
||||
case 'instance_id' :
|
||||
$raw_zone = $wpdb->get_row( $wpdb->prepare( "
|
||||
SELECT zones.zone_id, zones.zone_name, zones.zone_order FROM {$wpdb->prefix}woocommerce_shipping_zones as zones
|
||||
LEFT JOIN {$wpdb->prefix}woocommerce_shipping_zone_methods as methods ON zones.zone_id = methods.zone_id
|
||||
WHERE methods.instance_id = %d LIMIT 1;
|
||||
", $id ) );
|
||||
break;
|
||||
default :
|
||||
$raw_zone = false;
|
||||
$zone_id = $wpdb->get_var( $wpdb->prepare( "SELECT zone_id FROM {$wpdb->prefix}woocommerce_shipping_zone_methods as methods WHERE methods.instance_id = %d LIMIT 1;", $id ) );
|
||||
if ( false !== $zone_id ) {
|
||||
return self::get_zone_by( 'zone_id', $zone_id );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $raw_zone ? new WC_Shipping_Zone( $raw_zone ) : false;
|
||||
return $raw_zone !== false ? new WC_Shipping_Zone( $raw_zone ) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue