Esempio n. 1
0
function dd_select_colvariants_products()
{
    global $post, $woocommerce;
    $product_ids = array_filter(array_map('absint', (array) get_post_meta($post->ID, '_colvariants_ids', true)));
    ?>
  <div class="options_group">
    <p class="form-field">
      <label for="colvariants_ids"><?php 
    _e('Color Variants', 'woocommerce');
    ?>
</label>
      <input type="hidden" class="wc-product-search" style="width: 50%;" id="colvariants_ids" name="colvariants_ids" data-placeholder="<?php 
    _e('Search for a product&hellip;', 'woocommerce');
    ?>
" data-action="woocommerce_json_search_products" data-multiple="true" data-selected="<?php 
    $json_ids = array();
    foreach ($product_ids as $product_id) {
        $product = wc_get_product($product_id);
        if (is_object($product)) {
            $json_ids[$product_id] = wp_kses_post(html_entity_decode($product->get_formatted_name(), ENT_QUOTES, get_bloginfo('charset')));
        }
    }
    echo esc_attr(json_encode($json_ids));
    ?>
" value="<?php 
    echo implode(',', array_keys($json_ids));
    ?>
" /> <?php 
    echo wc_help_tip(__('Color variants are products which are diplayed and linked on product page as a color selector field. Please included current color variant also.', 'dd'));
    ?>
    </p>
  </div>
  <?php 
}
 /**
  * Display a WooCommerce help tip.
  *
  * @since  1.0.4
  *
  * @param  string $tip
  * @return string
  */
 public static function wc_help_tip($tip)
 {
     if (self::is_wc_version_gte_2_5()) {
         return wc_help_tip($tip);
     } else {
         return '<img class="help_tip woocommerce-help-tip" data-tip="' . $tip . '" src="' . WC()->plugin_url() . '/assets/images/help.png" />';
     }
 }
 /**
  * Backports wc_help_tip() to WC 2.4/2.3
  *
  * @link https://github.com/woothemes/woocommerce/pull/9417
  *
  * @since 4.2.0
  * @param string $tip help tip content, HTML allowed if $has_html is true
  * @param bool $has_html false by default, true to indicate tip content has HTML
  * @return string help tip HTML, a <span> in WC 2.5, <img> in WC 2.4/2.3
  */
 public static function wc_help_tip($tip, $has_html = false)
 {
     if (self::is_wc_version_gte_2_5()) {
         return wc_help_tip($tip, $has_html);
     } else {
         $tip = $has_html ? wc_sanitize_tooltip($tip) : esc_attr($tip);
         return sprintf('<img class="help_tip" data-tip="%1$s" src="%2$s" height="16" width="16" />', $tip, esc_url(WC()->plugin_url()) . '/assets/images/help.png');
     }
 }
Esempio n. 4
0
:</td>
			<td class="total">
				<?php 
echo wc_price($order->get_total_discount(), array('currency' => $order->get_order_currency()));
?>
			</td>
			<td width="1%"></td>
		</tr>

		<?php 
do_action('woocommerce_admin_order_totals_after_discount', $order->id);
?>

		<tr>
			<td class="label"><?php 
echo wc_help_tip(__('This is the shipping and handling total costs for the order.', 'woocommerce'));
?>
 <?php 
_e('Shipping', 'woocommerce');
?>
:</td>
			<td class="total"><?php 
if (($refunded = $order->get_total_shipping_refunded()) > 0) {
    echo '<del>' . strip_tags(wc_price($order->get_total_shipping(), array('currency' => $order->get_order_currency()))) . '</del> <ins>' . wc_price($order->get_total_shipping() - $refunded, array('currency' => $order->get_order_currency())) . '</ins>';
} else {
    echo wc_price($order->get_total_shipping(), array('currency' => $order->get_order_currency()));
}
?>
</td>
			<td width="1%"></td>
		</tr>
if (!current_theme_supports('woocommerce') && !in_array($active_theme->template, wc_get_core_supported_themes())) {
    echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __('Not Declared', 'woocommerce') . '</mark>';
} else {
    echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
}
?>
</td>
		</tr>
	</tbody>
</table>
<table class="wc_status_table widefat" cellspacing="0">
	<thead>
		<tr>
			<th colspan="3" data-export-label="Templates"><h2><?php 
_e('Templates', 'woocommerce');
echo wc_help_tip(__('This section shows any files that are overriding the default WooCommerce template pages.', 'woocommerce'));
?>
</h2></th>
		</tr>
	</thead>
	<tbody>
		<?php 
if (file_exists(get_stylesheet_directory() . '/woocommerce.php') || file_exists(get_template_directory() . '/woocommerce.php')) {
    ?>
		<tr>
			<td data-export-label="Overrides"><?php 
    _e('Archive Template', 'woocommerce');
    ?>
:</td>
			<td class="help">&nbsp;</td>
			<td><?php 
]" value="<?php 
if (isset($_download_limit)) {
    echo esc_attr($_download_limit);
}
?>
" placeholder="<?php 
esc_attr_e('Unlimited', 'woocommerce');
?>
" step="1" min="0" />
				</p>
				<p class="form-row form-row-last">
					<label><?php 
_e('Download expiry', 'woocommerce');
?>
 <?php 
echo wc_help_tip(__('Enter the number of days before a download link expires, or leave blank.', 'woocommerce'));
?>
</a></label>
					<input type="number" size="5" name="variable_download_expiry[<?php 
echo $loop;
?>
]" value="<?php 
if (isset($_download_expiry)) {
    echo esc_attr($_download_expiry);
}
?>
" placeholder="<?php 
esc_attr_e('Unlimited', 'woocommerce');
?>
" step="1" min="0" />
				</p>
    /**
     * Output the metabox.
     */
    public static function output($post)
    {
        global $post;
        $args = array('post_id' => $post->ID, 'orderby' => 'comment_ID', 'order' => 'DESC', 'approve' => 'approve', 'type' => 'order_note');
        remove_filter('comments_clauses', array('WC_Comments', 'exclude_order_comments'), 10, 1);
        $notes = get_comments($args);
        add_filter('comments_clauses', array('WC_Comments', 'exclude_order_comments'), 10, 1);
        echo '<ul class="order_notes">';
        if ($notes) {
            foreach ($notes as $note) {
                $note_classes = get_comment_meta($note->comment_ID, 'is_customer_note', true) ? array('customer-note', 'note') : array('note');
                $note_classes = apply_filters('woocommerce_order_note_class', $note_classes, $note);
                ?>
				<li rel="<?php 
                echo absint($note->comment_ID);
                ?>
" class="<?php 
                echo esc_attr(implode(' ', $note_classes));
                ?>
">
					<div class="note_content">
						<?php 
                echo wpautop(wptexturize(wp_kses_post($note->comment_content)));
                ?>
					</div>
					<p class="meta">
						<abbr class="exact-date" title="<?php 
                echo $note->comment_date;
                ?>
"><?php 
                printf(__('added on %1$s at %2$s', 'woocommerce'), date_i18n(wc_date_format(), strtotime($note->comment_date)), date_i18n(wc_time_format(), strtotime($note->comment_date)));
                ?>
</abbr>
						<?php 
                if ($note->comment_author !== __('WooCommerce', 'woocommerce')) {
                    printf(' ' . __('by %s', 'woocommerce'), $note->comment_author);
                }
                ?>
						<a href="#" class="delete_note"><?php 
                _e('Delete note', 'woocommerce');
                ?>
</a>
					</p>
				</li>
				<?php 
            }
        } else {
            echo '<li>' . __('There are no notes yet.', 'woocommerce') . '</li>';
        }
        echo '</ul>';
        ?>
		<div class="add_note">
			<h4><?php 
        _e('Add note', 'woocommerce');
        ?>
 <?php 
        echo wc_help_tip(__('Add a note for your reference, or add a customer note (the user will be notified).', 'woocommerce'));
        ?>
</h4>
			<p>
				<textarea type="text" name="order_note" id="add_order_note" class="input-text" cols="20" rows="5"></textarea>
			</p>
			<p>
				<select name="order_note_type" id="order_note_type">
					<option value=""><?php 
        _e('Private note', 'woocommerce');
        ?>
</option>
					<option value="customer"><?php 
        _e('Note to customer', 'woocommerce');
        ?>
</option>
				</select>
				<a href="#" class="add_note button"><?php 
        _e('Add', 'woocommerce');
        ?>
</a>
			</p>
		</div>
		<?php 
    }
        /**
         * Output a colour picker input box.
         *
         * @param mixed $name
         * @param string $id
         * @param mixed $value
         * @param string $desc (default: '')
         */
        public function color_picker($name, $id, $value, $desc = '')
        {
            echo '<div class="color_box">' . wc_help_tip($desc) . '
			<input name="' . esc_attr($id) . '" id="' . esc_attr($id) . '" type="text" value="' . esc_attr($value) . '" class="colorpick" /> <div id="colorPickerDiv_' . esc_attr($id) . '" class="colorpickdiv"></div>
		</div>';
        }
Esempio n. 9
0
echo esc_attr($user_string);
?>
" value="<?php 
echo esc_attr($user_id);
?>
" data-allow_clear="true" />
				</td>
			</tr>
			<tr valign="top">
				<th scope="row" class="titledesc">
					<label for="key_permissions"><?php 
_e('Permissions', 'woocommerce');
?>
</label>
					<?php 
echo wc_help_tip(__('Select the access type of these keys.', 'woocommerce'));
?>
				</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 
Esempio n. 10
0
				</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 
_e('Secret', 'woocommerce');
?>
</label>
					<?php 
echo wc_help_tip(__('The Secret Key is used to generate a hash of the delivered webhook and provided in the request headers. This will default to the current API user\'s consumer secret if not provided.', 'woocommerce'));
?>
				</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>
		</tbody>
	</table>

	<?php 
