No blank slate if methods exist

Closes #10757
This commit is contained in:
Mike Jolley 2016-04-22 11:13:39 +01:00
parent 1905c5ea0a
commit a9b8101e48
2 changed files with 23 additions and 18 deletions

View File

@ -224,8 +224,11 @@ class WC_Settings_Shipping extends WC_Settings_Page {
* Show zones * Show zones
*/ */
protected function zones_screen() { protected function zones_screen() {
global $wpdb;
$allowed_countries = WC()->countries->get_allowed_countries(); $allowed_countries = WC()->countries->get_allowed_countries();
$continents = WC()->countries->get_continents(); $continents = WC()->countries->get_continents();
$method_count = absint( $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}woocommerce_shipping_zone_methods" ) );
wp_localize_script( 'wc-shipping-zones', 'shippingZonesLocalizeScript', array( wp_localize_script( 'wc-shipping-zones', 'shippingZonesLocalizeScript', array(
'zones' => WC_Shipping_Zones::get_zones(), 'zones' => WC_Shipping_Zones::get_zones(),

View File

@ -57,6 +57,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</table> </table>
<script type="text/html" id="tmpl-wc-shipping-zone-row-blank"> <script type="text/html" id="tmpl-wc-shipping-zone-row-blank">
<?php if ( 0 === $method_count ) : ?>
<tr> <tr>
<td class="wc-shipping-zones-blank-state" colspan="4"> <td class="wc-shipping-zones-blank-state" colspan="4">
<p class="main"><?php _e( 'A shipping zone is a geographic region where a certain set of shipping methods and rates apply.', 'woocommerce' ); ?></p> <p class="main"><?php _e( 'A shipping zone is a geographic region where a certain set of shipping methods and rates apply.', 'woocommerce' ); ?></p>
@ -70,6 +71,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<a class="button button-primary wc-shipping-zone-add"><?php _e( 'Add shipping zone', 'woocommerce' ); ?></a> <a class="button button-primary wc-shipping-zone-add"><?php _e( 'Add shipping zone', 'woocommerce' ); ?></a>
</td> </td>
</tr> </tr>
<?php endif; ?>
</script> </script>
<script type="text/html" id="tmpl-wc-shipping-zone-row"> <script type="text/html" id="tmpl-wc-shipping-zone-row">