Worldwide zone handling
This commit is contained in:
parent
44b2834d73
commit
7f61beee41
|
@ -100,7 +100,7 @@ class WC_Admin_Shipping_Zones {
|
|||
|
||||
?>
|
||||
<div class="wrap woocommerce">
|
||||
<h1><?php echo esc_html( $shipping_method->get_method_title() ); ?> <small class="wc-admin-breadcrumb">< <a href=""<?php echo esc_url( admin_url( 'admin.php?page=wc-shipping&zone_id=' . absint( $zone->get_zone_id() ) ) ); ?>"><?php _e( 'Shipping Methods', 'woocommerce' ); ?> (<?php echo esc_html( $zone->get_zone_name() ); ?>)</a> < <a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-shipping' ) ); ?>"><?php _e( 'Shipping Zones', 'woocommerce' ); ?></a></small></h1>
|
||||
<h1><?php echo esc_html( $shipping_method->get_method_title() ); ?> <small class="wc-admin-breadcrumb">< <a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-shipping&zone_id=' . absint( $zone->get_zone_id() ) ) ); ?>"><?php _e( 'Shipping Methods', 'woocommerce' ); ?> (<?php echo esc_html( $zone->get_zone_name() ); ?>)</a> < <a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-shipping' ) ); ?>"><?php _e( 'Shipping Zones', 'woocommerce' ); ?></a></small></h1>
|
||||
<form id="add-method" method="post">
|
||||
<?php $shipping_method->admin_options(); ?>
|
||||
<p class="submit"><input type="submit" class="button button-primary" name="save_method" value="<?php _e( 'Save changes', 'woocommerce' ); ?>" /></p>
|
||||
|
|
|
@ -44,6 +44,9 @@ class WC_Shipping_Zone {
|
|||
$this->set_zone_name( $zone->zone_name );
|
||||
$this->set_zone_order( $zone->zone_order );
|
||||
$this->read_zone_locations( $zone->zone_id );
|
||||
} elseif ( 0 === $zone ) {
|
||||
$this->set_zone_name( __( 'Worldwide', 'woocommerce' ) );
|
||||
$this->read_zone_locations( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,17 +61,22 @@ class WC_Shipping_Zones {
|
|||
|
||||
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 ) );
|
||||
if ( 0 === $id ) {
|
||||
return new WC_Shipping_Zone( 0 );
|
||||
} else {
|
||||
$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' :
|
||||
$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 );
|
||||
return self::get_zone_by( 'zone_id', absint( $zone_id ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $raw_zone !== false ? new WC_Shipping_Zone( $raw_zone ) : false;
|
||||
return $raw_zone ? new WC_Shipping_Zone( $raw_zone ) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue