rebase from live enviornment
This commit is contained in:
@@ -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,166 @@
|
||||
<?php
|
||||
/**
|
||||
* Shipping classes admin
|
||||
*
|
||||
* @package WooCommerce\Admin\Shipping
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<h2 class="wc-shipping-zones-heading">
|
||||
<span><?php esc_html_e( 'Shipping classes', 'woocommerce' ); ?></span>
|
||||
<a class="button button-primary wc-shipping-class-add-new" href="#"><?php esc_html_e( 'Add shipping class', 'woocommerce' ); ?></a>
|
||||
</h2>
|
||||
|
||||
<p class="wc-shipping-zone-help-text">
|
||||
<?php esc_html_e( 'Use shipping classes to customize the shipping rates for different groups of products, such as heavy items that require higher postage fees.', 'woocommerce' ); ?> <a target="_blank" href="https://woocommerce.com/document/product-shipping-classes/"><?php esc_html_e( 'Learn more', 'woocommerce' ); ?></a>
|
||||
</p>
|
||||
|
||||
<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; ?>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="wc-shipping-class-rows wc-shipping-tables-tbody"></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 ) + 1 ); ?>"><p><?php esc_html_e( 'No shipping classes have been created.', 'woocommerce' ); ?></p></td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<!-- 1. Placeholder becomes the "label" in view class div -->
|
||||
<!-- 1. Add labelFor or some kind of attribute for semantic HTML-->
|
||||
|
||||
<script type="text/html" id="tmpl-wc-shipping-class-configure">
|
||||
<div class="wc-backbone-modal wc-shipping-class-modal">
|
||||
<div class="wc-backbone-modal-content" data-id="{{ data.term_id }}">
|
||||
<section class="wc-backbone-modal-main" role="main">
|
||||
<header class="wc-backbone-modal-header">
|
||||
<h1><?php esc_html_e( 'Add shipping class', '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">
|
||||
<input type="hidden" name="term_id" value="{{{ data.term_id }}}" />
|
||||
<?php
|
||||
foreach ( $shipping_class_columns as $class => $heading ) {
|
||||
echo '<div class="wc-shipping-class-modal-input ' . esc_attr( $class ) . '">';
|
||||
switch ( $class ) {
|
||||
case 'wc-shipping-class-name':
|
||||
?>
|
||||
<div class="view">
|
||||
<?php echo esc_html( $heading ); ?> *
|
||||
</div>
|
||||
<div class="edit">
|
||||
<input type="text" name="name" data-attribute="name" value="{{ data.name }}" placeholder="<?php esc_attr_e( 'e.g. Heavy', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
<div class="wc-shipping-class-modal-help-text"><?php esc_html_e( 'Give your shipping class a name for easy identification', 'woocommerce' ); ?></div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-slug':
|
||||
?>
|
||||
<div class="view">
|
||||
<?php echo esc_html( $heading ); ?>
|
||||
</div>
|
||||
<div class="edit">
|
||||
<input type="text" name="slug" data-attribute="slug" value="{{ data.slug }}" placeholder="<?php esc_attr_e( 'e.g. heavy-packages', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
<div class="wc-shipping-class-modal-help-text"><?php esc_html_e( 'Slug (unique identifier) can be left blank and auto-generated, or you can enter one', 'woocommerce' ); ?></div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-description':
|
||||
?>
|
||||
<div class="view">
|
||||
<?php echo esc_html( $heading ); ?> *
|
||||
</div>
|
||||
<div class="edit">
|
||||
<input type="text" name="description" data-attribute="description" value="{{ data.description }}" placeholder="<?php esc_attr_e( 'e.g. For heavy items requiring higher postage', 'woocommerce' ); ?>" />
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-count':
|
||||
break;
|
||||
default:
|
||||
?>
|
||||
<div class="view wc-shipping-class-hide-sibling-view">
|
||||
<?php echo esc_html( $heading ); ?>
|
||||
</div>
|
||||
<?php
|
||||
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
|
||||
do_action( 'woocommerce_shipping_classes_column_' . $class );
|
||||
break;
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" disabled class="button button-primary button-large disabled">
|
||||
<div class="wc-backbone-modal-action-{{ data.action === 'create' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Create', 'woocommerce' ); ?></div>
|
||||
<div class="wc-backbone-modal-action-{{ data.action === 'edit' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Save', 'woocommerce' ); ?></div>
|
||||
</button>
|
||||
</div>
|
||||
</footer>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wc-backbone-modal-backdrop modal-close"></div>
|
||||
</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>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-slug':
|
||||
?>
|
||||
<div class="view">{{ data.slug }}</div>
|
||||
<?php
|
||||
break;
|
||||
case 'wc-shipping-class-description':
|
||||
?>
|
||||
<div class="view">{{ data.description }}</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:
|
||||
// phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
|
||||
do_action( 'woocommerce_shipping_classes_column_' . $class );
|
||||
break;
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
?>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<div>
|
||||
<a class="wc-shipping-class-edit wc-shipping-zone-action-edit" href="#"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-class-delete wc-shipping-zone-actions"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
@@ -0,0 +1,218 @@
|
||||
<?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' ); ?>
|
||||
</label>
|
||||
<p class="wc-shipping-zone-help-text">
|
||||
<?php esc_html_e( 'Give your zone a name! E.g. Local, or Worldwide.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
</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' ); ?>
|
||||
</label>
|
||||
<p class="wc-shipping-zone-help-text">
|
||||
<?php esc_html_e( 'List the regions you\'d like to include in your shipping zone. Customers will be matched against these regions.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
</th>
|
||||
<td>
|
||||
<div>
|
||||
<div id="wc-shipping-zone-region-picker-root"/>
|
||||
</div>
|
||||
<?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://woo.com/document/setting-up-shipping-zones/#section-3' ); ?></span><?php // @codingStandardsIgnoreLine. ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr valign="top" class="">
|
||||
<th scope="row" class="titledesc">
|
||||
<label>
|
||||
<?php esc_html_e( 'Shipping methods', 'woocommerce' ); ?>
|
||||
</label>
|
||||
<p class="wc-shipping-zone-help-text">
|
||||
<?php esc_html_e( 'Add the shipping methods you\'d like to make available to customers in this zone.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
</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>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="wc-shipping-zone-method-rows wc-shipping-tables-tbody"></tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"></th>
|
||||
<td>
|
||||
<button type="submit" class="button button-primary 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>
|
||||
</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">
|
||||
{{{ data.title }}}
|
||||
</td>
|
||||
<td width="1%" class="wc-shipping-zone-method-enabled"><a href="#">{{{ data.enabled_icon }}}</a></td>
|
||||
<td class="wc-shipping-zone-method-description">
|
||||
{{{ data.method_description }}}
|
||||
</td>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<div>
|
||||
<a class="wc-shipping-zone-method-settings wc-shipping-zone-action-edit" 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 wc-shipping-zone-actions"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
</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__( 'Set up %s', 'woocommerce' ),
|
||||
'{{{ data.method.method_title.toLowerCase() }}}'
|
||||
);
|
||||
?>
|
||||
</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" data-id="{{{ data.instance_id }}}" data-status="{{{ data.status }}}" data-shipping-classes-count="<?php echo count( WC()->shipping()->get_shipping_classes() ); ?>">
|
||||
<form action="" method="post">
|
||||
{{{ data.method.settings_html }}}
|
||||
<input type="hidden" name="instance_id" value="{{{ data.instance_id }}}" />
|
||||
</form>
|
||||
<a class="wc-shipping-method-add-class-costs" style="display:none;" target="_blank" href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=classes' ) ); ?>"><?php esc_html_e( 'Add shipping class costs', 'woocommerce' ); ?></a>
|
||||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-ok" data-status='{{ data.status }}' class="button button-primary button-large">
|
||||
<div class="wc-backbone-modal-action-{{ data.status === 'new' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Create', 'woocommerce' ); ?></div>
|
||||
<div class="wc-backbone-modal-action-{{ data.status === 'existing' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Save', 'woocommerce' ); ?></div>
|
||||
</button>
|
||||
<div class="wc-shipping-zone-method-modal-info wc-shipping-zone-method-modal-info-{{ data.status === 'existing' ? 'inactive' : 'active' }}"><?php esc_html_e( 'STEP 2 OF 2', 'woocommerce' ); ?></div>
|
||||
</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 wc-backbone-modal-add-shipping-method">
|
||||
<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( 'Create 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">
|
||||
<fieldset class="wc-shipping-zone-method-selector">
|
||||
<legend class="screen-reader-text"><?php esc_html_e( 'Choose the shipping method you wish to add. Only shipping methods which support zones are listed.', 'woocommerce' ); ?></legend>
|
||||
<?php
|
||||
$methods = WC()->shipping()->load_shipping_methods();
|
||||
|
||||
$methods_placed_in_order = array();
|
||||
$first_methods_ids = array( 'free_shipping', 'flat_rate', 'local_pickup' );
|
||||
|
||||
foreach ( $first_methods_ids as $first_method_id ) {
|
||||
foreach ( $methods as $key => $obj ) {
|
||||
if ( $obj->id === $first_method_id ) {
|
||||
$methods_placed_in_order[] = $obj;
|
||||
unset( $methods[ $key ] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$methods_placed_in_order = array_merge( $methods_placed_in_order, array_values( $methods ) );
|
||||
|
||||
foreach ( $methods_placed_in_order as $method ) {
|
||||
if ( ! $method->supports( 'shipping-zones' ) ) {
|
||||
continue;
|
||||
}
|
||||
$description = wp_kses_post( $method->get_method_description() );
|
||||
echo '<div class="wc-shipping-zone-method-input"><input type="radio" value="' . esc_attr( $method->id ) . '" id="' . esc_attr( $method->id ) . '" name="add_method_id"/><label for="' . esc_attr( $method->id ) . '">' . esc_html( $method->get_method_title() ) . '<span class="dashicons dashicons-yes"></span></label><div class="wc-shipping-zone-method-input-help-text"><span>' . esc_html( $description ) . '</span></div></div>';
|
||||
}
|
||||
?>
|
||||
</fieldset>
|
||||
</form>
|
||||
</article>
|
||||
<footer>
|
||||
<div class="inner">
|
||||
<button id="btn-next" disabled class="button button-primary button-large disabled"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
|
||||
<div class="wc-shipping-zone-method-modal-info"><?php esc_html_e( 'STEP 1 OF 2', 'woocommerce' ); ?></div>
|
||||
</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(); ?>
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<h2 class="wc-shipping-zones-heading">
|
||||
<span><?php esc_html_e( 'Shipping zones', 'woocommerce' ); ?></span>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping&zone_id=new' ) ); ?>" class="button-primary"><?php esc_html_e( 'Add zone', 'woocommerce' ); ?></a>
|
||||
</h2>
|
||||
<p class="wc-shipping-zone-heading-help-text"><?php echo esc_html_e( 'A shipping zone consists of the region(s) you\'d like to ship to and the shipping method(s) offered. A shopper can only be matched to one zone, and we\'ll use their shipping address to show them the methods available in their area.', '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>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="wc-shipping-zone-rows wc-shipping-tables-tbody"></tbody>
|
||||
|
||||
<tfoot data-id="0" class="wc-shipping-zone-worldwide">
|
||||
<td width="1%" class="wc-shipping-zone-worldwide"></td>
|
||||
<td class="wc-shipping-zone-name">
|
||||
<?php esc_html_e( 'Rest of the world', 'woocommerce' ); ?>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-region"><?php esc_html_e( 'An optional zone you can use to set the shipping method(s) available to any regions that have not been listed above.', '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>' . esc_html_e( 'No shipping methods offered to this zone.', 'woocommerce' ) . '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<a class="wc-shipping-zone-action-edit" href="admin.php?page=wc-settings&tab=shipping&zone_id=0"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a>
|
||||
</td>
|
||||
</tfoot>
|
||||
|
||||
</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">
|
||||
{{ data.zone_name }}
|
||||
</td>
|
||||
<td class="wc-shipping-zone-region">
|
||||
{{ data.formatted_zone_location }}
|
||||
</td>
|
||||
<td class="wc-shipping-zone-methods">
|
||||
<div><ul></ul></div>
|
||||
</td>
|
||||
<td class="wc-shipping-zone-actions">
|
||||
<div>
|
||||
<a class="wc-shipping-zone-action-edit" href="admin.php?page=wc-settings&tab=shipping&zone_id={{ data.zone_id }}"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-zone-delete wc-shipping-zone-actions"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
|
||||
</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>
|
||||
@@ -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 maxlength="200" 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>
|
||||
@@ -0,0 +1,155 @@
|
||||
<?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>
|
||||
|
||||
<div id="rates-bottom-pagination"></div>
|
||||
|
||||
<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>
|
||||
@@ -0,0 +1,236 @@
|
||||
<?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' ), (new DateTime('now'))->format( _x( 'M d, Y @ h:i A', 'Webhook created on date parsed by DateTime::format', '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
|
||||
/**
|
||||
* Fires within the webhook editor, after the Webhook Data fields have rendered.
|
||||
*
|
||||
* @param WC_Webhook $webhook
|
||||
*/
|
||||
do_action( 'woocommerce_webhook_options', $webhook );
|
||||
?>
|
||||
</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>
|
||||
@@ -0,0 +1,135 @@
|
||||
<?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( 'type' => 'conflict_error' ), // React mount point for embedded banner slotfill.
|
||||
|
||||
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