do_action('woocommerce_webhook_options');
?>
				</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 
_e('Secret', 'woocommerce');
?>
</label>
					<?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'));
?>
				</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>
		</tbody>
	</table>

	<?php 
do_action('woocommerce_webhook_options');
?>
    /**
     * Get the main chart.
     *
     * @return string
     */
    public function get_main_chart()
    {
        $query_data = array('_order_tax' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'tax_amount'), '_order_shipping_tax' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'shipping_tax_amount'), '_order_total' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_sales'), '_order_shipping' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_shipping'), 'ID' => array('type' => 'post_data', 'function' => 'COUNT', 'name' => 'total_orders', 'distinct' => true), 'post_date' => array('type' => 'post_data', 'function' => '', 'name' => 'post_date'));
        $tax_rows_orders = $this->get_order_report_data(array('data' => $query_data, 'group_by' => $this->group_by_query, 'order_by' => 'post_date ASC', 'query_type' => 'get_results', 'filter_range' => true, 'order_types' => wc_get_order_types('sales-reports'), 'order_status' => array('completed', 'processing', 'on-hold')));
        $tax_rows_partial_refunds = $this->get_order_report_data(array('data' => $query_data, 'group_by' => $this->group_by_query, 'order_by' => 'post_date ASC', 'query_type' => 'get_results', 'filter_range' => true, 'order_types' => array('shop_order_refund'), 'parent_order_status' => array('completed', 'processing', 'on-hold')));
        // Merge
        $tax_rows = array();
        foreach ($tax_rows_orders as $tax_row) {
            $key = date($this->chart_groupby == 'month' ? 'Ym' : 'Ymd', strtotime($tax_row->post_date));
            $tax_rows[$key] = isset($tax_rows[$key]) ? $tax_rows[$key] : (object) array('tax_amount' => 0, 'shipping_tax_amount' => 0, 'total_sales' => 0, 'total_shipping' => 0, 'total_orders' => 0);
            $tax_rows[$key]->tax_amount += $tax_row->tax_amount;
            $tax_rows[$key]->shipping_tax_amount += $tax_row->shipping_tax_amount;
            $tax_rows[$key]->total_sales += $tax_row->total_sales;
            $tax_rows[$key]->total_shipping += $tax_row->total_shipping;
            $tax_rows[$key]->total_orders += $tax_row->total_orders;
        }
        foreach ($tax_rows_partial_refunds as $tax_row) {
            $key = date($this->chart_groupby == 'month' ? 'Ym' : 'Ymd', strtotime($tax_row->post_date));
            $tax_rows[$key] = isset($tax_rows[$key]) ? $tax_rows[$key] : (object) array('tax_amount' => 0, 'shipping_tax_amount' => 0, 'total_sales' => 0, 'total_shipping' => 0, 'total_orders' => 0);
            $tax_rows[$key]->tax_amount += $tax_row->tax_amount;
            $tax_rows[$key]->shipping_tax_amount += $tax_row->shipping_tax_amount;
            $tax_rows[$key]->total_sales += $tax_row->total_sales;
            $tax_rows[$key]->total_shipping += $tax_row->total_shipping;
        }
        ?>
		<table class="widefat">
			<thead>
				<tr>
					<th><?php 
        _e('Period', 'woocommerce');
        ?>
</th>
					<th class="total_row"><?php 
        _e('Number of Orders', 'woocommerce');
        ?>
</th>
					<th class="total_row"><?php 
        _e('Total Sales', 'woocommerce');
        ?>
 <?php 
        echo wc_help_tip(__("This is the sum of the 'Order Total' field within your orders.", 'woocommerce'));
        ?>
</th>
					<th class="total_row"><?php 
        _e('Total Shipping', 'woocommerce');
        ?>
 <?php 
        echo wc_help_tip(__("This is the sum of the 'Shipping Total' field within your orders.", 'woocommerce'));
        ?>
</th>
					<th class="total_row"><?php 
        _e('Total Tax', 'woocommerce');
        ?>
 <?php 
        echo wc_help_tip(__('This is the total tax for the rate (shipping tax + product tax).', 'woocommerce'));
        ?>
</th>
					<th class="total_row"><?php 
        _e('Net profit', 'woocommerce');
        ?>
 <?php 
        echo wc_help_tip(__("Total sales minus shipping and tax.", 'woocommerce'));
        ?>
</th>
				</tr>
			</thead>
			<?php 
        if (!empty($tax_rows)) {
            ?>
				<tbody>
					<?php 
            foreach ($tax_rows as $date => $tax_row) {
                $gross = $tax_row->total_sales - $tax_row->total_shipping;
                $total_tax = $tax_row->tax_amount + $tax_row->shipping_tax_amount;
                ?>
						<tr>
							<th scope="row"><?php 
                if ($this->chart_groupby == 'month') {
                    echo date_i18n('F', strtotime($date . '01'));
                } else {
                    echo date_i18n(get_option('date_format'), strtotime($date));
                }
                ?>
</th>
							<td class="total_row"><?php 
                echo $tax_row->total_orders;
                ?>
</td>
							<td class="total_row"><?php 
                echo wc_price($gross);
                ?>
</td>
							<td class="total_row"><?php 
                echo wc_price($tax_row->total_shipping);
                ?>
</td>
							<td class="total_row"><?php 
                echo wc_price($total_tax);
                ?>
</td>
							<td class="total_row"><?php 
                echo wc_price($gross - $total_tax);
                ?>
</td>
						</tr>
						<?php 
            }
            ?>
				</tbody>
				<tfoot>
					<?php 
            $gross = array_sum(wp_list_pluck((array) $tax_rows, 'total_sales')) - array_sum(wp_list_pluck((array) $tax_rows, 'total_shipping'));
            $total_tax = array_sum(wp_list_pluck((array) $tax_rows, 'tax_amount')) + array_sum(wp_list_pluck((array) $tax_rows, 'shipping_tax_amount'));
            ?>
					<tr>
						<th scope="row"><?php 
            _e('Totals', 'woocommerce');
            ?>
</th>
						<th class="total_row"><?php 
            echo array_sum(wp_list_pluck((array) $tax_rows, 'total_orders'));
            ?>
</th>
						<th class="total_row"><?php 
            echo wc_price($gross);
            ?>
</th>
						<th class="total_row"><?php 
            echo wc_price(array_sum(wp_list_pluck((array) $tax_rows, 'total_shipping')));
            ?>
</th>
						<th class="total_row"><?php 
            echo wc_price($total_tax);
            ?>
</th>
						<th class="total_row"><?php 
            echo wc_price($gross - $total_tax);
            ?>
</th>
					</tr>
				</tfoot>
			<?php 
        } else {
            ?>
				<tbody>
					<tr>
						<td><?php 
            _e('No taxes found in this period', 'woocommerce');
            ?>
</td>
					</tr>
				</tbody>
			<?php 
        }
        ?>
		</table>
		<?php 
    }
</label>
					<table class="widefat">
						<thead>
							<div>
								<th><?php 
_e('Name', 'woocommerce');
?>
 <?php 
echo wc_help_tip(__('This is the name of the download shown to the customer.', 'woocommerce'));
?>
</th>
								<th colspan="2"><?php 
_e('File URL', 'woocommerce');
?>
 <?php 
echo wc_help_tip(__('This is the URL or absolute path to the file which customers will get access to. URLs entered here should already be encoded.', 'woocommerce'));
?>
</th>
								<th>&nbsp;</th>
							</div>
						</thead>
						<tbody>
							<?php 
if ($downloads = $variation_object->get_downloads('edit')) {
    foreach ($downloads as $key => $file) {
        include 'html-product-variation-download.php';
    }
}
?>
						</tbody>
						<tfoot>
					</span>
					<?php 
    echo wc_help_tip(__('LxWxH in decimal form', 'woocommerce'));
    ?>
				</p><?php 
}
do_action('woocommerce_product_options_dimensions');
?>
	</div>

	<div class="options_group">
		<?php 
$args = array('taxonomy' => 'product_shipping_class', 'hide_empty' => 0, 'show_option_none' => __('No shipping class', 'woocommerce'), 'name' => 'product_shipping_class', 'id' => 'product_shipping_class', 'selected' => $product_object->get_shipping_class_id('edit'), 'class' => 'select short');
?>
<p class="form-field dimensions_field">
				<label for="product_shipping_class"><?php 
_e('Shipping class', 'woocommerce');
?>
</label>
				<?php 
wp_dropdown_categories($args);
?>
				<?php 
echo wc_help_tip(__('Shipping classes are used by certain shipping methods to group similar products.', 'woocommerce'));
?>
			</p><?php 
do_action('woocommerce_product_options_shipping');
?>
	</div>
