2016-01-19 17:57:03 +00:00
< ? php
2017-11-07 08:11:19 +00:00
/**
* Shipping zone admin
*
2020-08-05 16:36:24 +00:00
* @ package WooCommerce\Admin\Shipping
2017-11-07 08:11:19 +00:00
*/
2016-01-19 17:57:03 +00:00
if ( ! defined ( 'ABSPATH' ) ) {
exit ;
}
?>
2016-05-13 15:08:19 +00:00
< h2 >
2017-11-07 08:11:19 +00:00
< a href = " <?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping' ) ); ?> " >< ? php esc_html_e ( 'Shipping zones' , 'woocommerce' ); ?> </a> >
2017-01-17 15:25:12 +00:00
< span class = " wc-shipping-zone-name " >< ? php echo esc_html ( $zone -> get_zone_name () ? $zone -> get_zone_name () : __ ( 'Zone' , 'woocommerce' ) ); ?> </span>
2016-05-13 15:08:19 +00:00
</ h2 >
2018-11-18 11:59:54 +00:00
< ? php do_action ( 'woocommerce_shipping_zone_before_methods_table' , $zone ); ?>
2016-05-20 12:27:25 +00:00
2016-09-24 02:22:57 +00:00
< table class = " form-table wc-shipping-zone-settings " >
< tbody >
2016-11-15 22:55:14 +00:00
< ? php if ( 0 !== $zone -> get_id () ) : ?>
2016-10-10 17:41:07 +00:00
< tr valign = " top " class = " " >
< th scope = " row " class = " titledesc " >
2018-04-17 11:19:01 +00:00
< label for = " zone_name " >
< ? php esc_html_e ( 'Zone name' , 'woocommerce' ); ?>
< ? php echo wc_help_tip ( __ ( 'This is the name of the zone for your reference.' , 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</ label >
2016-10-10 17:41:07 +00:00
</ th >
< td class = " forminp " >
2017-11-07 08:11:19 +00:00
< input type = " text " data - attribute = " zone_name " name = " zone_name " id = " zone_name " value = " <?php echo esc_attr( $zone->get_zone_name ( 'edit' ) ); ?> " placeholder = " <?php esc_attr_e( 'Zone name', 'woocommerce' ); ?> " >
2016-10-10 17:41:07 +00:00
</ td >
</ tr >
< tr valign = " top " class = " " >
< th scope = " row " class = " titledesc " >
2018-04-17 11:19:01 +00:00
< label for = " zone_locations " >
< ? php esc_html_e ( 'Zone regions' , 'woocommerce' ); ?>
< ? php echo wc_help_tip ( __ ( 'These are regions inside this zone. Customers will be matched against these regions.' , 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</ label >
2016-10-10 17:41:07 +00:00
</ th >
< td class = " forminp " >
2019-08-28 13:53:01 +00:00
< select multiple = " multiple " data - attribute = " zone_locations " id = " zone_locations " name = " zone_locations " data - placeholder = " <?php esc_attr_e( 'Select regions within this zone', 'woocommerce' ); ?> " class = " wc-shipping-zone-region-select chosen_select " >
2016-10-10 17:41:07 +00:00
< ? php
2019-01-09 17:48:18 +00:00
foreach ( $shipping_continents as $continent_code => $continent ) {
2019-01-04 11:05:29 +00:00
echo '<option value="continent:' . esc_attr ( $continent_code ) . '"' . wc_selected ( " continent: $continent_code " , $locations ) . '>' . esc_html ( $continent [ 'name' ] ) . '</option>' ;
2016-09-24 02:22:57 +00:00
2017-11-07 08:11:19 +00:00
$countries = array_intersect ( array_keys ( $allowed_countries ), $continent [ 'countries' ] );
2016-09-24 02:22:57 +00:00
2017-11-07 08:11:19 +00:00
foreach ( $countries as $country_code ) {
2019-01-04 11:05:29 +00:00
echo '<option value="country:' . esc_attr ( $country_code ) . '"' . wc_selected ( " country: $country_code " , $locations ) . '>' . esc_html ( ' ' . $allowed_countries [ $country_code ] ) . '</option>' ;
2016-09-24 02:22:57 +00:00
2019-01-09 17:49:11 +00:00
$states = WC () -> countries -> get_states ( $country_code );
if ( $states ) {
2017-11-07 08:11:19 +00:00
foreach ( $states as $state_code => $state_name ) {
2019-01-04 11:05:29 +00:00
echo '<option value="state:' . esc_attr ( $country_code . ':' . $state_code ) . '"' . wc_selected ( " state: $country_code : $state_code " , $locations ) . '>' . esc_html ( ' ' . $state_name . ', ' . $allowed_countries [ $country_code ] ) . '</option>' ;
2016-09-24 02:22:57 +00:00
}
}
}
2017-11-07 08:11:19 +00:00
}
2016-10-10 17:41:07 +00:00
?>
</ select >
< ? php if ( empty ( $postcodes ) ) : ?>
2017-11-07 08:11:19 +00:00
< a class = " wc-shipping-zone-postcodes-toggle " href = " # " >< ? php esc_html_e ( 'Limit to specific ZIP/postcodes' , 'woocommerce' ); ?> </a>
2016-10-10 17:41:07 +00:00
< ? php endif ; ?>
< div class = " wc-shipping-zone-postcodes " >
< textarea name = " zone_postcodes " data - attribute = " zone_postcodes " id = " zone_postcodes " placeholder = " <?php esc_attr_e( 'List 1 postcode per line', 'woocommerce' ); ?> " class = " input-text large-text " cols = " 25 " rows = " 5 " >< ? php echo esc_textarea ( implode ( " \n " , $postcodes ) ); ?> </textarea>
2018-01-29 15:32:55 +00:00
< ? php /* translators: WooCommerce link to setting up shipping zones */ ?>
2018-02-12 11:17:23 +00:00
< span class = " description " >< ? php printf ( __ ( 'Postcodes containing wildcards (e.g. CB23*) or fully numeric ranges (e.g. <code>90210...99000</code>) are also supported. Please see the shipping zones <a href="%s" target="_blank">documentation</a>) for more information.' , 'woocommerce' ), 'https://docs.woocommerce.com/document/setting-up-shipping-zones/#section-3' ); ?> </span><?php // @codingStandardsIgnoreLine. ?>
2016-10-10 17:41:07 +00:00
</ div >
</ td >
2017-01-31 16:25:57 +00:00
< ? php endif ; ?>
</ tr >
2016-09-24 02:22:57 +00:00
< tr valign = " top " class = " " >
< th scope = " row " class = " titledesc " >
2018-04-17 11:19:01 +00:00
< label >
< ? php esc_html_e ( 'Shipping methods' , 'woocommerce' ); ?>
< ? php echo wc_help_tip ( __ ( 'The following shipping methods apply to customers with shipping addresses within this zone.' , 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</ label >
2016-09-24 02:22:57 +00:00
</ th >
< td class = " " >
< table class = " wc-shipping-zone-methods widefat " >
< thead >
< tr >
2017-01-31 16:25:57 +00:00
< th class = " wc-shipping-zone-method-sort " ></ th >
2018-04-12 15:59:42 +00:00
< th class = " wc-shipping-zone-method-title " >< ? php esc_html_e ( 'Title' , 'woocommerce' ); ?> </th>
2016-09-24 02:22:57 +00:00
< th class = " wc-shipping-zone-method-enabled " >< ? php esc_html_e ( 'Enabled' , 'woocommerce' ); ?> </th>
< th class = " wc-shipping-zone-method-description " >< ? php esc_html_e ( 'Description' , 'woocommerce' ); ?> </th>
</ tr >
</ thead >
< tfoot >
< tr >
2017-01-31 16:25:57 +00:00
< td colspan = " 4 " >
2017-11-07 08:14:44 +00:00
< button type = " submit " class = " button wc-shipping-zone-add-method " value = " <?php esc_attr_e( 'Add shipping method', 'woocommerce' ); ?> " >< ? php esc_html_e ( 'Add shipping method' , 'woocommerce' ); ?> </button>
2016-09-24 02:22:57 +00:00
</ td >
</ tr >
</ tfoot >
< tbody class = " wc-shipping-zone-method-rows " ></ tbody >
</ table >
2016-05-12 10:07:18 +00:00
</ td >
</ tr >
2016-09-24 02:22:57 +00:00
</ tbody >
2016-01-05 11:23:15 +00:00
</ table >
2018-05-04 13:16:36 +00:00
2018-11-18 11:59:54 +00:00
< ? php do_action ( 'woocommerce_shipping_zone_after_methods_table' , $zone ); ?>
2018-05-04 13:16:36 +00:00
2016-09-24 02:22:57 +00:00
< p class = " submit " >
2017-11-07 08:14:44 +00:00
< button type = " submit " name = " submit " id = " submit " class = " button button-primary button-large wc-shipping-zone-method-save " value = " <?php esc_attr_e( 'Save changes', 'woocommerce' ); ?> " disabled >< ? php esc_html_e ( 'Save changes' , 'woocommerce' ); ?> </button>
2016-09-24 02:22:57 +00:00
</ p >
2016-01-05 11:23:15 +00:00
< script type = " text/html " id = " tmpl-wc-shipping-zone-method-row-blank " >
< tr >
2017-01-31 16:25:57 +00:00
< td class = " wc-shipping-zone-method-blank-state " colspan = " 4 " >
2017-11-07 08:11:19 +00:00
< p >< ? php esc_html_e ( 'You can add multiple shipping methods within this zone. Only customers within the zone will see them.' , 'woocommerce' ); ?> </p>
2016-01-05 11:23:15 +00:00
</ td >
</ tr >
</ script >
< script type = " text/html " id = " tmpl-wc-shipping-zone-method-row " >
2016-05-12 10:07:18 +00:00
< tr data - id = " { { data.instance_id }} " data - enabled = " { { data.enabled }} " >
< td width = " 1% " class = " wc-shipping-zone-method-sort " ></ td >
< td class = " wc-shipping-zone-method-title " >
2017-06-23 11:50:32 +00:00
< a class = " wc-shipping-zone-method-settings " href = " admin.php?page=wc-settings&tab=shipping&instance_id= { { data.instance_id }} " > {{{ data . title }}} </ a >
2016-10-11 10:46:23 +00:00
< div class = " row-actions " >
2017-11-07 08:11:19 +00:00
< a class = " wc-shipping-zone-method-settings " href = " admin.php?page=wc-settings&tab=shipping&instance_id= { { data.instance_id }} " >< ? php esc_html_e ( 'Edit' , 'woocommerce' ); ?> </a> | <a href="#" class="wc-shipping-zone-method-delete"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
2016-10-11 10:46:23 +00:00
</ div >
2016-01-05 11:23:15 +00:00
</ td >
2016-09-24 02:22:57 +00:00
< td width = " 1% " class = " wc-shipping-zone-method-enabled " >< a href = " # " > {{{ data . enabled_icon }}} </ a ></ td >
2017-01-31 16:25:57 +00:00
< td class = " wc-shipping-zone-method-description " >
< strong class = " wc-shipping-zone-method-type " > {{ data . method_title }} </ strong >
{{{ data . method_description }}}
</ td >
2016-05-12 10:07:18 +00:00
</ tr >
2016-01-05 11:23:15 +00:00
</ script >
2016-03-24 17:26:40 +00:00
< script type = " text/template " id = " tmpl-wc-modal-shipping-method-settings " >
2016-03-24 18:31:39 +00:00
< div class = " wc-backbone-modal wc-backbone-modal-shipping-method-settings " >
2016-03-24 17:26:40 +00:00
< div class = " wc-backbone-modal-content " >
< section class = " wc-backbone-modal-main " role = " main " >
< header class = " wc-backbone-modal-header " >
2018-03-05 18:59:17 +00:00
< h1 >
< ? php
2016-10-24 07:31:07 +00:00
printf (
2019-01-09 17:49:11 +00:00
/* translators: %s: shipping method title */
2016-10-24 07:31:07 +00:00
esc_html__ ( '%s Settings' , 'woocommerce' ),
'{{{ data.method.method_title }}}'
);
2018-03-05 18:59:17 +00:00
?>
</ h1 >
2016-03-24 17:26:40 +00:00
< button class = " modal-close modal-close-link dashicons dashicons-no-alt " >
2017-11-07 08:11:19 +00:00
< span class = " screen-reader-text " >< ? php esc_html_e ( 'Close modal panel' , 'woocommerce' ); ?> </span>
2016-03-24 17:26:40 +00:00
</ button >
</ header >
< article class = " wc-modal-shipping-method-settings " >
< form action = " " method = " post " >
{{{ data . method . settings_html }}}
< input type = " hidden " name = " instance_id " value = " { { { data.instance_id }}} " />
</ form >
</ article >
< footer >
< div class = " inner " >
2017-11-07 08:11:19 +00:00
< button id = " btn-ok " class = " button button-primary button-large " >< ? php esc_html_e ( 'Save changes' , 'woocommerce' ); ?> </button>
2016-03-24 17:26:40 +00:00
</ div >
</ footer >
</ section >
</ div >
</ div >
< div class = " wc-backbone-modal-backdrop modal-close " ></ div >
</ script >
2016-05-12 10:29:33 +00:00
< script type = " text/template " id = " tmpl-wc-modal-add-shipping-method " >
< div class = " wc-backbone-modal " >
< div class = " wc-backbone-modal-content " >
< section class = " wc-backbone-modal-main " role = " main " >
< header class = " wc-backbone-modal-header " >
2017-11-07 08:11:19 +00:00
< h1 >< ? php esc_html_e ( 'Add shipping method' , 'woocommerce' ); ?> </h1>
2016-05-12 10:29:33 +00:00
< button class = " modal-close modal-close-link dashicons dashicons-no-alt " >
2017-11-07 08:11:19 +00:00
< span class = " screen-reader-text " >< ? php esc_html_e ( 'Close modal panel' , 'woocommerce' ); ?> </span>
2016-05-12 10:29:33 +00:00
</ button >
</ header >
< article >
< form action = " " method = " post " >
< div class = " wc-shipping-zone-method-selector " >
2016-06-20 11:50:52 +00:00
< p >< ? php esc_html_e ( 'Choose the shipping method you wish to add. Only shipping methods which support zones are listed.' , 'woocommerce' ); ?> </p>
2016-05-12 10:29:33 +00:00
< select name = " add_method_id " >
< ? php
2018-10-02 15:03:17 +00:00
foreach ( WC () -> shipping () -> load_shipping_methods () as $method ) {
2017-11-07 08:11:19 +00:00
if ( ! $method -> supports ( 'shipping-zones' ) ) {
continue ;
2016-05-12 10:29:33 +00:00
}
2020-06-16 15:15:12 +00:00
echo '<option data-description="' . esc_attr ( wp_kses_post ( wpautop ( $method -> get_method_description () ) ) ) . '" value="' . esc_attr ( $method -> id ) . '">' . esc_html ( $method -> get_method_title () ) . '</li>' ;
2017-11-07 08:11:19 +00:00
}
2016-05-12 10:29:33 +00:00
?>
</ select >
</ div >
</ form >
</ article >
< footer >
< div class = " inner " >
2017-11-07 08:11:19 +00:00
< button id = " btn-ok " class = " button button-primary button-large " >< ? php esc_html_e ( 'Add shipping method' , 'woocommerce' ); ?> </button>
2016-05-12 10:29:33 +00:00
</ div >
</ footer >
</ section >
</ div >
</ div >
< div class = " wc-backbone-modal-backdrop modal-close " ></ div >
</ script >