| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- /**
- * Category Manipulations tab partial: Update product variant prices.
- *
- * @package Studiou_WC_Product_Cat_Manage
- *
- * @var Studiou_WC_Product_Cat_Manage_Manipulator $manipulator
- */
- // If this file is called directly, abort.
- if (!defined('WPINC')) {
- die;
- }
- $categories = $manipulator->get_categories_with_counts();
- ?>
- <!-- Update Product Variant Prices Operation -->
- <div class="studiou-wcpcm-card">
- <h2><?php echo esc_html__('Update product variant prices', 'studiou-wc-product-cat-manage'); ?></h2>
- <p><?php echo esc_html__('Bulk-update the regular price of product variations matching the selected categories and a chosen variation attribute. Only product records are modified — existing orders and cart contents are not affected.', 'studiou-wc-product-cat-manage'); ?></p>
- <form id="studiou-wcpcm-upvp-form" method="post" onsubmit="return false;">
- <table class="form-table">
- <tr>
- <th scope="row">
- <label for="upvp_categories_list"><?php echo esc_html__('Select Categories', 'studiou-wc-product-cat-manage'); ?></label>
- </th>
- <td>
- <div class="studiou-wcpcm-categories-list-container">
- <div class="studiou-wcpcm-list-actions">
- <button type="button" id="studiou-wcpcm-upvp-check-all" class="button">
- <?php echo esc_html__('Check All', 'studiou-wc-product-cat-manage'); ?>
- </button>
- <button type="button" id="studiou-wcpcm-upvp-uncheck-all" class="button">
- <?php echo esc_html__('Uncheck All', 'studiou-wc-product-cat-manage'); ?>
- </button>
- </div>
- <div class="studiou-wcpcm-categories-list" id="upvp_categories_list">
- <?php foreach ($categories as $category): ?>
- <label class="studiou-wcpcm-category-item">
- <input type="checkbox" name="upvp_categories[]" value="<?php echo esc_attr($category['id']); ?>">
- <span><?php echo esc_html($category['display_name']); ?></span>
- </label>
- <?php endforeach; ?>
- </div>
- </div>
- </td>
- </tr>
- <tr>
- <th scope="row">
- <label for="upvp_attribute"><?php echo esc_html__('Variant attribute', 'studiou-wc-product-cat-manage'); ?></label>
- </th>
- <td>
- <select id="upvp_attribute" name="upvp_attribute" class="regular-text">
- <option value=""><?php echo esc_html__('-- Select attribute --', 'studiou-wc-product-cat-manage'); ?></option>
- </select>
- </td>
- </tr>
- <tr>
- <th scope="row">
- <label for="upvp_attribute_value"><?php echo esc_html__('Variant attribute value', 'studiou-wc-product-cat-manage'); ?></label>
- </th>
- <td>
- <select id="upvp_attribute_value" name="upvp_attribute_value" class="regular-text" disabled>
- <option value=""><?php echo esc_html__('-- Select value --', 'studiou-wc-product-cat-manage'); ?></option>
- </select>
- </td>
- </tr>
- <tr>
- <th scope="row">
- <label for="upvp_new_price"><?php echo esc_html__('New Price', 'studiou-wc-product-cat-manage'); ?></label>
- </th>
- <td>
- <input type="number" step="0.01" min="0" id="upvp_new_price" name="upvp_new_price" class="regular-text">
- </td>
- </tr>
- <tr>
- <th scope="row">
- <?php echo esc_html__('Affected variations', 'studiou-wc-product-cat-manage'); ?>
- </th>
- <td>
- <strong id="studiou-wcpcm-upvp-affected-count">0</strong>
- </td>
- </tr>
- </table>
- <div class="submit-buttons">
- <button type="button" id="studiou-wcpcm-upvp-dry-run-button" class="button">
- <?php echo esc_html__('Dry Run', 'studiou-wc-product-cat-manage'); ?>
- </button>
- <button type="button" id="studiou-wcpcm-upvp-apply-button" class="button button-primary">
- <?php echo esc_html__('Apply', 'studiou-wc-product-cat-manage'); ?>
- </button>
- <span class="spinner"></span>
- </div>
- </form>
- <div class="studiou-wcpcm-upvp-results" style="display: none;">
- <h3><?php echo esc_html__('Results', 'studiou-wc-product-cat-manage'); ?></h3>
- <div id="studiou-wcpcm-upvp-message"></div>
- </div>
- </div>
|