</div>
    public function admin_options()
    {
        $current_user = wp_get_current_user();
        $section_slug = strtolower(get_class($this));
        $production_connect_url = 'https://connect.woocommerce.com/login/braintree';
        $sandbox_connect_url = 'https://connect.woocommerce.com/login/braintreesandbox';
        $redirect_url = add_query_arg(array('page' => 'wc-settings', 'tab' => 'checkout', 'section' => $section_slug), admin_url('admin.php'));
        $redirect_url = wp_nonce_url($redirect_url, 'connect_paypal_braintree', 'wc_paypal_braintree_admin_nonce');
        // Note:  We doubly urlencode the redirect url to avoid Braintree's server
        // decoding it which would cause loss of query params on the final redirect
        // Note: Although the Partner API expects an array
        // ( per https://developers.braintreepayments.com/guides/partner-api/sign-up/php )
        // our middleware presently wants things flattened, so instead of passing a user
        // array and a business array, we pass selected fields with user_ and business_
        // prepended
        $query_args = array('redirect' => urlencode(urlencode($redirect_url)), 'scopes' => 'read_write');
        $current_user = wp_get_current_user();
        $query_args['user_email'] = $current_user->user_email;
        if (!empty($current_user->user_firstname)) {
            $query_args['user_firstName'] = $current_user->user_firstname;
        }
        if (!empty($current_user->user_lastname)) {
            $query_args['user_lastName'] = $current_user->user_lastname;
        }
        $query_args['business_currency'] = get_woocommerce_currency();
        // Let's go ahead and assume the user and business are in the same region and country,
        // because they probably are.  If not, they can edit these anyways
        $base_location = wc_get_base_location();
        if (array_key_exists('country', $base_location)) {
            $country = $base_location['country'];
            if (!empty($country)) {
                $query_args['business_country'] = $country;
                $query_args['user_country'] = $country;
            }
        }
        if (array_key_exists('state', $base_location)) {
            $state = $base_location['state'];
            if (!empty($state)) {
                $query_args['business_region'] = $state;
                $query_args['user_region'] = $state;
            }
        }
        $site_name = get_bloginfo('name');
        if (!empty($site_name)) {
            $query_args['business_name'] = $site_name;
        }
        $site_description = get_bloginfo('description');
        if (!empty($site_description)) {
            $query_args['business_description'] = $site_description;
        }
        $query_args['business_website'] = get_bloginfo('url');
        $production_connect_url = add_query_arg($query_args, $production_connect_url);
        $sandbox_connect_url = add_query_arg($query_args, $sandbox_connect_url);
        $disconnect_url = add_query_arg(array('page' => 'wc-settings', 'tab' => 'checkout', 'section' => $section_slug, 'disconnect_paypal_braintree' => 1), admin_url('admin.php'));
        $disconnect_url = wp_nonce_url($disconnect_url, 'disconnect_paypal_braintree', 'wc_paypal_braintree_admin_nonce');
        ?>
			<div class='paypal-braintree-admin-header'>
				<div class='paypal-braintree-admin-brand'>
					<img src="<?php 
        echo plugins_url('../assets/images/branding/paypal-braintree-horizontal.png', __FILE__);
        ?>
" />
				</div>
				<div class='paypal-braintree-admin-payment-methods'>
					<img src="<?php 
        echo plugins_url('../assets/images/payments/visa.png', __FILE__);
        ?>
" />
					<img src="<?php 
        echo plugins_url('../assets/images/payments/master-card.png', __FILE__);
        ?>
" />
					<img src="<?php 
        echo plugins_url('../assets/images/payments/discover.png', __FILE__);
        ?>
" />
					<img src="<?php 
        echo plugins_url('../assets/images/payments/american-express.png', __FILE__);
        ?>
" />
					<img src="<?php 
        echo plugins_url('../assets/images/payments/paypal.png', __FILE__);
        ?>
" />
				</div>
			</div>
			<?php 
        if (empty($this->merchant_access_token)) {
            ?>
				<p class='paypal-braintree-admin-connect-prompt'>
					<?php 
            echo esc_html('Connect with Braintree to start accepting credit and debit card payments in your checkout.', 'woocommerce-gateway-paypal-braintree');
            ?>
					<br/>
					<a href="https://www.braintreepayments.com/partners/learn-more" target="_blank">
						<?php 
            echo esc_html('Learn more', 'woocommerce-gateway-paypal-braintree');
            ?>
					</a>
				</p>
			<?php 
        }
        ?>

			<table class="form-table">
				<tbody>
					<tr>
						<th>
							<?php 
        _e('Connect/Disconnect', 'woocommerce-gateway-paypal-braintree');
        ?>
							<?php 
        $connect_help_tip = __('Click button to create an account with Braintree and start transacting.', 'woocommerce-gateway-paypal-braintree');
        if (!empty($this->merchant_access_token)) {
            $connect_help_tip = sprintf('%s<br><br>%s<br><br>%s', __('You just connected your Braintree account to WooCommerce. You can start taking payments now.', 'woocommerce-gateway-paypal-braintree'), __('Once you have processed a payment, PayPal will review your application for final approval. Before you ship any goods make sure you have received a final approval for your Braintree account.', 'woocommerce-gateway-paypal-braintree'), __('Questions? We are a phone call away: 1-855-489-0345.', 'woocommerce-gateway-paypal-braintree'));
        }
        echo wc_help_tip($connect_help_tip);
        ?>
						</th>
						<td>
							<?php 
        if (!empty($this->merchant_access_token)) {
            ?>
								<a href="<?php 
            echo esc_attr($disconnect_url);
            ?>
" class='button-primary'>
									<?php 
            echo esc_html__('Disconnect from PayPal Powered by Braintree', 'woocommerce-gateway-paypal-braintree');
            ?>
								</a>
							<?php 
        } else {
            ?>
								<a href="<?php 
            echo esc_attr($production_connect_url);
            ?>
">
									<img src="<?php 
            echo plugins_url('../assets/images/button/connect-braintree.png', __FILE__);
            ?>
"/>
								</a>
								<br/>
								<br/>
								<a href="<?php 
            echo esc_attr($sandbox_connect_url);
            ?>
">
									<?php 
            echo esc_html__('Not ready to accept live payments? Click here to connect using sandbox mode.', 'woocommerce-gateway-paypal-braintree');
            ?>
								</a>
							<?php 
        }
        ?>
						</td>
					</tr>
				</tbody>
			</table>

			<table class="form-table">
				<?php 
        $this->generate_settings_html();
        ?>
			</table>
		<?php 
    }
		<tr valign="top" class="">
			<th scope="row" class="titledesc">
				<label><?php 
esc_html_e('Shipping method(s)', 'woocommerce');
?>
</label>
				<?php 
echo wc_help_tip(__('The following shipping methods apply to customers with shipping addresses within this zone.', 'woocommerce'));
?>
			</th>
			<td class="">
				<table class="wc-shipping-zone-methods widefat">
					<thead>
						<tr>
							<th class="wc-shipping-zone-method-sort"><?php 
echo wc_help_tip(__('Drag and drop to re-order your shipping methods. This is the order in which they will display during checkout.', 'woocommerce'));
?>
</th>
							<th class="wc-shipping-zone-method-title"><?php 
esc_html_e('Title', 'woocommerce');
?>
</th>
							<th class="wc-shipping-zone-method-type"><?php 
esc_html_e('Type', 'woocommerce');
?>
</th>
							<th class="wc-shipping-zone-method-enabled"><?php 
esc_html_e('Enabled', 'woocommerce');
?>
</th>
							<th class="wc-shipping-zone-method-description"><?php 
 /**
  * Get HTML for tooltips.
  *
  * @param  array $data
  * @return string
  */
 public function get_tooltip_html($data)
 {
     if ($data['desc_tip'] === true) {
         $tip = $data['description'];
     } elseif (!empty($data['desc_tip'])) {
         $tip = $data['desc_tip'];
     } else {
         $tip = '';
     }
     return $tip ? wc_help_tip($tip, true) : '';
 }
Esempio n. 18
0
    ?>
</td>
		</tr>
		<tr>
			<td class="label"><label for="refund_amount"><?php 
    _e('Refund amount', 'woocommerce');
    ?>
:</label></td>
			<td class="total">
				<input type="text" class="text" id="refund_amount" name="refund_amount" class="wc_input_price" />
				<div class="clear"></div>
			</td>
		</tr>
		<tr>
			<td class="label"><label for="refund_reason"><?php 
    echo wc_help_tip(__('Note: the refund reason will be visible by the customer.', 'woocommerce'));
    ?>
 <?php 
    _e('Reason for refund (optional)', 'woocommerce');
    ?>
