| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- /**
- * Category Manipulations page view
- *
- * @since 1.0.0
- * @package Studiou_WC_Product_Cat_Manage
- */
- // If this file is called directly, abort.
- if (!defined('WPINC')) {
- die;
- }
- // Get categories with counts for select boxes
- $manipulator = new Studiou_WC_Product_Cat_Manage_Manipulator(new Studiou_WC_Product_Cat_Manage_DB());
- $categories = $manipulator->get_categories_with_counts();
- ?>
- <div class="wrap studiou-wcpcm-wrap">
- <h1><?php echo esc_html__('Category Manipulations', 'studiou-wc-product-cat-manage'); ?></h1>
-
- <div class="studiou-wcpcm-notice-area">
- <!-- Area for displaying notices -->
- </div>
-
- <div class="studiou-wcpcm-card">
- <h2><?php echo esc_html__('Move products between categories', 'studiou-wc-product-cat-manage'); ?></h2>
-
- <p><?php echo esc_html__('This operation allows you to move all products from one category to another. Products will be removed from the source category and added to the target category.', 'studiou-wc-product-cat-manage'); ?></p>
-
- <form id="studiou-wcpcm-move-form" method="post">
- <table class="form-table">
- <tr>
- <th scope="row">
- <label for="source_category"><?php echo esc_html__('Source Category', 'studiou-wc-product-cat-manage'); ?></label>
- </th>
- <td>
- <select name="source_category" id="source_category" class="regular-text" required>
- <option value=""><?php echo esc_html__('-- Select Source Category --', 'studiou-wc-product-cat-manage'); ?></option>
- <?php foreach ($categories as $category): ?>
- <option value="<?php echo esc_attr($category['id']); ?>">
- <?php echo esc_html($category['display_name']); ?>
- </option>
- <?php endforeach; ?>
- </select>
- <p class="description"><?php echo esc_html__('Select the category from which products will be moved.', 'studiou-wc-product-cat-manage'); ?></p>
- </td>
- </tr>
- <tr>
- <th scope="row">
- <label for="target_category"><?php echo esc_html__('Target Category', 'studiou-wc-product-cat-manage'); ?></label>
- </th>
- <td>
- <select name="target_category" id="target_category" class="regular-text" required>
- <option value=""><?php echo esc_html__('-- Select Target Category --', 'studiou-wc-product-cat-manage'); ?></option>
- <?php foreach ($categories as $category): ?>
- <option value="<?php echo esc_attr($category['id']); ?>">
- <?php echo esc_html($category['display_name']); ?>
- </option>
- <?php endforeach; ?>
- </select>
- <p class="description"><?php echo esc_html__('Select the category to which products will be moved.', 'studiou-wc-product-cat-manage'); ?></p>
- </td>
- </tr>
- </table>
-
- <div class="submit-buttons">
- <button type="submit" class="button button-primary" id="studiou-wcpcm-move-button">
- <?php echo esc_html__('Do', 'studiou-wc-product-cat-manage'); ?>
- </button>
- <span class="spinner"></span>
- </div>
- </form>
-
- <div class="studiou-wcpcm-move-results" style="display: none;">
- <h3><?php echo esc_html__('Move Results', 'studiou-wc-product-cat-manage'); ?></h3>
- <div id="studiou-wcpcm-move-message"></div>
- </div>
- </div>
-
- <!-- Add more manipulation operations here in the future -->
-
- <div class="studiou-wcpcm-card">
- <h2><?php echo esc_html__('Important Notes', 'studiou-wc-product-cat-manage'); ?></h2>
- <ul>
- <li><?php echo esc_html__('Products can be assigned to multiple categories. This operation will remove the product from the source category and add it to the target category.', 'studiou-wc-product-cat-manage'); ?></li>
- <li><?php echo esc_html__('If a product is only assigned to the source category, it will be moved entirely to the target category.', 'studiou-wc-product-cat-manage'); ?></li>
- <li><?php echo esc_html__('If a product is assigned to multiple categories including the source category, it will remain in the other categories and be moved to the target category.', 'studiou-wc-product-cat-manage'); ?></li>
- <li><?php echo esc_html__('The operation processes all products regardless of their status (published, draft, private).', 'studiou-wc-product-cat-manage'); ?></li>
- </ul>
- </div>
- </div>
|