initial commit
This commit is contained in:
11
includes/admin/settings/views/class-wc-settings-rest-api.php
Normal file
11
includes/admin/settings/views/class-wc-settings-rest-api.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php // @codingStandardsIgnoreFile.
|
||||
/**
|
||||
* Settings class file.
|
||||
*
|
||||
* @deprecated 3.4.0 Replaced with class-wc-settings-advanced.php.
|
||||
* @todo remove in 4.0.
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
return include __DIR__ . '/class-wc-settings-advanced.php';
|
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* Shipping classes admin
|
||||
*
|
||||
* @package WooCommerce\Admin\Shipping
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<h2>
|
||||
<?php esc_html_e( 'Shipping classes', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Shipping classes can be used to group products of similar type and can be used by some Shipping Methods (such as "Flat rate shipping") to provide different rates to different classes of product.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
|
||||
</h2>
|
||||
|
||||
<table class="wc-shipping-classes widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach ( $shipping_class_columns as $class => $heading ) : ?>
|
||||
<th class="<?php echo esc_attr( $class ); ?>"><?php echo esc_html( $heading ); ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="<?php echo absint( count( $shipping_class_columns ) ); ?>">
|
||||
<button type="submit" name="save" class="button button-primary wc-shipping-class-save" value="<?php esc_attr_e( 'Save shipping classes', 'woocommerce' ); ?>" disabled><?php esc_html_e( 'Save shipping classes', 'woocommerce' ); ?></button>
|
||||
<a class="button button-secondary wc-shipping-class-add" href="#"><?php esc_html_e( 'Add shipping class', 'woocommerce' ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody class="wc-shipping-class-rows"></tbody>
|
||||
</table>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-class-row-blank">
|
||||
<tr>
|
||||
<td class="wc-shipping-classes-blank-state" colspan="<?php echo absint( count( $shipping_class_columns ) ); ?>"><p><?php esc_html_e( 'No shipping classes have been created.', 'woocommerce' ); ?></p></td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-class-row">
|
||||
<tr data-id="{{ data.term_id }}">
|
||||
<?php
|
||||
foreach ( $shipping_class_columns as $class => $heading ) {
|
||||
echo '<td class="' . esc_attr( $class ) . '">';
|
||||
switch ( $class ) {
|
||||
case 'wc-shipping-class-name':
|
||||
?>
|
||||
<div class="view">
|
||||
{{ data.name }}
|
||||
<div class="row-actions">
|
||||
<a class="wc-shipping-class-edit" href="#"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-class-delete"><?php esc_html_e( 'Remove', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="edit">
|
||||
<input type="text" name="name[{{ data.term_id }}]" data-attribute="name" value="{{ data.name }}" placeholder="<?php esc_attr_e( 'Shipping class name', 'woocommerce' ); ?>" />
|
||||
<div class="row-actions">
|
||||
<a class="wc-shipping-class-cancel-edit" href="#"><?php esc_html_e( 'Cancel changes', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-slug':
|
||||
?>
|
||||
<div class="view">{{ data.slug }}</div>
|
||||
<div class="edit"><input type="text" name="slug[{{ data.term_id }}]" data-attribute="slug" value="{{ data.slug }}" placeholder="<?php esc_attr_e( 'Slug', 'woocommerce' ); ?>" /></div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-description':
|
||||
?>
|
||||
<div class="view">{{ data.description }}</div>
|
||||
<div class="edit"><input type="text" name="description[{{ data.term_id }}]" data-attribute="description" value="{{ data.description }}" placeholder="<?php esc_attr_e( 'Description for your reference', 'woocommerce' ); ?>" /></div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-count':
|
||||
?>
|
||||
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=product&product_shipping_class=' ) ); ?>{{data.slug}}">{{ data.count }}</a>
|
||||
<?php
|
||||
break;
|
||||
default:
|
||||
do_action( 'woocommerce_shipping_classes_column_' . $class );
|
||||
break;
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</script>
|
@ -0,0 +1,208 @@
|
||||
<?php
|
||||
/**
|
||||
* Shipping zone admin
|
||||
*
|
||||
* @package WooCommerce\Admin\Shipping
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<h2>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping' ) ); ?>"><?php esc_html_e( 'Shipping zones', 'woocommerce' ); ?></a> >
|
||||
<span class="wc-shipping-zone-name"><?php echo esc_html( $zone->get_zone_name() ? $zone->get_zone_name() : __( 'Zone', 'woocommerce' ) ); ?></span>
|
||||
</h2>
|
||||
|
||||
<?php do_action( 'woocommerce_shipping_zone_before_methods_table', $zone ); ?>
|
||||
|
||||
<table class="form-table wc-shipping-zone-settings">
|
||||
<tbody>
|
||||
<?php if ( 0 !== $zone->get_id() ) : ?>
|
||||
<tr valign="top" class="">
|
||||
<th scope="row" class="titledesc">
|
||||
<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>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<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' ); ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" class="">
|
||||
<th scope="row" class="titledesc">
|
||||
<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>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<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">
|
||||
<?php
|
||||
foreach ( $shipping_continents as $continent_code => $continent ) {
|
||||
echo '<option value="continent:' . esc_attr( $continent_code ) . '"' . wc_selected( "continent:$continent_code", $locations ) . '>' . esc_html( $continent['name'] ) . '</option>';
|
||||
|
||||
$countries = array_intersect( array_keys( $allowed_countries ), $continent['countries'] );
|
||||
|
||||
foreach ( $countries as $country_code ) {
|
||||
echo '<option value="country:' . esc_attr( $country_code ) . '"' . wc_selected( "country:$country_code", $locations ) . '>' . esc_html( ' ' . $allowed_countries[ $country_code ] ) . '</option>';
|
||||
|
||||
$states = WC()->countries->get_states( $country_code );
|
||||
|
||||
if ( $states ) {
|
||||
foreach ( $states as $state_code => $state_name ) {
|
||||
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>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php if ( empty( $postcodes ) ) : ?>
|
||||
<a class="wc-shipping-zone-postcodes-toggle" href="#"><?php esc_html_e( 'Limit to specific ZIP/postcodes', 'woocommerce' ); ?></a>
|
||||
<?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>
|
||||
<?php /* translators: WooCommerce link to setting up shipping zones */ ?>
|
||||
<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. ?>
|
||||
</div>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<tr valign="top" class="">
|
||||
<th scope="row" class="titledesc">
|
||||
<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>
|
||||
</th>
|
||||
<td class="">
|
||||
<table class="wc-shipping-zone-methods widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="wc-shipping-zone-method-sort"></th>
|
||||
<th class="wc-shipping-zone-method-title"><?php esc_html_e( 'Title', 'woocommerce' ); ?></th>
|
||||
<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>
|
||||
<td colspan="4">
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody class="wc-shipping-zone-method-rows"></tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php do_action( 'woocommerce_shipping_zone_after_methods_table', $zone ); ?>
|
||||
|
||||
<p class="submit">
|
||||
<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>
|
||||
</p>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-zone-method-row-blank">
|
||||
<tr>
|
||||
<td class="wc-shipping-zone-method-blank-state" colspan="4">
|
||||
<p><?php esc_html_e( 'You can add multiple shipping methods within this zone. Only customers within the zone will see them.', 'woocommerce' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-zone-method-row">
|
||||
<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">
|
||||
<a class="wc-shipping-zone-method-settings" href="admin.php?page=wc-settings&tab=shipping&instance_id={{ data.instance_id }}">{{{ data.title }}}</a>
|
||||
<div class="row-actions">
|
||||
<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>
|
||||
</div>
|
||||
</td>
|
||||
<td width="1%" class="wc-shipping-zone-method-enabled"><a href="#">{{{ data.enabled_icon }}}</a></td>
|
||||
<td class="wc-shipping-zone-method-description">
|
||||
<strong class="wc-shipping-zone-method-type">{{ data.method_title }}</strong>
|
||||
{{{ data.method_description }}}
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-wc-modal-shipping-method-settings">
|
||||
<div class="wc-backbone-modal wc-backbone-modal-shipping-method-settings">
|
||||
<div class="wc-backbone-modal-content">
|
||||
<section class="wc-backbone-modal-main" role="main">
|
||||
<header class="wc-backbone-modal-header">
|
||||
<h1>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: shipping method title */
|
||||
esc_html__( '%s Settings', 'woocommerce' ),
|
||||
'{{{ data.method.method_title }}}'
|
||||
);
|
||||
?>
|
||||
</h1>
|
||||
<button class="modal-close modal-close-link dashicons dashicons-no-alt">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span>
|
||||
</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">
|
||||
<button id="btn-ok" class="button button-primary button-large"><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wc-backbone-modal-backdrop modal-close"></div>
|
||||
</script>
|
||||
|
||||
<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">
|
||||
<h1><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></h1>
|
||||
<button class="modal-close modal-close-link dashicons dashicons-no-alt">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span>
|
||||
</button>
|
||||
</header>
|
||||
<article>
|
||||
<form action="" method="post">
|
||||
<div class="wc-shipping-zone-method-selector">
|
||||
<p><?php esc_html_e( 'Choose the shipping method you wish to add. Only shipping methods which support zones are listed.', 'woocommerce' ); ?></p>
|
||||
|
||||
<select name="add_method_id">
|
||||
<?php
|
||||
foreach ( WC()->shipping()->load_shipping_methods() as $method ) {
|
||||
if ( ! $method->supports( 'shipping-zones' ) ) {
|
||||
continue;
|
||||
}
|
||||
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>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" class="button button-primary button-large"><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></button>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wc-backbone-modal-backdrop modal-close"></div>
|
||||
</script>
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<h2>
|
||||
<a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=shipping' ); ?>"><?php _e( 'Shipping zones', 'woocommerce' ); ?></a> >
|
||||
<a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=' . absint( $zone->get_id() ) ); ?>"><?php echo esc_html( $zone->get_zone_name() ); ?></a> >
|
||||
<?php echo esc_html( $shipping_method->get_method_title() ); ?>
|
||||
</h2>
|
||||
|
||||
<?php $shipping_method->admin_options(); ?>
|
128
includes/admin/settings/views/html-admin-page-shipping-zones.php
Normal file
128
includes/admin/settings/views/html-admin-page-shipping-zones.php
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<h2 class="wc-shipping-zones-heading">
|
||||
<?php _e( 'Shipping zones', 'woocommerce' ); ?>
|
||||
<a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=new' ); ?>" class="page-title-action"><?php esc_html_e( 'Add shipping zone', 'woocommerce' ); ?></a>
|
||||
</h2>
|
||||
<p><?php echo __( 'A shipping zone is a geographic region where a certain set of shipping methods are offered.', 'woocommerce' ) . ' ' . __( 'WooCommerce will match a customer to a single zone using their shipping address and present the shipping methods within that zone to them.', 'woocommerce' ); ?></p>
|
||||
<table class="wc-shipping-zones widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="wc-shipping-zone-sort"><?php echo wc_help_tip( __( 'Drag and drop to re-order your custom zones. This is the order in which they will be matched against the customer address.', 'woocommerce' ) ); ?></th>
|
||||
<th class="wc-shipping-zone-name"><?php esc_html_e( 'Zone name', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-region"><?php esc_html_e( 'Region(s)', 'woocommerce' ); ?></th>
|
||||
<th class="wc-shipping-zone-methods"><?php esc_html_e( 'Shipping method(s)', 'woocommerce' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="wc-shipping-zone-rows"></tbody>
|
||||
<tbody>
|
||||
<tr data-id="0" class="wc-shipping-zone-worldwide">
|
||||
<td width="1%" class="wc-shipping-zone-worldwide"></td>
|
||||
<td class="wc-shipping-zone-name">
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=0' ) ); ?>"><?php esc_html_e( 'Locations not covered by your other zones', 'woocommerce' ); ?></a>
|
||||
<div class="row-actions">
|
||||
<a href="admin.php?page=wc-settings&tab=shipping&zone_id=0"><?php _e( 'Manage shipping methods', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-region"><?php _e( 'This zone is <b>optionally</b> used for regions that are not included in any other shipping zone.', 'woocommerce' ); ?></td>
|
||||
<td class="wc-shipping-zone-methods">
|
||||
<ul>
|
||||
<?php
|
||||
$worldwide = new WC_Shipping_Zone( 0 );
|
||||
$methods = $worldwide->get_shipping_methods();
|
||||
uasort( $methods, 'wc_shipping_zone_method_order_uasort_comparison' );
|
||||
|
||||
if ( ! empty( $methods ) ) {
|
||||
foreach ( $methods as $method ) {
|
||||
$class_name = 'yes' === $method->enabled ? 'method_enabled' : 'method_disabled';
|
||||
echo '<li class="wc-shipping-zone-method ' . esc_attr( $class_name ) . '">' . esc_html( $method->get_title() ) . '</li>';
|
||||
}
|
||||
} else {
|
||||
echo '<li class="wc-shipping-zone-method">' . __( 'No shipping methods offered to this zone.', 'woocommerce' ) . '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-zone-row-blank">
|
||||
<?php if ( 0 === $method_count ) : ?>
|
||||
<tr>
|
||||
<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><?php _e( 'For example:', 'woocommerce' ); ?></p>
|
||||
<ul>
|
||||
<li><?php _e( 'Local zone = California ZIP 90210 = Local pickup', 'woocommerce' ); ?>
|
||||
<li><?php _e( 'US domestic zone = All US states = Flat rate shipping', 'woocommerce' ); ?>
|
||||
<li><?php _e( 'Europe zone = Any country in Europe = Flat rate shipping', 'woocommerce' ); ?>
|
||||
</ul>
|
||||
<p><?php _e( 'Add as many zones as you need – customers will only see the methods available for their address.', 'woocommerce' ); ?></p>
|
||||
<a class="button button-primary wc-shipping-zone-add" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=new' ) ); ?>"><?php _e( 'Add shipping zone', 'woocommerce' ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-zone-row">
|
||||
<tr data-id="{{ data.zone_id }}">
|
||||
<td width="1%" class="wc-shipping-zone-sort"></td>
|
||||
<td class="wc-shipping-zone-name">
|
||||
<a href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}">{{ data.zone_name }}</a>
|
||||
<div class="row-actions">
|
||||
<a href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}"><?php _e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-zone-delete"><?php _e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-region">
|
||||
{{ data.formatted_zone_location }}
|
||||
</td>
|
||||
<td class="wc-shipping-zone-methods">
|
||||
<div><ul></ul></div>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<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">
|
||||
<h1><?php _e( 'Add shipping method', 'woocommerce' ); ?></h1>
|
||||
<button class="modal-close modal-close-link dashicons dashicons-no-alt">
|
||||
<span class="screen-reader-text"><?php _e( 'Close modal panel', 'woocommerce' ); ?></span>
|
||||
</button>
|
||||
</header>
|
||||
<article>
|
||||
<form action="" method="post">
|
||||
<div class="wc-shipping-zone-method-selector">
|
||||
<p><?php esc_html_e( 'Choose the shipping method you wish to add. Only shipping methods which support zones are listed.', 'woocommerce' ); ?></p>
|
||||
|
||||
<select name="add_method_id">
|
||||
<?php
|
||||
foreach ( WC()->shipping()->load_shipping_methods() as $method ) {
|
||||
if ( ! $method->supports( 'shipping-zones' ) ) {
|
||||
continue;
|
||||
}
|
||||
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>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" name="zone_id" value="{{{ data.zone_id }}}" />
|
||||
</div>
|
||||
</form>
|
||||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" class="button button-primary button-large"><?php _e( 'Add shipping method', 'woocommerce' ); ?></button>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wc-backbone-modal-backdrop modal-close"></div>
|
||||
</script>
|
156
includes/admin/settings/views/html-keys-edit.php
Normal file
156
includes/admin/settings/views/html-keys-edit.php
Normal file
@ -0,0 +1,156 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin view: Edit API keys
|
||||
*
|
||||
* @package WooCommerce\Admin\Settings
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
?>
|
||||
|
||||
<div id="key-fields" class="settings-panel">
|
||||
<h2><?php esc_html_e( 'Key details', 'woocommerce' ); ?></h2>
|
||||
|
||||
<input type="hidden" id="key_id" value="<?php echo esc_attr( $key_id ); ?>" />
|
||||
|
||||
<table id="api-keys-options" class="form-table">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="key_description">
|
||||
<?php esc_html_e( 'Description', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Friendly name for identifying this key.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input id="key_description" type="text" class="input-text regular-input" value="<?php echo esc_attr( $key_data['description'] ); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="key_user">
|
||||
<?php esc_html_e( 'User', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Owner of these keys.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<?php
|
||||
$current_user_id = get_current_user_id();
|
||||
$user_id = ! empty( $key_data['user_id'] ) ? absint( $key_data['user_id'] ) : $current_user_id;
|
||||
$user = get_user_by( 'id', $user_id );
|
||||
$user_string = sprintf(
|
||||
/* translators: 1: user display name 2: user ID 3: user email */
|
||||
esc_html__( '%1$s (#%2$s – %3$s)', 'woocommerce' ),
|
||||
$user->display_name,
|
||||
absint( $user->ID ),
|
||||
$user->user_email
|
||||
);
|
||||
?>
|
||||
<select class="wc-customer-search" id="key_user" data-placeholder="<?php esc_attr_e( 'Search for a user…', 'woocommerce' ); ?>" data-allow_clear="true">
|
||||
<option value="<?php echo esc_attr( $user_id ); ?>" selected="selected"><?php echo htmlspecialchars( wp_kses_post( $user_string ) ); // htmlspecialchars to prevent XSS when rendered by selectWoo. ?></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="key_permissions">
|
||||
<?php esc_html_e( 'Permissions', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Select the access type of these keys.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<select id="key_permissions" class="wc-enhanced-select">
|
||||
<?php
|
||||
$permissions = array(
|
||||
'read' => __( 'Read', 'woocommerce' ),
|
||||
'write' => __( 'Write', 'woocommerce' ),
|
||||
'read_write' => __( 'Read/Write', 'woocommerce' ),
|
||||
);
|
||||
|
||||
foreach ( $permissions as $permission_id => $permission_name ) :
|
||||
?>
|
||||
<option value="<?php echo esc_attr( $permission_id ); ?>" <?php selected( $key_data['permissions'], $permission_id, true ); ?>><?php echo esc_html( $permission_name ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ( 0 !== $key_id ) : ?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php esc_html_e( 'Consumer key ending in', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<code>…<?php echo esc_html( $key_data['truncated_key'] ); ?></code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php esc_html_e( 'Last access', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<span>
|
||||
<?php
|
||||
if ( ! empty( $key_data['last_access'] ) ) {
|
||||
/* translators: 1: last access date 2: last access time */
|
||||
$date = sprintf( __( '%1$s at %2$s', 'woocommerce' ), date_i18n( wc_date_format(), strtotime( $key_data['last_access'] ) ), date_i18n( wc_time_format(), strtotime( $key_data['last_access'] ) ) );
|
||||
|
||||
echo esc_html( apply_filters( 'woocommerce_api_key_last_access_datetime', $date, $key_data['last_access'] ) );
|
||||
} else {
|
||||
esc_html_e( 'Unknown', 'woocommerce' );
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php do_action( 'woocommerce_admin_key_fields', $key_data ); ?>
|
||||
|
||||
<?php
|
||||
if ( 0 === intval( $key_id ) ) {
|
||||
submit_button( __( 'Generate API key', 'woocommerce' ), 'primary', 'update_api_key' );
|
||||
} else {
|
||||
?>
|
||||
<p class="submit">
|
||||
<?php submit_button( __( 'Save changes', 'woocommerce' ), 'primary', 'update_api_key', false ); ?>
|
||||
<a style="color: #a00; text-decoration: none; margin-left: 10px;" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'revoke-key' => $key_id ), admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=keys' ) ), 'revoke' ) ); ?>"><?php esc_html_e( 'Revoke key', 'woocommerce' ); ?></a>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<script type="text/template" id="tmpl-api-keys-template">
|
||||
<p id="copy-error"></p>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php esc_html_e( 'Consumer key', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input id="key_consumer_key" type="text" value="{{ data.consumer_key }}" size="55" readonly="readonly"> <button type="button" class="button-secondary copy-key" data-tip="<?php esc_attr_e( 'Copied!', 'woocommerce' ); ?>"><?php esc_html_e( 'Copy', 'woocommerce' ); ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php esc_html_e( 'Consumer secret', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input id="key_consumer_secret" type="text" value="{{ data.consumer_secret }}" size="55" readonly="readonly"> <button type="button" class="button-secondary copy-secret" data-tip="<?php esc_attr_e( 'Copied!', 'woocommerce' ); ?>"><?php esc_html_e( 'Copy', 'woocommerce' ); ?></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php esc_html_e( 'QRCode', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<div id="keys-qrcode"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
153
includes/admin/settings/views/html-settings-tax.php
Normal file
153
includes/admin/settings/views/html-settings-tax.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin view: Settings tax
|
||||
*
|
||||
* @package WooCommerce\Admin\Settings
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="wc-tax-rates-search" id="rates-search">
|
||||
<input type="search" class="wc-tax-rates-search-field" placeholder="<?php esc_attr_e( 'Search…', 'woocommerce' ); ?>" value="<?php echo isset( $_GET['s'] ) ? esc_attr( $_GET['s'] ) : ''; ?>" />
|
||||
</div>
|
||||
|
||||
<div id="rates-pagination"></div>
|
||||
|
||||
<h3>
|
||||
<?php
|
||||
/* translators: %s: tax rate */
|
||||
printf(
|
||||
__( '"%s" tax rates', 'woocommerce' ),
|
||||
$current_class ? esc_html( $current_class ) : __( 'Standard', 'woocommerce' )
|
||||
);
|
||||
?>
|
||||
</h3>
|
||||
|
||||
<table class="wc_tax_rates wc_input_table widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="8%"><a href="https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes" target="_blank"><?php _e( 'Country code', 'woocommerce' ); ?></a> <?php echo wc_help_tip( __( 'A 2 digit country code, e.g. US. Leave blank to apply to all.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'State code', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'A 2 digit state code, e.g. AL. Leave blank to apply to all.', 'woocommerce' ) ); ?></th>
|
||||
<th><?php _e( 'Postcode / ZIP', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Postcode for this rule. Semi-colon (;) separate multiple values. Leave blank to apply to all areas. Wildcards (*) and ranges for numeric postcodes (e.g. 12345...12350) can also be used.', 'woocommerce' ) ); ?></th>
|
||||
<th><?php _e( 'City', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Cities for this rule. Semi-colon (;) separate multiple values. Leave blank to apply to all cities.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'Rate %', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Enter a tax rate (percentage) to 4 decimal places.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'Tax name', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Enter a name for this tax rate.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'Priority', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Choose a priority for this tax rate. Only 1 matching rate per priority will be used. To define multiple tax rates for a single area you need to specify a different priority per rate.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'Compound', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Choose whether or not this is a compound rate. Compound tax rates are applied on top of other tax rates.', 'woocommerce' ) ); ?></th>
|
||||
<th width="8%"><?php _e( 'Shipping', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'Choose whether or not this tax rate also gets applied to shipping.', 'woocommerce' ) ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="9">
|
||||
<a href="#" class="button plus insert"><?php _e( 'Insert row', 'woocommerce' ); ?></a>
|
||||
<a href="#" class="button minus remove_tax_rates"><?php _e( 'Remove selected row(s)', 'woocommerce' ); ?></a>
|
||||
<a href="#" download="tax_rates.csv" class="button export"><?php _e( 'Export CSV', 'woocommerce' ); ?></a>
|
||||
<a href="<?php echo admin_url( 'admin.php?import=woocommerce_tax_rate_csv' ); ?>" class="button import"><?php _e( 'Import CSV', 'woocommerce' ); ?></a>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody id="rates">
|
||||
<tr>
|
||||
<th colspan="9" style="text-align: center;"><?php esc_html_e( 'Loading…', 'woocommerce' ); ?></th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-tax-table-row">
|
||||
<tr class="tips" data-tip="<?php printf( esc_attr__( 'Tax rate ID: %s', 'woocommerce' ), '{{ data.tax_rate_id }}' ); ?>" data-id="{{ data.tax_rate_id }}">
|
||||
<td class="country">
|
||||
<input type="text" value="{{ data.tax_rate_country }}" placeholder="*" name="tax_rate_country[{{ data.tax_rate_id }}]" class="wc_input_country_iso" data-attribute="tax_rate_country" style="text-transform:uppercase" />
|
||||
</td>
|
||||
|
||||
<td class="state">
|
||||
<input type="text" value="{{ data.tax_rate_state }}" placeholder="*" name="tax_rate_state[{{ data.tax_rate_id }}]" data-attribute="tax_rate_state" />
|
||||
</td>
|
||||
|
||||
<td class="postcode">
|
||||
<input type="text" value="<# if ( data.postcode ) print( _.escape( data.postcode.join( '; ' ) ) ); #>" placeholder="*" data-name="tax_rate_postcode[{{ data.tax_rate_id }}]" data-attribute="postcode" />
|
||||
</td>
|
||||
|
||||
<td class="city">
|
||||
<input type="text" value="<# if ( data.city ) print( _.escape( data.city.join( '; ' ) ) ); #>" placeholder="*" data-name="tax_rate_city[{{ data.tax_rate_id }}]" data-attribute="city" />
|
||||
</td>
|
||||
|
||||
<td class="rate">
|
||||
<input type="text" value="{{ data.tax_rate }}" placeholder="0" name="tax_rate[{{ data.tax_rate_id }}]" data-attribute="tax_rate" />
|
||||
</td>
|
||||
|
||||
<td class="name">
|
||||
<input type="text" value="{{ data.tax_rate_name }}" name="tax_rate_name[{{ data.tax_rate_id }}]" data-attribute="tax_rate_name" />
|
||||
</td>
|
||||
|
||||
<td class="priority">
|
||||
<input type="number" step="1" min="1" value="{{ data.tax_rate_priority }}" name="tax_rate_priority[{{ data.tax_rate_id }}]" data-attribute="tax_rate_priority" />
|
||||
</td>
|
||||
|
||||
<td class="compound">
|
||||
<input type="checkbox" class="checkbox" name="tax_rate_compound[{{ data.tax_rate_id }}]" <# if ( parseInt( data.tax_rate_compound, 10 ) ) { #> checked="checked" <# } #> data-attribute="tax_rate_compound" />
|
||||
</td>
|
||||
|
||||
<td class="apply_to_shipping">
|
||||
<input type="checkbox" class="checkbox" name="tax_rate_shipping[{{ data.tax_rate_id }}]" <# if ( parseInt( data.tax_rate_shipping, 10 ) ) { #> checked="checked" <# } #> data-attribute="tax_rate_shipping" />
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-tax-table-row-empty">
|
||||
<tr>
|
||||
<th colspan="9" style="text-align:center"><?php esc_html_e( 'No matching tax rates found.', 'woocommerce' ); ?></th>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tmpl-wc-tax-table-pagination">
|
||||
<div class="tablenav">
|
||||
<div class="tablenav-pages">
|
||||
<span class="displaying-num">
|
||||
<?php
|
||||
/* translators: %s: number */
|
||||
printf(
|
||||
__( '%s items', 'woocommerce' ), // %s will be a number eventually, but must be a string for now.
|
||||
'{{ data.qty_rates }}'
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<span class="pagination-links">
|
||||
|
||||
<a class="tablenav-pages-navspan" data-goto="1">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'First page', 'woocommerce' ); ?></span>
|
||||
<span aria-hidden="true">«</span>
|
||||
</a>
|
||||
<a class="tablenav-pages-navspan" data-goto="<# print( Math.max( 1, parseInt( data.current_page, 10 ) - 1 ) ) #>">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Previous page', 'woocommerce' ); ?></span>
|
||||
<span aria-hidden="true">‹</span>
|
||||
</a>
|
||||
|
||||
<span class="paging-input">
|
||||
<label for="current-page-selector" class="screen-reader-text"><?php esc_html_e( 'Current page', 'woocommerce' ); ?></label>
|
||||
<?php
|
||||
/* translators: 1: current page 2: total pages */
|
||||
printf(
|
||||
esc_html_x( '%1$s of %2$s', 'Pagination', 'woocommerce' ),
|
||||
'<input class="current-page" id="current-page-selector" type="text" name="paged" value="{{ data.current_page }}" size="<# print( data.qty_pages.toString().length ) #>" aria-describedby="table-paging">',
|
||||
'<span class="total-pages">{{ data.qty_pages }}</span>'
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
|
||||
<a class="tablenav-pages-navspan" data-goto="<# print( Math.min( data.qty_pages, parseInt( data.current_page, 10 ) + 1 ) ) #>">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Next page', 'woocommerce' ); ?></span>
|
||||
<span aria-hidden="true">›</span>
|
||||
</a>
|
||||
<a class="tablenav-pages-navspan" data-goto="{{ data.qty_pages }}">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Last page', 'woocommerce' ); ?></span>
|
||||
<span aria-hidden="true">»</span>
|
||||
</a>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
229
includes/admin/settings/views/html-webhooks-edit.php
Normal file
229
includes/admin/settings/views/html-webhooks-edit.php
Normal file
@ -0,0 +1,229 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin View: Edit Webhooks
|
||||
*
|
||||
* @package WooCommerce\Admin\Webhooks\Views
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<input type="hidden" name="webhook_id" value="<?php echo esc_attr( $webhook->get_id() ); ?>" />
|
||||
|
||||
<div id="webhook-options" class="settings-panel">
|
||||
<h2><?php esc_html_e( 'Webhook data', 'woocommerce' ); ?></h2>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_name">
|
||||
<?php esc_html_e( 'Name', 'woocommerce' ); ?>
|
||||
<?php
|
||||
/* translators: %s: date */
|
||||
echo wc_help_tip( sprintf( __( 'Friendly name for identifying this webhook, defaults to Webhook created on %s.', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce' ) ) ) ); // @codingStandardsIgnoreLine
|
||||
?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input name="webhook_name" id="webhook_name" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_name() ); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_status">
|
||||
<?php esc_html_e( 'Status', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'The options are "Active" (delivers payload), "Paused" (does not deliver), or "Disabled" (does not deliver due delivery failures).', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<select name="webhook_status" id="webhook_status" class="wc-enhanced-select">
|
||||
<?php
|
||||
$statuses = wc_get_webhook_statuses();
|
||||
$current_status = $webhook->get_status();
|
||||
|
||||
foreach ( $statuses as $status_slug => $status_name ) :
|
||||
?>
|
||||
<option value="<?php echo esc_attr( $status_slug ); ?>" <?php selected( $current_status, $status_slug, true ); ?>><?php echo esc_html( $status_name ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_topic">
|
||||
<?php esc_html_e( 'Topic', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Select when the webhook will fire.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<select name="webhook_topic" id="webhook_topic" class="wc-enhanced-select">
|
||||
<?php
|
||||
$topic_data = WC_Admin_Webhooks::get_topic_data( $webhook );
|
||||
|
||||
$topics = apply_filters(
|
||||
'woocommerce_webhook_topics',
|
||||
array(
|
||||
'' => __( 'Select an option…', 'woocommerce' ),
|
||||
'coupon.created' => __( 'Coupon created', 'woocommerce' ),
|
||||
'coupon.updated' => __( 'Coupon updated', 'woocommerce' ),
|
||||
'coupon.deleted' => __( 'Coupon deleted', 'woocommerce' ),
|
||||
'coupon.restored' => __( 'Coupon restored', 'woocommerce' ),
|
||||
'customer.created' => __( 'Customer created', 'woocommerce' ),
|
||||
'customer.updated' => __( 'Customer updated', 'woocommerce' ),
|
||||
'customer.deleted' => __( 'Customer deleted', 'woocommerce' ),
|
||||
'order.created' => __( 'Order created', 'woocommerce' ),
|
||||
'order.updated' => __( 'Order updated', 'woocommerce' ),
|
||||
'order.deleted' => __( 'Order deleted', 'woocommerce' ),
|
||||
'order.restored' => __( 'Order restored', 'woocommerce' ),
|
||||
'product.created' => __( 'Product created', 'woocommerce' ),
|
||||
'product.updated' => __( 'Product updated', 'woocommerce' ),
|
||||
'product.deleted' => __( 'Product deleted', 'woocommerce' ),
|
||||
'product.restored' => __( 'Product restored', 'woocommerce' ),
|
||||
'action' => __( 'Action', 'woocommerce' ),
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $topics as $topic_slug => $topic_name ) :
|
||||
|
||||
$selected = $topic_slug === $topic_data['topic'] || $topic_slug === $topic_data['resource'] . '.' . $topic_data['event'];
|
||||
|
||||
?>
|
||||
<option value="<?php echo esc_attr( $topic_slug ); ?>" <?php selected( $selected, true, true ); ?>><?php echo esc_html( $topic_name ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top" id="webhook-action-event-wrap">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_action_event">
|
||||
<?php esc_html_e( 'Action event', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'Enter the action that will trigger this webhook.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input name="webhook_action_event" id="webhook_action_event" type="text" class="input-text regular-input" value="<?php echo esc_attr( $topic_data['event'] ); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_delivery_url">
|
||||
<?php esc_html_e( 'Delivery URL', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'URL where the webhook payload is delivered.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input name="webhook_delivery_url" id="webhook_delivery_url" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_delivery_url() ); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_secret">
|
||||
<?php esc_html_e( 'Secret', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'The secret key is used to generate a hash of the delivered webhook and provided in the request headers.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<input name="webhook_secret" id="webhook_secret" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_secret() ); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<label for="webhook_api_version">
|
||||
<?php esc_html_e( 'API Version', 'woocommerce' ); ?>
|
||||
<?php echo wc_help_tip( __( 'REST API version used in the webhook deliveries.', 'woocommerce' ) ); ?>
|
||||
</label>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<select name="webhook_api_version" id="webhook_api_version">
|
||||
<?php foreach ( array_reverse( wc_get_webhook_rest_api_versions() ) as $version ) : ?>
|
||||
<option value="<?php echo esc_attr( $version ); ?>" <?php selected( $version, $webhook->get_api_version(), true ); ?>>
|
||||
<?php
|
||||
/* translators: %d: rest api version number */
|
||||
echo esc_html( sprintf( __( 'WP REST API Integration v%d', 'woocommerce' ), str_replace( 'wp_api_v', '', $version ) ) );
|
||||
?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
<option value="legacy_v3" <?php selected( 'legacy_v3', $webhook->get_api_version(), true ); ?>><?php esc_html_e( 'Legacy API v3 (deprecated)', 'woocommerce' ); ?></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php do_action( 'woocommerce_webhook_options' ); ?>
|
||||
</div>
|
||||
|
||||
<div id="webhook-actions" class="settings-panel">
|
||||
<h2><?php esc_html_e( 'Webhook actions', 'woocommerce' ); ?></h2>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<?php if ( $webhook->get_date_created() && '0000-00-00 00:00:00' !== $webhook->get_date_created()->date( 'Y-m-d H:i:s' ) ) : ?>
|
||||
<?php if ( is_null( $webhook->get_date_modified() ) ) : ?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php esc_html_e( 'Created at', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<?php echo esc_html( date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $webhook->get_date_created()->date( 'Y-m-d H:i:s' ) ) ) ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php else : ?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php esc_html_e( 'Created at', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<?php echo esc_html( date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $webhook->get_date_created()->date( 'Y-m-d H:i:s' ) ) ) ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
<?php esc_html_e( 'Updated at', 'woocommerce' ); ?>
|
||||
</th>
|
||||
<td class="forminp">
|
||||
<?php echo esc_html( date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $webhook->get_date_modified()->date( 'Y-m-d H:i:s' ) ) ) ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<tr valign="top">
|
||||
<td colspan="2" scope="row" style="padding-left: 0;">
|
||||
<p class="submit">
|
||||
<button type="submit" class="button button-primary button-large" name="save" id="publish" accesskey="p"><?php esc_html_e( 'Save webhook', 'woocommerce' ); ?></button>
|
||||
<?php
|
||||
if ( $webhook->get_id() ) :
|
||||
$delete_url = wp_nonce_url(
|
||||
add_query_arg(
|
||||
array(
|
||||
'delete' => $webhook->get_id(),
|
||||
),
|
||||
admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks' )
|
||||
),
|
||||
'delete-webhook'
|
||||
);
|
||||
?>
|
||||
<a style="color: #a00; text-decoration: none; margin-left: 10px;" href="<?php echo esc_url( $delete_url ); ?>"><?php esc_html_e( 'Delete permanently', 'woocommerce' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery( function ( $ ) {
|
||||
$( '#webhook-options' ).find( '#webhook_topic' ).on( 'change', function() {
|
||||
var current = $( this ).val(),
|
||||
action_event_field = $( '#webhook-options' ).find( '#webhook-action-event-wrap' );
|
||||
|
||||
action_event_field.hide();
|
||||
|
||||
if ( 'action' === current ) {
|
||||
action_event_field.show();
|
||||
}
|
||||
}).trigger( 'change' );
|
||||
});
|
||||
</script>
|
133
includes/admin/settings/views/settings-tax.php
Normal file
133
includes/admin/settings/views/settings-tax.php
Normal file
@ -0,0 +1,133 @@
|
||||
<?php
|
||||
/**
|
||||
* Tax settings.
|
||||
*
|
||||
* @package WooCommerce\Admin\Settings.
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$settings = array(
|
||||
|
||||
array(
|
||||
'title' => __( 'Tax options', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'desc' => '',
|
||||
'id' => 'tax_options',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Prices entered with tax', 'woocommerce' ),
|
||||
'id' => 'woocommerce_prices_include_tax',
|
||||
'default' => 'no',
|
||||
'type' => 'radio',
|
||||
'desc_tip' => __( 'This option is important as it will affect how you input prices. Changing it will not update existing products.', 'woocommerce' ),
|
||||
'options' => array(
|
||||
'yes' => __( 'Yes, I will enter prices inclusive of tax', 'woocommerce' ),
|
||||
'no' => __( 'No, I will enter prices exclusive of tax', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Calculate tax based on', 'woocommerce' ),
|
||||
'id' => 'woocommerce_tax_based_on',
|
||||
'desc_tip' => __( 'This option determines which address is used to calculate tax.', 'woocommerce' ),
|
||||
'default' => 'shipping',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'options' => array(
|
||||
'shipping' => __( 'Customer shipping address', 'woocommerce' ),
|
||||
'billing' => __( 'Customer billing address', 'woocommerce' ),
|
||||
'base' => __( 'Shop base address', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
|
||||
'shipping-tax-class' => array(
|
||||
'title' => __( 'Shipping tax class', 'woocommerce' ),
|
||||
'desc' => __( 'Optionally control which tax class shipping gets, or leave it so shipping tax is based on the cart items themselves.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_shipping_tax_class',
|
||||
'css' => 'min-width:150px;',
|
||||
'default' => 'inherit',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'options' => array( 'inherit' => __( 'Shipping tax class based on cart items', 'woocommerce' ) ) + wc_get_product_tax_class_options(),
|
||||
'desc_tip' => true,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Rounding', 'woocommerce' ),
|
||||
'desc' => __( 'Round tax at subtotal level, instead of rounding per line', 'woocommerce' ),
|
||||
'id' => 'woocommerce_tax_round_at_subtotal',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Additional tax classes', 'woocommerce' ),
|
||||
'desc_tip' => __( 'List additional tax classes you need below (1 per line, e.g. Reduced Rates). These are in addition to "Standard rate" which exists by default.', 'woocommerce' ),
|
||||
'id' => 'woocommerce_tax_classes',
|
||||
'css' => 'height: 65px;',
|
||||
'type' => 'textarea',
|
||||
'default' => '',
|
||||
'is_option' => false,
|
||||
'value' => implode( "\n", WC_Tax::get_tax_classes() ),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Display prices in the shop', 'woocommerce' ),
|
||||
'id' => 'woocommerce_tax_display_shop',
|
||||
'default' => 'excl',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'options' => array(
|
||||
'incl' => __( 'Including tax', 'woocommerce' ),
|
||||
'excl' => __( 'Excluding tax', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Display prices during cart and checkout', 'woocommerce' ),
|
||||
'id' => 'woocommerce_tax_display_cart',
|
||||
'default' => 'excl',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'options' => array(
|
||||
'incl' => __( 'Including tax', 'woocommerce' ),
|
||||
'excl' => __( 'Excluding tax', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Price display suffix', 'woocommerce' ),
|
||||
'id' => 'woocommerce_price_display_suffix',
|
||||
'default' => '',
|
||||
'placeholder' => __( 'N/A', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'desc_tip' => __( 'Define text to show after your product prices. This could be, for example, "inc. Vat" to explain your pricing. You can also have prices substituted here using one of the following: {price_including_tax}, {price_excluding_tax}.', 'woocommerce' ),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Display tax totals', 'woocommerce' ),
|
||||
'id' => 'woocommerce_tax_total_display',
|
||||
'default' => 'itemized',
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
'options' => array(
|
||||
'single' => __( 'As a single total', 'woocommerce' ),
|
||||
'itemized' => __( 'Itemized', 'woocommerce' ),
|
||||
),
|
||||
'autoload' => false,
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'sectionend',
|
||||
'id' => 'tax_options',
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
if ( ! wc_shipping_enabled() ) {
|
||||
unset( $settings['shipping-tax-class'] );
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_tax_settings', $settings );
|
Reference in New Issue
Block a user