:</label></td>
			<td class="total">
				<input type="text" class="text" id="refund_reason" name="refund_reason" />
				<div class="clear"></div>
			</td>
		</tr>
	</table>
	<div class="clear"></div>
	<div class="refund-actions">
		<?php 
    $refund_amount = '<span class="wc-order-refund-amount">' . wc_price(0, array('currency' => $order->get_currency())) . '</span>';
    /**
     * Output the metabox.
     *
     * @param WP_Post $post
     */
    public static function output($post)
    {
        wp_nonce_field('woocommerce_save_data', 'woocommerce_meta_nonce');
        $coupon = new WC_Coupon($post->ID);
        ?>
		<style type="text/css">
			#edit-slug-box, #minor-publishing-actions { display:none }
		</style>
		<div id="coupon_options" class="panel-wrap coupon_data">

			<div class="wc-tabs-back"></div>

			<ul class="coupon_data_tabs wc-tabs" style="display:none;">
				<?php 
        $coupon_data_tabs = apply_filters('woocommerce_coupon_data_tabs', array('general' => array('label' => __('General', 'woocommerce'), 'target' => 'general_coupon_data', 'class' => 'general_coupon_data'), 'usage_restriction' => array('label' => __('Usage restriction', 'woocommerce'), 'target' => 'usage_restriction_coupon_data', 'class' => ''), 'usage_limit' => array('label' => __('Usage limits', 'woocommerce'), 'target' => 'usage_limit_coupon_data', 'class' => '')));
        foreach ($coupon_data_tabs as $key => $tab) {
            ?>
<li class="<?php 
            echo $key;
            ?>
_options <?php 
            echo $key;
            ?>
_tab <?php 
            echo implode(' ', (array) $tab['class']);
            ?>
">
							<a href="#<?php 
            echo $tab['target'];
            ?>
"><?php 
            echo esc_html($tab['label']);
            ?>
</a>
						</li><?php 
        }
        ?>
			</ul>
			<div id="general_coupon_data" class="panel woocommerce_options_panel"><?php 
        // Type
        woocommerce_wp_select(array('id' => 'discount_type', 'label' => __('Discount type', 'woocommerce'), 'options' => wc_get_coupon_types()));
        // Amount
        woocommerce_wp_text_input(array('id' => 'coupon_amount', 'label' => __('Coupon amount', 'woocommerce'), 'placeholder' => wc_format_localized_price(0), 'description' => __('Value of the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // Free Shipping
        woocommerce_wp_checkbox(array('id' => 'free_shipping', 'label' => __('Allow free shipping', 'woocommerce'), 'description' => sprintf(__('Check this box if the coupon grants free shipping. A <a href="%s" target="_blank">free shipping method</a> must be enabled in your shipping zone and be set to require "a valid free shipping coupon" (see the "Free Shipping Requires" setting).', 'woocommerce'), 'https://docs.woocommerce.com/document/free-shipping/')));
        // Expiry date
        $expiry_date = $coupon->get_date_expires() ? date('Y-m-d', $coupon->get_date_expires()) : '';
        woocommerce_wp_text_input(array('id' => 'expiry_date', 'value' => esc_attr($expiry_date), 'label' => __('Coupon expiry date', 'woocommerce'), 'placeholder' => esc_attr__('YYYY-MM-DD', 'woocommerce'), 'description' => '', 'class' => 'date-picker', 'custom_attributes' => array('pattern' => "[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])")));
        do_action('woocommerce_coupon_options');
        ?>
</div>
			<div id="usage_restriction_coupon_data" class="panel woocommerce_options_panel"><?php 
        echo '<div class="options_group">';
        // minimum spend
        woocommerce_wp_text_input(array('id' => 'minimum_amount', 'label' => __('Minimum spend', 'woocommerce'), 'placeholder' => __('No minimum', 'woocommerce'), 'description' => __('This field allows you to set the minimum spend (subtotal, including taxes) allowed to use the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // maximum spend
        woocommerce_wp_text_input(array('id' => 'maximum_amount', 'label' => __('Maximum spend', 'woocommerce'), 'placeholder' => __('No maximum', 'woocommerce'), 'description' => __('This field allows you to set the maximum spend (subtotal, including taxes) allowed when using the coupon.', 'woocommerce'), 'data_type' => 'price', 'desc_tip' => true));
        // Individual use
        woocommerce_wp_checkbox(array('id' => 'individual_use', 'label' => __('Individual use only', 'woocommerce'), 'description' => __('Check this box if the coupon cannot be used in conjunction with other coupons.', 'woocommerce')));
        // Exclude Sale Products
        woocommerce_wp_checkbox(array('id' => 'exclude_sale_items', 'label' => __('Exclude sale items', 'woocommerce'), 'description' => __('Check this box if the coupon should not apply to items on sale. Per-item coupons will only work if the item is not on sale. Per-cart coupons will only work if there are no sale items in the cart.', 'woocommerce')));
        echo '</div><div class="options_group">';
        // Product ids
        ?>
				<p class="form-field"><label><?php 
        _e('Products', 'woocommerce');
        ?>
</label>
				<input type="hidden" class="wc-product-search" data-multiple="true" style="width: 50%;" name="product_ids" data-placeholder="<?php 
        esc_attr_e('Search for a product&hellip;', 'woocommerce');
        ?>
" data-action="woocommerce_json_search_products_and_variations" data-selected="<?php 
        $product_ids = $coupon->get_product_ids();
        $json_ids = array();
        foreach ($product_ids as $product_id) {
            $product = wc_get_product($product_id);
            if (is_object($product)) {
                $json_ids[$product_id] = wp_kses_post($product->get_formatted_name());
            }
        }
        echo esc_attr(json_encode($json_ids));
        ?>
" value="<?php 
        echo implode(',', array_keys($json_ids));
        ?>
" /> <?php 
        echo wc_help_tip(__('Products which need to be in the cart to use this coupon or, for "Product Discounts", which products are discounted.', 'woocommerce'));
        ?>
</p>
				<?php 
        // Exclude Product ids
        ?>
				<p class="form-field"><label><?php 
        _e('Exclude products', 'woocommerce');
        ?>
</label>
				<input type="hidden" class="wc-product-search" data-multiple="true" style="width: 50%;" name="exclude_product_ids" data-placeholder="<?php 
        esc_attr_e('Search for a product&hellip;', 'woocommerce');
        ?>
" data-action="woocommerce_json_search_products_and_variations" data-selected="<?php 
        $product_ids = $coupon->get_excluded_product_ids();
        $json_ids = array();
        foreach ($product_ids as $product_id) {
            $product = wc_get_product($product_id);
            if (is_object($product)) {
                $json_ids[$product_id] = wp_kses_post($product->get_formatted_name());
            }
        }
        echo esc_attr(json_encode($json_ids));
        ?>
" value="<?php 
        echo implode(',', array_keys($json_ids));
        ?>
" /> <?php 
        echo wc_help_tip(__('Products which must not be in the cart to use this coupon or, for "Product Discounts", which products are not discounted.', 'woocommerce'));
        ?>
</p>
				<?php 
        echo '</div><div class="options_group">';
        // Categories
        ?>
				<p class="form-field"><label for="product_categories"><?php 
        _e('Product categories', 'woocommerce');
        ?>
</label>
				<select id="product_categories" name="product_categories[]" style="width: 50%;"  class="wc-enhanced-select" multiple="multiple" data-placeholder="<?php 
        esc_attr_e('Any category', 'woocommerce');
        ?>
">
					<?php 
        $category_ids = $coupon->get_product_categories();
        $categories = get_terms('product_cat', 'orderby=name&hide_empty=0');
        if ($categories) {
            foreach ($categories as $cat) {
                echo '<option value="' . esc_attr($cat->term_id) . '"' . selected(in_array($cat->term_id, $category_ids), true, false) . '>' . esc_html($cat->name) . '</option>';
            }
        }
        ?>
				</select> <?php 
        echo wc_help_tip(__('A product must be in this category for the coupon to remain valid or, for "Product Discounts", products in these categories will be discounted.', 'woocommerce'));
        ?>
</p>
				<?php 
        // Exclude Categories
        ?>
				<p class="form-field"><label for="exclude_product_categories"><?php 
        _e('Exclude categories', 'woocommerce');
        ?>
</label>
				<select id="exclude_product_categories" name="exclude_product_categories[]" style="width: 50%;"  class="wc-enhanced-select" multiple="multiple" data-placeholder="<?php 
        esc_attr_e('No categories', 'woocommerce');
        ?>
">
					<?php 
        $category_ids = $coupon->get_excluded_product_categories();
        $categories = get_terms('product_cat', 'orderby=name&hide_empty=0');
        if ($categories) {
            foreach ($categories as $cat) {
                echo '<option value="' . esc_attr($cat->term_id) . '"' . selected(in_array($cat->term_id, $category_ids), true, false) . '>' . esc_html($cat->name) . '</option>';
            }
        }
        ?>
				</select> <?php 
        echo wc_help_tip(__('Product must not be in this category for the coupon to remain valid or, for "Product Discounts", products in these categories will not be discounted.', 'woocommerce'));
        ?>
</p>
				<?php 
        echo '</div><div class="options_group">';
        // Customers
        woocommerce_wp_text_input(array('id' => 'customer_email', 'label' => __('Email restrictions', 'woocommerce'), 'placeholder' => __('No restrictions', 'woocommerce'), 'description' => __('List of allowed emails to check against the customer\'s billing email when an order is placed. Separate email addresses with commas.', 'woocommerce'), 'value' => implode(', ', (array) get_post_meta($post->ID, 'customer_email', true)), 'desc_tip' => true, 'type' => 'email', 'class' => '', 'custom_attributes' => array('multiple' => 'multiple')));
        echo '</div>';
        do_action('woocommerce_coupon_options_usage_restriction');
        ?>
</div>
			<div id="usage_limit_coupon_data" class="panel woocommerce_options_panel"><?php 
        echo '<div class="options_group">';
        // Usage limit per coupons
        woocommerce_wp_text_input(array('id' => 'usage_limit', 'label' => __('Usage limit per coupon', 'woocommerce'), 'placeholder' => esc_attr__('Unlimited usage', 'woocommerce'), 'description' => __('How many times this coupon can be used before it is void.', 'woocommerce'), 'type' => 'number', 'desc_tip' => true, 'class' => 'short', 'custom_attributes' => array('step' => 1, 'min' => 0), 'value' => $coupon->get_usage_limit() ? $coupon->get_usage_limit() : ''));
        // Usage limit per product
        woocommerce_wp_text_input(array('id' => 'limit_usage_to_x_items', 'label' => __('Limit usage to X items', 'woocommerce'), 'placeholder' => esc_attr__('Apply to all qualifying items in cart', 'woocommerce'), 'description' => __('The maximum number of individual items this coupon can apply to when using product discounts. Leave blank to apply to all qualifying items in cart.', 'woocommerce'), 'desc_tip' => true, 'class' => 'short', 'type' => 'number', 'custom_attributes' => array('step' => 1, 'min' => 0), 'value' => $coupon->get_limit_usage_to_x_items() ? $coupon->get_limit_usage_to_x_items() : ''));
        // Usage limit per users
        woocommerce_wp_text_input(array('id' => 'usage_limit_per_user', 'label' => __('Usage limit per user', 'woocommerce'), 'placeholder' => esc_attr__('Unlimited usage', 'woocommerce'), 'description' => __('How many times this coupon can be used by an invidual user. Uses billing email for guests, and user ID for logged in users.', 'woocommerce'), 'desc_tip' => true, 'class' => 'short', 'type' => 'number', 'custom_attributes' => array('step' => 1, 'min' => 0), 'value' => $coupon->get_usage_limit_per_user() ? $coupon->get_usage_limit_per_user() : ''));
        echo '</div>';
        do_action('woocommerce_coupon_options_usage_limit');
        ?>
</div>
			<?php 
        do_action('woocommerce_coupon_data_panels');
        ?>
			<div class="clear"></div>
		</div>
		<?php 
    }
        /**
         * Output shipping method settings.
         */
        public function shipping_methods_setting()
        {
            $selection_priority = get_option('woocommerce_shipping_method_selection_priority', array());
            ?>
		<tr valign="top">
			<th scope="row" class="titledesc"><?php 
            _e('Shipping Methods', 'woocommerce');
            ?>
</th>
			<td class="forminp">
				<table class="wc_shipping widefat wp-list-table" cellspacing="0">
					<thead>
						<tr>
							<th class="sort">&nbsp;</th>
							<th class="name"><?php 
            _e('Name', 'woocommerce');
            ?>
</th>
							<th class="id"><?php 
            _e('ID', 'woocommerce');
            ?>
</th>
							<th class="status"><?php 
            _e('Enabled', 'woocommerce');
            ?>
</th>
							<th class="priority"><?php 
            _e('Selection Priority', 'woocommerce');
            ?>
 <?php 
            echo wc_help_tip(__('Available methods will be chosen by default in this order. If multiple methods have the same priority, they will be sorted by cost.', 'woocommerce'));
            ?>
</th>
						</tr>
					</thead>
					<tbody>
						<?php 
            foreach (WC()->shipping->load_shipping_methods() as $key => $method) {
                ?>
							<tr>
								<td width="1%" class="sort">
									<input type="hidden" name="method_order[<?php 
                echo esc_attr($method->id);
                ?>
]" value="<?php 
                echo esc_attr($method->id);
                ?>
" />
								</td>
								<td class="name">
									<?php 
                if ($method->has_settings) {
                    ?>
<a href="<?php 
                    echo esc_url(admin_url('admin.php?page=wc-settings&tab=shipping&section=' . strtolower(get_class($method))));
                    ?>
"><?php 
                }
                ?>
									<?php 
                echo esc_html($method->get_title());
                ?>
									<?php 
                if ($method->has_settings) {
                    ?>
</a><?php 
                }
                ?>
								</td>
								<td class="id">
									<?php 
                echo esc_attr($method->id);
                ?>
								</td>
								<td class="status">
									<?php 
                if ('yes' === $method->enabled) {
                    ?>
										<span class="status-enabled tips" data-tip="<?php 
                    esc_attr_e('Yes', 'woocommerce');
                    ?>
"><?php 
                    _e('Yes', 'woocommerce');
                    ?>
</span>
									<?php 
                } else {
                    ?>
										<span class="na">-</span>
									<?php 
                }
                ?>
								</td>
								<td width="1%" class="priority">
									<input type="number" step="1" min="0" name="method_priority[<?php 
                echo esc_attr($method->id);
                ?>
]" value="<?php 
                echo isset($selection_priority[$method->id]) ? absint($selection_priority[$method->id]) : 1;
                ?>
" />
								</td>
							</tr>
						<?php 
            }
            ?>
					</tbody>
					<tfoot>
						<tr>
							<th>&nbsp;</th>
							<th colspan="4"><span class="description"><?php 
            _e('Drag and drop the above shipping methods to control their display order.', 'woocommerce');
            ?>
</span></th>
						</tr>
					</tfoot>
				</table>
			</td>
		</tr>
		<?php 
        }
<?php

if (!defined('ABSPATH')) {
    exit;
}
?>

<h2><?php 
_e('Shipping Zones', 'woocommerce');
?>
 <?php 
echo wc_help_tip(__('Shipping Zones let you group regions with similar Shipping Methods and rates. WooCommerce will automatically choose the correct Shipping Zone based on your customer&lsquo;s shipping address and present the Shipping Methods within that zone to them.', 'woocommerce'));
?>
</h2>

<table class="wc-shipping-zones widefat">
    <thead>
        <tr>
            <th class="wc-shipping-zone-sort">&nbsp;</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>
?>

<h2>
	<?php 
_e('Shipping Zones', 'woocommerce');
?>
	<?php 
echo wc_help_tip(__('A shipping zone is a geographic region where a certain set of shipping methods and rates apply.', 'woocommerce') . ' ' . __('WooCommerce will automatically choose the correct shipping zone based on your customer&lsquo;s shipping address and present the shipping methods within that zone to them.', 'woocommerce'));
?>
</h2>

<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>
    /**
     * Show options for the variable product type.
     */
    public static function output_variations()
    {
        global $post, $wpdb;
        // Get attributes
        $attributes = maybe_unserialize(get_post_meta($post->ID, '_product_attributes', true));
        // See if any are set
        $variation_attribute_found = false;
        if ($attributes) {
            foreach ($attributes as $attribute) {
                if (!empty($attribute['is_variation'])) {
                    $variation_attribute_found = true;
                    break;
                }
            }
        }
        $variations_count = absint($wpdb->get_var($wpdb->prepare("SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_type = 'product_variation' AND post_status IN ('publish', 'private')", $post->ID)));
        $variations_per_page = absint(apply_filters('woocommerce_admin_meta_boxes_variations_per_page', 15));
        $variations_total_pages = ceil($variations_count / $variations_per_page);
        ?>
		<div id="variable_product_options" class="panel wc-metaboxes-wrapper hidden"><div id="variable_product_options_inner">

			<?php 
        if (!$variation_attribute_found) {
            ?>

				<div id="message" class="inline notice woocommerce-message">
					<p><?php 
            _e('Before you can add a variation you need to add some variation attributes on the <strong>Attributes</strong> tab.', 'woocommerce');
            ?>
</p>
					<p>
						<a class="button-primary" href="<?php 
            echo esc_url(apply_filters('woocommerce_docs_url', 'https://docs.woocommerce.com/document/variable-product/', 'product-variations'));
            ?>
" target="_blank"><?php 
            _e('Learn more', 'woocommerce');
            ?>
</a>
					</p>
				</div>

			<?php 
        } else {
            ?>

				<div class="toolbar toolbar-variations-defaults">
					<div class="variations-defaults">
						<strong><?php 
            _e('Default Form Values', 'woocommerce');
            ?>
: <?php 
            echo wc_help_tip(__('These are the attributes that will be pre-selected on the frontend.', 'woocommerce'));
            ?>
</strong>
						<?php 
            $default_attributes = maybe_unserialize(get_post_meta($post->ID, '_default_attributes', true));
            foreach ($attributes as $attribute) {
                // Only deal with attributes that are variations
                if (!$attribute['is_variation']) {
                    continue;
                }
                // Get current value for variation (if set)
                $variation_selected_value = isset($default_attributes[sanitize_title($attribute['name'])]) ? $default_attributes[sanitize_title($attribute['name'])] : '';
                // Name will be something like attribute_pa_color
                echo '<select name="default_attribute_' . sanitize_title($attribute['name']) . '" data-current="' . esc_attr($variation_selected_value) . '"><option value="">' . __('No default', 'woocommerce') . ' ' . esc_html(wc_attribute_label($attribute['name'])) . '&hellip;</option>';
                // Get terms for attribute taxonomy or value if its a custom attribute
                if ($attribute['is_taxonomy']) {
                    $post_terms = wp_get_post_terms($post->ID, $attribute['name']);
                    foreach ($post_terms as $term) {
                        echo '<option ' . selected($variation_selected_value, $term->slug, false) . ' value="' . esc_attr($term->slug) . '">' . esc_html(apply_filters('woocommerce_variation_option_name', $term->name)) . '</option>';
                    }
                } else {
                    $options = wc_get_text_attributes($attribute['value']);
                    foreach ($options as $option) {
                        $selected = sanitize_title($variation_selected_value) === $variation_selected_value ? selected($variation_selected_value, sanitize_title($option), false) : selected($variation_selected_value, $option, false);
                        echo '<option ' . $selected . ' value="' . esc_attr($option) . '">' . esc_html(apply_filters('woocommerce_variation_option_name', $option)) . '</option>';
                    }
                }
                echo '</select>';
            }
            ?>
					</div>
					<div class="clear"></div>
				</div>

				<div class="toolbar toolbar-top">
					<select id="field_to_edit" class="variation_actions">
						<option data-global="true" value="add_variation"><?php 
            _e('Add variation', 'woocommerce');
            ?>
</option>
						<option data-global="true" value="link_all_variations"><?php 
            _e('Create variations from all attributes', 'woocommerce');
            ?>
</option>
						<option value="delete_all"><?php 
            _e('Delete all variations', 'woocommerce');
            ?>
</option>
						<optgroup label="<?php 
            esc_attr_e('Status', 'woocommerce');
            ?>
">
							<option value="toggle_enabled"><?php 
            _e('Toggle &quot;Enabled&quot;', 'woocommerce');
            ?>
</option>
							<option value="toggle_downloadable"><?php 
            _e('Toggle &quot;Downloadable&quot;', 'woocommerce');
            ?>
</option>
							<option value="toggle_virtual"><?php 
            _e('Toggle &quot;Virtual&quot;', 'woocommerce');
            ?>
</option>
						</optgroup>
						<optgroup label="<?php 
            esc_attr_e('Pricing', 'woocommerce');
            ?>
">
							<option value="variable_regular_price"><?php 
            _e('Set regular prices', 'woocommerce');
            ?>
</option>
							<option value="variable_regular_price_increase"><?php 
            _e('Increase regular prices (fixed amount or percentage)', 'woocommerce');
            ?>
</option>
							<option value="variable_regular_price_decrease"><?php 
            _e('Decrease regular prices (fixed amount or percentage)', 'woocommerce');
            ?>
</option>
							<option value="variable_sale_price"><?php 
            _e('Set sale prices', 'woocommerce');
            ?>
</option>
							<option value="variable_sale_price_increase"><?php 
            _e('Increase sale prices (fixed amount or percentage)', 'woocommerce');
            ?>
</option>
							<option value="variable_sale_price_decrease"><?php 
            _e('Decrease sale prices (fixed amount or percentage)', 'woocommerce');
            ?>
</option>
							<option value="variable_sale_schedule"><?php 
            _e('Set scheduled sale dates', 'woocommerce');
            ?>
</option>
						</optgroup>
						<optgroup label="<?php 
            esc_attr_e('Inventory', 'woocommerce');
            ?>
">
							<option value="toggle_manage_stock"><?php 
            _e('Toggle &quot;Manage stock&quot;', 'woocommerce');
            ?>
</option>
							<option value="variable_stock"><?php 
            _e('Stock', 'woocommerce');
            ?>
</option>
						</optgroup>
						<optgroup label="<?php 
            esc_attr_e('Shipping', 'woocommerce');
            ?>
">
							<option value="variable_length"><?php 
            _e('Length', 'woocommerce');
            ?>
</option>
							<option value="variable_width"><?php 
            _e('Width', 'woocommerce');
            ?>
</option>
							<option value="variable_height"><?php 
            _e('Height', 'woocommerce');
            ?>
</option>
							<option value="variable_weight"><?php 
            _e('Weight', 'woocommerce');
            ?>
</option>
						</optgroup>
						<optgroup label="<?php 
            esc_attr_e('Downloadable products', 'woocommerce');
            ?>
">
							<option value="variable_download_limit"><?php 
            _e('Download limit', 'woocommerce');
            ?>
</option>
							<option value="variable_download_expiry"><?php 
            _e('Download expiry', 'woocommerce');
            ?>
</option>
						</optgroup>
						<?php 
            do_action('woocommerce_variable_product_bulk_edit_actions');
            ?>
					</select>
					<a class="button bulk_edit do_variation_action"><?php 
            _e('Go', 'woocommerce');
            ?>
</a>

					<div class="variations-pagenav">
						<span class="displaying-num"><?php 
            printf(_n('%s item', '%s items', $variations_count, 'woocommerce'), $variations_count);
            ?>
</span>
						<span class="expand-close">
							(<a href="#" class="expand_all"><?php 
            _e('Expand', 'woocommerce');
            ?>
</a> / <a href="#" class="close_all"><?php 
            _e('Close', 'woocommerce');
            ?>
</a>)
						</span>
						<span class="pagination-links">
							<a class="first-page disabled" title="<?php 
            esc_attr_e('Go to the first page', 'woocommerce');
            ?>
" href="#">&laquo;</a>
							<a class="prev-page disabled" title="<?php 
            esc_attr_e('Go to the previous page', 'woocommerce');
            ?>
" href="#">&lsaquo;</a>
							<span class="paging-select">
								<label for="current-page-selector-1" class="screen-reader-text"><?php 
            _e('Select Page', 'woocommerce');
            ?>
</label>
								<select class="page-selector" id="current-page-selector-1" title="<?php 
            esc_attr_e('Current page', 'woocommerce');
            ?>
">
									<?php 
            for ($i = 1; $i <= $variations_total_pages; $i++) {
                ?>
										<option value="<?php 
                echo $i;
                ?>
"><?php 
                echo $i;
                ?>
</option>
									<?php 
            }
            ?>
								</select>
								 <?php 
            _ex('of', 'number of pages', 'woocommerce');
            ?>
 <span class="total-pages"><?php 
            echo $variations_total_pages;
            ?>
</span>
							</span>
							<a class="next-page" title="<?php 
            esc_attr_e('Go to the next page', 'woocommerce');
            ?>
" href="#">&rsaquo;</a>
							<a class="last-page" title="<?php 
            esc_attr_e('Go to the last page', 'woocommerce');
            ?>
" href="#">&raquo;</a>
						</span>
					</div>
					<div class="clear"></div>
				</div>

				<div class="woocommerce_variations wc-metaboxes" data-attributes="<?php 
            // esc_attr does not double encode - htmlspecialchars does
            echo htmlspecialchars(json_encode($attributes));
            ?>
" data-total="<?php 
            echo $variations_count;
            ?>
" data-total_pages="<?php 
            echo $variations_total_pages;
            ?>
" data-page="1" data-edited="false">
				</div>

				<div class="toolbar">
					<button type="button" class="button-primary save-variation-changes" disabled="disabled"><?php 
            _e('Save changes', 'woocommerce');
            ?>
</button>
					<button type="button" class="button cancel-variation-changes" disabled="disabled"><?php 
            _e('Cancel', 'woocommerce');
            ?>
</button>

					<div class="variations-pagenav">
						<span class="displaying-num"><?php 
            printf(_n('%s item', '%s items', $variations_count, 'woocommerce'), $variations_count);
            ?>
</span>
						<span class="expand-close">
							(<a href="#" class="expand_all"><?php 
            _e('Expand', 'woocommerce');
            ?>
</a> / <a href="#" class="close_all"><?php 
            _e('Close', 'woocommerce');
            ?>
</a>)
						</span>
						<span class="pagination-links">
							<a class="first-page disabled" title="<?php 
            esc_attr_e('Go to the first page', 'woocommerce');
            ?>
" href="#">&laquo;</a>
							<a class="prev-page disabled" title="<?php 
            esc_attr_e('Go to the previous page', 'woocommerce');
            ?>
" href="#">&lsaquo;</a>
							<span class="paging-select">
								<label for="current-page-selector-1" class="screen-reader-text"><?php 
            _e('Select Page', 'woocommerce');
            ?>
</label>
								<select class="page-selector" id="current-page-selector-1" title="<?php 
            esc_attr_e('Current page', 'woocommerce');
            ?>
">
									<?php 
            for ($i = 1; $i <= $variations_total_pages; $i++) {
                ?>
										<option value="<?php 
                echo $i;
                ?>
"><?php 
                echo $i;
                ?>
</option>
									<?php 
            }
            ?>
								</select>
								 <?php 
            _ex('of', 'number of pages', 'woocommerce');
            ?>
 <span class="total-pages"><?php 
            echo $variations_total_pages;
            ?>
</span>
							</span>
							<a class="next-page" title="<?php 
            esc_attr_e('Go to the next page', 'woocommerce');
            ?>
" href="#">&rsaquo;</a>
							<a class="last-page" title="<?php 
            esc_attr_e('Go to the last page', 'woocommerce');
            ?>
" href="#">&raquo;</a>
						</span>
					</div>

					<div class="clear"></div>
				</div>

			<?php 
        }
        ?>
		</div></div>
		<?php 
    }
&nbsp;<?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');
?>
&nbsp;<?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');
?>
&nbsp;<?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="10">
				<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>
    /**
     * Output coupons usage restriction meta box data.
     */
    public static function coupon_options_data()
    {
        global $post;
        echo '<div class="options_group">';
        // Billing Countries.
        ?>
		<p class="form-field"><label for="billing_countries"><?php 
        _e('Billing countries', 'wc-coupons-by-country');
        ?>
</label>
		<select id="billing_countries" name="billing_countries[]" style="width: 50%;" class="wc-enhanced-select" multiple="multiple" data-placeholder="<?php 
        esc_attr_e('Any countries', 'wc-coupons-by-country');
        ?>
">
			<?php 
        $locations = (array) get_post_meta($post->ID, 'billing_countries', true);
        $countries = WC()->countries->countries;
        if ($countries) {
            foreach ($countries as $key => $val) {
                echo '<option value="' . esc_attr($key) . '"' . selected(in_array($key, $locations), true, false) . '>' . esc_html($val) . '</option>';
            }
        }
        ?>
		</select> <?php 
        echo wc_help_tip(__('List of allowed countries to check against the customer\'s billing country for the coupon to remain valid.', 'wc-coupons-by-country'));
        ?>
</p>
		<?php 
        // Shipping Countries.
        ?>
		<p class="form-field"><label for="shipping_countries"><?php 
        _e('Shipping countries', 'wc-coupons-by-country');
        ?>
</label>
		<select id="shipping_countries" name="shipping_countries[]" style="width: 50%;" class="wc-enhanced-select" multiple="multiple" data-placeholder="<?php 
        esc_attr_e('Any countries', 'wc-coupons-by-country');
        ?>
">
			<?php 
        $locations = (array) get_post_meta($post->ID, 'shipping_countries', true);
        $countries = WC()->countries->countries;
        if ($countries) {
            foreach ($countries as $key => $val) {
                echo '<option value="' . esc_attr($key) . '"' . selected(in_array($key, $locations), true, false) . '>' . esc_html($val) . '</option>';
            }
        }
        ?>
		</select> <?php 
        echo wc_help_tip(__('List of allowed countries to check against the customer\'s shipping country for the coupon to remain valid.', 'wc-coupons-by-country'));
        ?>
</p>
		<?php 
        echo '</div>';
    }
 /**
  * Add WC Meta boxes.
  */
 public function add_meta_boxes()
 {
     $screen = get_current_screen();
     // Products
     add_meta_box('postexcerpt', __('Product Short Description', 'woocommerce'), 'WC_Meta_Box_Product_Short_Description::output', 'product', 'normal');
     add_meta_box('woocommerce-product-data', __('Product Data', 'woocommerce'), 'WC_Meta_Box_Product_Data::output', 'product', 'normal', 'high');
     add_meta_box('woocommerce-product-images', __('Product Gallery', 'woocommerce'), 'WC_Meta_Box_Product_Images::output', 'product', 'side', 'low');
     // Orders
     foreach (wc_get_order_types('order-meta-boxes') as $type) {
         $order_type_object = get_post_type_object($type);
         add_meta_box('woocommerce-order-data', sprintf(__('%s Data', 'woocommerce'), $order_type_object->labels->singular_name), 'WC_Meta_Box_Order_Data::output', $type, 'normal', 'high');
         add_meta_box('woocommerce-order-items', __('Items', 'woocommerce'), 'WC_Meta_Box_Order_Items::output', $type, 'normal', 'high');
         add_meta_box('woocommerce-order-notes', sprintf(__('%s Notes', 'woocommerce'), $order_type_object->labels->singular_name), 'WC_Meta_Box_Order_Notes::output', $type, 'side', 'default');
         add_meta_box('woocommerce-order-downloads', __('Downloadable Product Permissions', 'woocommerce') . wc_help_tip(__('Note: Permissions for order items will automatically be granted when the order status changes to processing/completed.', 'woocommerce')), 'WC_Meta_Box_Order_Downloads::output', $type, 'normal', 'default');
         add_meta_box('woocommerce-order-actions', sprintf(__('%s Actions', 'woocommerce'), $order_type_object->labels->singular_name), 'WC_Meta_Box_Order_Actions::output', $type, 'side', 'high');
     }
     // Coupons
     add_meta_box('woocommerce-coupon-data', __('Coupon Data', 'woocommerce'), 'WC_Meta_Box_Coupon_Data::output', 'shop_coupon', 'normal', 'high');
 }
 /**
  * Helper function to get the formated description and tip HTML for a
  * given form field. Plugins can call this when implementing their own custom
  * settings types.
  *
  * @param array $value The form field value array
  * @returns array The description and tip as a 2 element array
  */
 public static function get_field_description($value)
 {
     $description = '';
     $tooltip_html = '';
     if (true === $value['desc_tip']) {
         $tooltip_html = $value['desc'];
     } elseif (!empty($value['desc_tip'])) {
         $description = $value['desc'];
         $tooltip_html = $value['desc_tip'];
     } elseif (!empty($value['desc'])) {
         $description = $value['desc'];
     }
     if ($description && in_array($value['type'], array('textarea', 'radio'))) {
         $description = '<p style="margin-top:0">' . wp_kses_post($description) . '</p>';
     } elseif ($description && in_array($value['type'], array('checkbox'))) {
         $description = wp_kses_post($description);
     } elseif ($description) {
         $description = '<span class="description">' . wp_kses_post($description) . '</span>';
     }
     if ($tooltip_html && in_array($value['type'], array('checkbox'))) {
         $tooltip_html = '<p class="description">' . $tooltip_html . '</p>';
     } elseif ($tooltip_html) {
         $tooltip_html = wc_help_tip($tooltip_html);
     }
     return array('description' => $description, 'tooltip_html' => $tooltip_html);
 }
        /**
         * Output custom columns for coupons.
         * @param  string $column
         */
        public function render_shop_order_columns($column)
        {
            global $post, $woocommerce, $the_order;
            if (empty($the_order) || $the_order->id != $post->ID) {
                $the_order = wc_get_order($post->ID);
            }
            switch ($column) {
                case 'order_status':
                    printf('<mark class="%s tips" data-tip="%s">%s</mark>', sanitize_title($the_order->get_status()), wc_get_order_status_name($the_order->get_status()), wc_get_order_status_name($the_order->get_status()));
                    break;
                case 'order_date':
                    if ('0000-00-00 00:00:00' == $post->post_date) {
                        $t_time = $h_time = __('Unpublished', 'woocommerce');
                    } else {
                        $t_time = get_the_time(__('Y/m/d g:i:s A', 'woocommerce'), $post);
                        $h_time = get_the_time(__('Y/m/d', 'woocommerce'), $post);
                    }
                    echo '<abbr title="' . esc_attr($t_time) . '">' . esc_html(apply_filters('post_date_column_time', $h_time, $post)) . '</abbr>';
                    break;
                case 'customer_message':
                    if ($the_order->customer_message) {
                        echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip($the_order->customer_message) . '">' . __('Yes', 'woocommerce') . '</span>';
                    } else {
                        echo '<span class="na">&ndash;</span>';
                    }
                    break;
                case 'order_items':
                    echo '<a href="#" class="show_order_items">' . apply_filters('woocommerce_admin_order_item_count', sprintf(_n('%d item', '%d items', $the_order->get_item_count(), 'woocommerce'), $the_order->get_item_count()), $the_order) . '</a>';
                    if (sizeof($the_order->get_items()) > 0) {
                        echo '<table class="order_items" cellspacing="0">';
                        foreach ($the_order->get_items() as $item) {
                            $product = apply_filters('woocommerce_order_item_product', $the_order->get_product_from_item($item), $item);
                            $item_meta = new WC_Order_Item_Meta($item, $product);
                            $item_meta_html = $item_meta->display(true, true);
                            ?>
						<tr class="<?php 
                            echo apply_filters('woocommerce_admin_order_item_class', '', $item);
                            ?>
">
							<td class="qty"><?php 
                            echo absint($item['qty']);
                            ?>
</td>
							<td class="name">
								<?php 
                            if ($product) {
                                ?>
									<?php 
                                echo wc_product_sku_enabled() && $product->get_sku() ? $product->get_sku() . ' - ' : '';
                                ?>
<a href="<?php 
                                echo get_edit_post_link($product->id);
                                ?>
" title="<?php 
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item, false);
                                ?>
"><?php 
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item, false);
                                ?>
</a>
								<?php 
                            } else {
                                ?>
									<?php 
                                echo apply_filters('woocommerce_order_item_name', $item['name'], $item, false);
                                ?>
								<?php 
                            }
                            ?>
								<?php 
                            if (!empty($item_meta_html)) {
                                ?>
									<?php 
                                echo wc_help_tip($item_meta_html);
                                ?>
								<?php 
                            }
                            ?>
							</td>
						</tr>
						<?php 
                        }
                        echo '</table>';
                    } else {
                        echo '&ndash;';
                    }
                    break;
                case 'billing_address':
                    if ($address = $the_order->get_formatted_billing_address()) {
                        echo esc_html(preg_replace('#<br\\s*/?>#i', ', ', $address));
                    } else {
                        echo '&ndash;';
                    }
                    if ($the_order->billing_phone) {
                        echo '<small class="meta">' . __('Tel:', 'woocommerce') . ' ' . esc_html($the_order->billing_phone) . '</small>';
                    }
                    break;
                case 'shipping_address':
                    if ($address = $the_order->get_formatted_shipping_address()) {
                        echo '<a target="_blank" href="' . esc_url($the_order->get_shipping_address_map_url()) . '">' . esc_html(preg_replace('#<br\\s*/?>#i', ', ', $address)) . '</a>';
                    } else {
                        echo '&ndash;';
                    }
                    if ($the_order->get_shipping_method()) {
                        echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->get_shipping_method()) . '</small>';
                    }
                    break;
                case 'order_notes':
                    if ($post->comment_count) {
                        // check the status of the post
                        $status = 'trash' !== $post->post_status ? '' : 'post-trashed';
                        $latest_notes = get_comments(array('post_id' => $post->ID, 'number' => 1, 'status' => $status));
                        $latest_note = current($latest_notes);
                        if ($post->comment_count == 1) {
                            echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip($latest_note->comment_content) . '">' . __('Yes', 'woocommerce') . '</span>';
                        } elseif (isset($latest_note->comment_content)) {
                            echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip($latest_note->comment_content . '<br/><small style="display:block">' . sprintf(_n('plus %d other note', 'plus %d other notes', $post->comment_count - 1, 'woocommerce'), $post->comment_count - 1) . '</small>') . '">' . __('Yes', 'woocommerce') . '</span>';
                        } else {
                            echo '<span class="note-on tips" data-tip="' . wc_sanitize_tooltip(sprintf(_n('%d note', '%d notes', $post->comment_count, 'woocommerce'), $post->comment_count)) . '">' . __('Yes', 'woocommerce') . '</span>';
                        }
                    } else {
                        echo '<span class="na">&ndash;</span>';
                    }
                    break;
                case 'order_total':
                    echo $the_order->get_formatted_order_total();
                    if ($the_order->payment_method_title) {
                        echo '<small class="meta">' . __('Via', 'woocommerce') . ' ' . esc_html($the_order->payment_method_title) . '</small>';
                    }
                    break;
                case 'order_title':
                    if ($the_order->user_id) {
                        $user_info = get_userdata($the_order->user_id);
                    }
                    if (!empty($user_info)) {
                        $username = '******' . absint($user_info->ID) . '">';
                        if ($user_info->first_name || $user_info->last_name) {
                            $username .= esc_html(sprintf(_x('%1$s %2$s', 'full name', 'woocommerce'), ucfirst($user_info->first_name), ucfirst($user_info->last_name)));
                        } else {
                            $username .= esc_html(ucfirst($user_info->display_name));
                        }
                        $username .= '</a>';
                    } else {
                        if ($the_order->billing_first_name || $the_order->billing_last_name) {
                            $username = trim(sprintf(_x('%1$s %2$s', 'full name', 'woocommerce'), $the_order->billing_first_name, $the_order->billing_last_name));
                        } else {
                            $username = __('Guest', 'woocommerce');
                        }
                    }
                    printf(_x('%s by %s', 'Order number by X', 'woocommerce'), '<a href="' . admin_url('post.php?post=' . absint($post->ID) . '&action=edit') . '" class="row-title"><strong>#' . esc_attr($the_order->get_order_number()) . '</strong></a>', $username);
                    if ($the_order->billing_email) {
                        echo '<small class="meta email"><a href="' . esc_url('mailto:' . $the_order->billing_email) . '">' . esc_html($the_order->billing_email) . '</a></small>';
                    }
                    echo '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __('Show more details', 'woocommerce') . '</span></button>';
                    break;
                case 'order_actions':
                    ?>
<p>
					<?php 
                    do_action('woocommerce_admin_order_actions_start', $the_order);
                    $actions = array();
                    if ($the_order->has_status(array('pending', 'on-hold'))) {
                        $actions['processing'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce_mark_order_status&status=processing&order_id=' . $post->ID), 'woocommerce-mark-order-status'), 'name' => __('Processing', 'woocommerce'), 'action' => "processing");
                    }
                    if ($the_order->has_status(array('pending', 'on-hold', 'processing'))) {
                        $actions['complete'] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce_mark_order_status&status=completed&order_id=' . $post->ID), 'woocommerce-mark-order-status'), 'name' => __('Complete', 'woocommerce'), 'action' => "complete");
                    }
                    $actions['view'] = array('url' => admin_url('post.php?post=' . $post->ID . '&action=edit'), 'name' => __('View', 'woocommerce'), 'action' => "view");
                    $actions = apply_filters('woocommerce_admin_order_actions', $actions, $the_order);
                    foreach ($actions as $action) {
                        printf('<a class="button tips %s" href="%s" data-tip="%s">%s</a>', esc_attr($action['action']), esc_url($action['url']), esc_attr($action['name']), esc_attr($action['name']));
                    }
                    do_action('woocommerce_admin_order_actions_end', $the_order);
                    ?>
				</p><?php 
                    break;
            }
        }
        /**
         * Output email notification settings.
         */
        public function email_notification_setting()
        {
            // Define emails that can be customised here
            $mailer = WC()->mailer();
            $email_templates = $mailer->get_emails();
            ?>
		<tr valign="top">
		    <td class="wc_emails_wrapper" colspan="2">
				<table class="wc_emails widefat" cellspacing="0">
					<thead>
						<tr>
							<?php 
            $columns = apply_filters('woocommerce_email_setting_columns', array('status' => '', 'name' => __('Email', 'woocommerce'), 'email_type' => __('Content Type', 'woocommerce'), 'recipient' => __('Recipient(s)', 'woocommerce'), 'actions' => ''));
            foreach ($columns as $key => $column) {
                echo '<th class="wc-email-settings-table-' . esc_attr($key) . '">' . esc_html($column) . '</th>';
            }
            ?>
						</tr>
					</thead>
					<tbody>
						<?php 
            foreach ($email_templates as $email_key => $email) {
                echo '<tr>';
                foreach ($columns as $key => $column) {
                    switch ($key) {
                        case 'name':
                            echo '<td class="wc-email-settings-table-' . esc_attr($key) . '">
											<a href="' . admin_url('admin.php?page=wc-settings&tab=email&section=' . strtolower($email_key)) . '">' . $email->get_title() . '</a>
											' . wc_help_tip($email->get_description()) . '
										</td>';
                            break;
                        case 'recipient':
                            echo '<td class="wc-email-settings-table-' . esc_attr($key) . '">
											' . esc_html($email->is_customer_email() ? __('Customer', 'woocommerce') : $email->get_recipient()) . '
										</td>';
                            break;
                        case 'status':
                            echo '<td class="wc-email-settings-table-' . esc_attr($key) . '">';
                            if ($email->is_manual()) {
                                echo '<span class="status-manual tips" data-tip="' . __('Manually sent', 'woocommerce') . '">' . __('Manual', 'woocommerce') . '</span>';
                            } elseif ($email->is_enabled()) {
                                echo '<span class="status-enabled tips" data-tip="' . __('Enabled', 'woocommerce') . '">' . __('Yes', 'woocommerce') . '</span>';
                            } else {
                                echo '<span class="status-disabled tips" data-tip="' . __('Disabled', 'woocommerce') . '">-</span>';
                            }
                            echo '</td>';
                            break;
                        case 'email_type':
                            echo '<td class="wc-email-settings-table-' . esc_attr($key) . '">
											' . esc_html($email->get_content_type()) . '
										</td>';
                            break;
                        case 'actions':
                            echo '<td class="wc-email-settings-table-' . esc_attr($key) . '">
											<a class="button alignright tips" data-tip="' . __('Configure', 'woocommerce') . '" href="' . admin_url('admin.php?page=wc-settings&tab=email&section=' . strtolower($email_key)) . '">' . __('Configure', 'woocommerce') . '</a>
										</td>';
                            break;
                        default:
                            do_action('woocommerce_email_setting_column_' . $key, $email);
                            break;
                    }
                }
                echo '</tr>';
            }
            ?>
					</tbody>
				</table>
			</td>
		</tr>
		<?php 
        }
    /**
     * Get the main chart.
     *
     * @return string
     */
    public function get_main_chart()
    {
        global $wpdb;
        $query_data = array('order_item_name' => array('type' => 'order_item', 'function' => '', 'name' => 'tax_rate'), 'tax_amount' => array('type' => 'order_item_meta', 'order_item_type' => 'tax', 'function' => '', 'name' => 'tax_amount'), 'shipping_tax_amount' => array('type' => 'order_item_meta', 'order_item_type' => 'tax', 'function' => '', 'name' => 'shipping_tax_amount'), 'rate_id' => array('type' => 'order_item_meta', 'order_item_type' => 'tax', 'function' => '', 'name' => 'rate_id'), 'ID' => array('type' => 'post_data', 'function' => '', 'name' => 'post_id'));
        $query_where = array(array('key' => 'order_item_type', 'value' => 'tax', 'operator' => '='), array('key' => 'order_item_name', 'value' => '', 'operator' => '!='));
        $tax_rows_orders = $this->get_order_report_data(array('data' => $query_data, 'where' => $query_where, 'order_by' => 'posts.post_date ASC', 'query_type' => 'get_results', 'filter_range' => true, 'order_types' => array_merge(wc_get_order_types('sales-reports'), array('shop_order_refund')), 'order_status' => array('completed', 'processing', 'on-hold'), 'parent_order_status' => array('completed', 'processing', 'on-hold')));
        // Merge
        $tax_rows = array();
        foreach ($tax_rows_orders as $tax_row) {
            $key = $tax_row->rate_id;
            $tax_rows[$key] = isset($tax_rows[$key]) ? $tax_rows[$key] : (object) array('tax_amount' => 0, 'shipping_tax_amount' => 0, 'total_orders' => 0);
            if ('shop_order_refund' !== get_post_type($tax_row->post_id)) {
                $tax_rows[$key]->total_orders += 1;
            }
            $tax_rows[$key]->tax_rate = $tax_row->tax_rate;
            $tax_rows[$key]->tax_amount += wc_round_tax_total($tax_row->tax_amount);
            $tax_rows[$key]->shipping_tax_amount += wc_round_tax_total($tax_row->shipping_tax_amount);
        }
        ?>
		<table class="widefat">
			<thead>
				<tr>
					<th><?php 
        _e('Tax', 'woocommerce');
        ?>
</th>
					<th><?php 
        _e('Rate', 'woocommerce');
        ?>
</th>
					<th class="total_row"><?php 
        _e('Number of Orders', 'woocommerce');
        ?>
</th>
					<th class="total_row"><?php 
        _e('Tax Amount', 'woocommerce');
        ?>
 <?php 
        echo wc_help_tip(__('This is the sum of the "Tax Rows" tax amount within your orders.', 'woocommerce'));
        ?>
</th>
					<th class="total_row"><?php 
        _e('Shipping Tax Amount', 'woocommerce');
        ?>
 <?php 
        echo wc_help_tip(__('This is the sum of the "Tax Rows" shipping tax amount within your orders.', 'woocommerce'));
        ?>
</th>
					<th class="total_row"><?php 
        _e('Total Tax', 'woocommerce');
        ?>
 <?php 
        echo wc_help_tip(__('This is the total tax for the rate (shipping tax + product tax).', 'woocommerce'));
        ?>
</th>
				</tr>
			</thead>
			<?php 
        if ($tax_rows) {
            ?>
				<tbody>
					<?php 
            foreach ($tax_rows as $rate_id => $tax_row) {
                $rate = $wpdb->get_var($wpdb->prepare("SELECT tax_rate FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_id = %d;", $rate_id));
                ?>
						<tr>
							<th scope="row"><?php 
                echo apply_filters('woocommerce_reports_taxes_tax_rate', $tax_row->tax_rate, $rate_id, $tax_row);
                ?>
</th>
							<td><?php 
                echo apply_filters('woocommerce_reports_taxes_rate', $rate, $rate_id, $tax_row);
                ?>
%</td>
							<td class="total_row"><?php 
                echo $tax_row->total_orders;
                ?>
</td>
							<td class="total_row"><?php 
                echo wc_price($tax_row->tax_amount);
                ?>
</td>
							<td class="total_row"><?php 
                echo wc_price($tax_row->shipping_tax_amount);
                ?>
</td>
							<td class="total_row"><?php 
                echo wc_price($tax_row->tax_amount + $tax_row->shipping_tax_amount);
                ?>
</td>
						</tr>
						<?php 
            }
            ?>
				</tbody>
				<tfoot>
					<tr>
						<th scope="row" colspan="3"><?php 
            _e('Total', 'woocommerce');
            ?>
</th>
						<th class="total_row"><?php 
            echo wc_price(wc_round_tax_total(array_sum(wp_list_pluck((array) $tax_rows, 'tax_amount'))));
            ?>
</th>
						<th class="total_row"><?php 
            echo wc_price(wc_round_tax_total(array_sum(wp_list_pluck((array) $tax_rows, 'shipping_tax_amount'))));
            ?>
</th>
						<th class="total_row"><strong><?php 
            echo wc_price(wc_round_tax_total(array_sum(wp_list_pluck((array) $tax_rows, 'tax_amount')) + array_sum(wp_list_pluck((array) $tax_rows, 'shipping_tax_amount'))));
            ?>
</strong></th>
					</tr>
				</tfoot>
			<?php 
        } else {
            ?>
				<tbody>
					<tr>
						<td><?php 
            _e('No taxes found in this period', 'woocommerce');
            ?>
</td>
					</tr>
				</tbody>
			<?php 
        }
        ?>
		</table>
		<?php 
    }