html-admin-dashboard-setup.php
5 months ago
html-admin-page-addons-category-nav.php
4 years ago
html-admin-page-product-export.php
1 year ago
html-admin-page-reports.php
2 years ago
html-admin-page-status-logs-db.php
2 years ago
html-admin-page-status-logs.php
2 years ago
html-admin-page-status-report.php
1 month ago
html-admin-page-status-tools.php
2 years ago
html-admin-page-status.php
8 years ago
html-admin-settings.php
1 month ago
html-bulk-edit-product.php
1 year ago
html-email-template-preview.php
1 year ago
html-notice-base-table-missing.php
3 years ago
html-notice-custom.php
8 years ago
html-notice-download-dir-sync-complete.php
2 years ago
html-notice-install.php
5 years ago
html-notice-legacy-shipping.php
11 months ago
html-notice-maxmind-license-key.php
6 years ago
html-notice-no-shipping-methods.php
2 years ago
html-notice-redirect-only-download.php
4 years ago
html-notice-regenerating-lookup-table.php
5 years ago
html-notice-regenerating-thumbnails.php
8 years ago
html-notice-secure-connection.php
2 years ago
html-notice-sync-on-read-disabled.php
3 months ago
html-notice-template-check.php
2 years ago
html-notice-update.php
4 months ago
html-notice-updated.php
7 years ago
html-notice-updating.php
6 years ago
html-notice-uploads-directory-is-unprotected.php
2 years ago
html-notice-wp-php-minimum-requirements.php
2 years ago
html-quick-edit-product.php
1 year ago
html-report-by-date.php
5 years ago
html-bulk-edit-product.php
386 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Admin View: Bulk Edit Products |
| 4 | */ |
| 5 | |
| 6 | use Automattic\WooCommerce\Internal\CostOfGoodsSold\CostOfGoodsSoldController; |
| 7 | use Automattic\WooCommerce\Enums\CatalogVisibility; |
| 8 | use Automattic\WooCommerce\Enums\ProductTaxStatus; |
| 9 | use Automattic\WooCommerce\Utilities\I18nUtil; |
| 10 | |
| 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 12 | exit; // Exit if accessed directly |
| 13 | } |
| 14 | |
| 15 | ?> |
| 16 | |
| 17 | <fieldset class="inline-edit-col-right"> |
| 18 | <div id="woocommerce-fields-bulk" class="inline-edit-col"> |
| 19 | |
| 20 | <h4><?php _e( 'Product data', 'woocommerce' ); ?></h4> |
| 21 | |
| 22 | <?php do_action( 'woocommerce_product_bulk_edit_start' ); ?> |
| 23 | |
| 24 | <div class="inline-edit-group"> |
| 25 | <label class="alignleft"> |
| 26 | <span class="title"><?php _e( 'Price', 'woocommerce' ); ?></span> |
| 27 | <span class="input-text-wrap"> |
| 28 | <select class="change_regular_price change_to" name="change_regular_price"> |
| 29 | <?php |
| 30 | $options = array( |
| 31 | '' => __( '— No change —', 'woocommerce' ), |
| 32 | '1' => __( 'Change to:', 'woocommerce' ), |
| 33 | '2' => __( 'Increase existing price by (fixed amount or %):', 'woocommerce' ), |
| 34 | '3' => __( 'Decrease existing price by (fixed amount or %):', 'woocommerce' ), |
| 35 | ); |
| 36 | foreach ( $options as $key => $value ) { |
| 37 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 38 | } |
| 39 | ?> |
| 40 | </select> |
| 41 | </span> |
| 42 | </label> |
| 43 | <label class="change-input"> |
| 44 | <input type="text" name="_regular_price" class="text regular_price" placeholder="<?php printf( esc_attr__( 'Enter price (%s)', 'woocommerce' ), get_woocommerce_currency_symbol() ); ?>" value="" /> |
| 45 | </label> |
| 46 | </div> |
| 47 | |
| 48 | <div class="inline-edit-group"> |
| 49 | <label class="alignleft"> |
| 50 | <span class="title"><?php _e( 'Sale', 'woocommerce' ); ?></span> |
| 51 | <span class="input-text-wrap"> |
| 52 | <select class="change_sale_price change_to" name="change_sale_price"> |
| 53 | <?php |
| 54 | $options = array( |
| 55 | '' => __( '— No change —', 'woocommerce' ), |
| 56 | '1' => __( 'Change to:', 'woocommerce' ), |
| 57 | '2' => __( 'Increase existing sale price by (fixed amount or %):', 'woocommerce' ), |
| 58 | '3' => __( 'Decrease existing sale price by (fixed amount or %):', 'woocommerce' ), |
| 59 | '4' => __( 'Set to regular price decreased by (fixed amount or %):', 'woocommerce' ), |
| 60 | ); |
| 61 | foreach ( $options as $key => $value ) { |
| 62 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 63 | } |
| 64 | ?> |
| 65 | </select> |
| 66 | </span> |
| 67 | </label> |
| 68 | <label class="change-input"> |
| 69 | <input type="text" name="_sale_price" class="text sale_price" placeholder="<?php printf( esc_attr__( 'Enter sale price (%s)', 'woocommerce' ), get_woocommerce_currency_symbol() ); ?>" value="" /> |
| 70 | </label> |
| 71 | </div> |
| 72 | |
| 73 | <?php if ( wc_get_container()->get( CostOfGoodsSoldController::class )->feature_is_enabled() ) : ?> |
| 74 | <div class="inline-edit-group"> |
| 75 | <label class="alignleft"> |
| 76 | <span class="title"><?php esc_html_e( 'Cost', 'woocommerce' ); ?></span> |
| 77 | <span class="input-text-wrap"> |
| 78 | <select class="change_cogs_value change_to" name="change_cogs_value"> |
| 79 | <?php |
| 80 | $options = array( |
| 81 | '' => __( '— No change —', 'woocommerce' ), |
| 82 | '1' => __( 'Change to:', 'woocommerce' ), |
| 83 | ); |
| 84 | foreach ( $options as $key => $value ) { |
| 85 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 86 | } |
| 87 | ?> |
| 88 | </select> |
| 89 | </span> |
| 90 | </label> |
| 91 | <label class="change-input"> |
| 92 | <?php /* phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- the esc_attr is somehow not detected */ ?> |
| 93 | <?php /* translators: %s = cost value (formatted as currency) */ ?> |
| 94 | <input type="text" name="_cogs_value" class="text cogs_value" placeholder="<?php esc_attr( printf( __( 'Enter cost value (%s)', 'woocommerce' ), get_woocommerce_currency_symbol() ) ); ?>" value="" /> |
| 95 | <?php /* phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped */ ?> |
| 96 | </label> |
| 97 | <div class="inline-edit-group"> |
| 98 | <?php endif; ?> |
| 99 | |
| 100 | <?php if ( wc_tax_enabled() ) : ?> |
| 101 | <label> |
| 102 | <span class="title"><?php _e( 'Tax status', 'woocommerce' ); ?></span> |
| 103 | <span class="input-text-wrap"> |
| 104 | <select class="tax_status" name="_tax_status"> |
| 105 | <?php |
| 106 | $options = array( |
| 107 | '' => __( '— No change —', 'woocommerce' ), |
| 108 | ProductTaxStatus::TAXABLE => __( 'Taxable', 'woocommerce' ), |
| 109 | ProductTaxStatus::SHIPPING => __( 'Shipping only', 'woocommerce' ), |
| 110 | ProductTaxStatus::NONE => _x( 'None', 'Tax status', 'woocommerce' ), |
| 111 | ); |
| 112 | foreach ( $options as $key => $value ) { |
| 113 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 114 | } |
| 115 | ?> |
| 116 | </select> |
| 117 | </span> |
| 118 | </label> |
| 119 | |
| 120 | <label> |
| 121 | <span class="title"><?php _e( 'Tax class', 'woocommerce' ); ?></span> |
| 122 | <span class="input-text-wrap"> |
| 123 | <select class="tax_class" name="_tax_class"> |
| 124 | <?php |
| 125 | $options = array( |
| 126 | '' => __( '— No change —', 'woocommerce' ), |
| 127 | 'standard' => __( 'Standard', 'woocommerce' ), |
| 128 | ); |
| 129 | |
| 130 | $tax_classes = WC_Tax::get_tax_classes(); |
| 131 | |
| 132 | if ( ! empty( $tax_classes ) ) { |
| 133 | foreach ( $tax_classes as $class ) { |
| 134 | $options[ sanitize_title( $class ) ] = esc_html( $class ); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | foreach ( $options as $key => $value ) { |
| 139 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 140 | } |
| 141 | ?> |
| 142 | </select> |
| 143 | </span> |
| 144 | </label> |
| 145 | <?php endif; ?> |
| 146 | |
| 147 | <?php if ( wc_product_weight_enabled() ) : ?> |
| 148 | <div class="inline-edit-group"> |
| 149 | <label class="alignleft"> |
| 150 | <span class="title"><?php _e( 'Weight', 'woocommerce' ); ?></span> |
| 151 | <span class="input-text-wrap"> |
| 152 | <select class="change_weight change_to" name="change_weight"> |
| 153 | <?php |
| 154 | $options = array( |
| 155 | '' => __( '— No change —', 'woocommerce' ), |
| 156 | '1' => __( 'Change to:', 'woocommerce' ), |
| 157 | ); |
| 158 | foreach ( $options as $key => $value ) { |
| 159 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 160 | } |
| 161 | ?> |
| 162 | </select> |
| 163 | </span> |
| 164 | </label> |
| 165 | <label class="change-input"> |
| 166 | <?php |
| 167 | $placeholder = sprintf( |
| 168 | /* translators: 1. Weight number; 2. Weight unit; E.g. 2 kg */ |
| 169 | __( '%1$s (%2$s)', 'woocommerce' ), |
| 170 | wc_format_localized_decimal( 0 ), |
| 171 | I18nUtil::get_weight_unit_label( get_option( 'woocommerce_weight_unit', 'kg' ) ) |
| 172 | ); |
| 173 | ?> |
| 174 | <input |
| 175 | type="text" |
| 176 | name="_weight" |
| 177 | class="text weight" |
| 178 | placeholder="<?php echo esc_attr( $placeholder ); ?>" |
| 179 | value="" |
| 180 | > |
| 181 | </label> |
| 182 | </div> |
| 183 | <?php endif; ?> |
| 184 | |
| 185 | <?php if ( wc_product_dimensions_enabled() ) : ?> |
| 186 | <div class="inline-edit-group dimensions"> |
| 187 | <label class="alignleft"> |
| 188 | <span class="title"><?php _e( 'L/W/H', 'woocommerce' ); ?></span> |
| 189 | <span class="input-text-wrap"> |
| 190 | <select class="change_dimensions change_to" name="change_dimensions"> |
| 191 | <?php |
| 192 | $options = array( |
| 193 | '' => __( '— No change —', 'woocommerce' ), |
| 194 | '1' => __( 'Change to:', 'woocommerce' ), |
| 195 | ); |
| 196 | foreach ( $options as $key => $value ) { |
| 197 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 198 | } |
| 199 | ?> |
| 200 | </select> |
| 201 | </span> |
| 202 | </label> |
| 203 | <label class="change-input"> |
| 204 | <?php |
| 205 | $dimension_unit_label = I18nUtil::get_dimensions_unit_label( get_option( 'woocommerce_dimension_unit', 'cm' ) ); |
| 206 | ?> |
| 207 | <input |
| 208 | type="text" |
| 209 | name="_length" |
| 210 | class="text length" |
| 211 | <?php /* translators: %s is dimension unit label */ ?> |
| 212 | placeholder="<?php printf( esc_attr__( 'Length (%s)', 'woocommerce' ), esc_html( $dimension_unit_label ) ); ?>" |
| 213 | value="" |
| 214 | > |
| 215 | <input |
| 216 | type="text" |
| 217 | name="_width" |
| 218 | class="text width" |
| 219 | <?php /* translators: %s is dimension unit label */ ?> |
| 220 | placeholder="<?php printf( esc_attr__( 'Width (%s)', 'woocommerce' ), esc_html( $dimension_unit_label ) ); ?>" |
| 221 | value="" |
| 222 | > |
| 223 | <input |
| 224 | type="text" |
| 225 | name="_height" |
| 226 | class="text height" |
| 227 | <?php /* translators: %s is dimension unit label */ ?> |
| 228 | placeholder="<?php printf( esc_attr__( 'Height (%s)', 'woocommerce' ), esc_html( $dimension_unit_label ) ); ?>" |
| 229 | value="" |
| 230 | > |
| 231 | </label> |
| 232 | </div> |
| 233 | <?php endif; ?> |
| 234 | |
| 235 | <label> |
| 236 | <span class="title"><?php _e( 'Shipping class', 'woocommerce' ); ?></span> |
| 237 | <span class="input-text-wrap"> |
| 238 | <select class="shipping_class" name="_shipping_class"> |
| 239 | <option value=""><?php _e( '— No change —', 'woocommerce' ); ?></option> |
| 240 | <option value="_no_shipping_class"><?php _e( 'No shipping class', 'woocommerce' ); ?></option> |
| 241 | <?php |
| 242 | foreach ( $shipping_class as $key => $value ) { |
| 243 | echo '<option value="' . esc_attr( $value->slug ) . '">' . esc_html( $value->name ) . '</option>'; |
| 244 | } |
| 245 | ?> |
| 246 | </select> |
| 247 | </span> |
| 248 | </label> |
| 249 | |
| 250 | <label> |
| 251 | <span class="title"><?php _e( 'Visibility', 'woocommerce' ); ?></span> |
| 252 | <span class="input-text-wrap"> |
| 253 | <select class="visibility" name="_visibility"> |
| 254 | <?php |
| 255 | $options = array( |
| 256 | '' => __( '— No change —', 'woocommerce' ), |
| 257 | CatalogVisibility::VISIBLE => __( 'Catalog & search', 'woocommerce' ), |
| 258 | CatalogVisibility::CATALOG => __( 'Catalog', 'woocommerce' ), |
| 259 | CatalogVisibility::SEARCH => __( 'Search', 'woocommerce' ), |
| 260 | CatalogVisibility::HIDDEN => __( 'Hidden', 'woocommerce' ), |
| 261 | ); |
| 262 | foreach ( $options as $key => $value ) { |
| 263 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 264 | } |
| 265 | ?> |
| 266 | </select> |
| 267 | </span> |
| 268 | </label> |
| 269 | <label> |
| 270 | <span class="title"><?php _e( 'Featured', 'woocommerce' ); ?></span> |
| 271 | <span class="input-text-wrap"> |
| 272 | <select class="featured" name="_featured"> |
| 273 | <?php |
| 274 | $options = array( |
| 275 | '' => __( '— No change —', 'woocommerce' ), |
| 276 | 'yes' => __( 'Yes', 'woocommerce' ), |
| 277 | 'no' => __( 'No', 'woocommerce' ), |
| 278 | ); |
| 279 | foreach ( $options as $key => $value ) { |
| 280 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 281 | } |
| 282 | ?> |
| 283 | </select> |
| 284 | </span> |
| 285 | </label> |
| 286 | |
| 287 | <label> |
| 288 | <span class="title"><?php _e( 'In stock?', 'woocommerce' ); ?></span> |
| 289 | <span class="input-text-wrap"> |
| 290 | <select class="stock_status" name="_stock_status"> |
| 291 | <?php |
| 292 | echo '<option value="">' . esc_html__( '— No Change —', 'woocommerce' ) . '</option>'; |
| 293 | |
| 294 | foreach ( wc_get_product_stock_status_options() as $key => $value ) { |
| 295 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 296 | } |
| 297 | ?> |
| 298 | </select> |
| 299 | </span> |
| 300 | </label> |
| 301 | <?php if ( 'yes' == get_option( 'woocommerce_manage_stock' ) ) : ?> |
| 302 | |
| 303 | <label> |
| 304 | <span class="title"><?php _e( 'Manage stock?', 'woocommerce' ); ?></span> |
| 305 | <span class="input-text-wrap"> |
| 306 | <select class="manage_stock" name="_manage_stock"> |
| 307 | <?php |
| 308 | $options = array( |
| 309 | '' => __( '— No change —', 'woocommerce' ), |
| 310 | 'yes' => __( 'Yes', 'woocommerce' ), |
| 311 | 'no' => __( 'No', 'woocommerce' ), |
| 312 | ); |
| 313 | foreach ( $options as $key => $value ) { |
| 314 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 315 | } |
| 316 | ?> |
| 317 | </select> |
| 318 | </span> |
| 319 | </label> |
| 320 | |
| 321 | <div class="inline-edit-group"> |
| 322 | <label class="alignleft stock_qty_field"> |
| 323 | <span class="title"><?php _e( 'Stock qty', 'woocommerce' ); ?></span> |
| 324 | <span class="input-text-wrap"> |
| 325 | <select class="change_stock change_to" name="change_stock"> |
| 326 | <?php |
| 327 | $options = array( |
| 328 | '' => __( '— No change —', 'woocommerce' ), |
| 329 | '1' => __( 'Change to:', 'woocommerce' ), |
| 330 | '2' => __( 'Increase existing stock by:', 'woocommerce' ), |
| 331 | '3' => __( 'Decrease existing stock by:', 'woocommerce' ), |
| 332 | ); |
| 333 | foreach ( $options as $key => $value ) { |
| 334 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 335 | } |
| 336 | ?> |
| 337 | </select> |
| 338 | </span> |
| 339 | </label> |
| 340 | <label class="change-input"> |
| 341 | <input type="text" name="_stock" class="text stock" placeholder="<?php esc_attr_e( 'Stock qty', 'woocommerce' ); ?>" step="any" value=""> |
| 342 | </label> |
| 343 | </div> |
| 344 | |
| 345 | <label> |
| 346 | <span class="title"><?php _e( 'Backorders?', 'woocommerce' ); ?></span> |
| 347 | <span class="input-text-wrap"> |
| 348 | <select class="backorders" name="_backorders"> |
| 349 | <?php |
| 350 | echo '<option value="">' . esc_html__( '— No Change —', 'woocommerce' ) . '</option>'; |
| 351 | |
| 352 | foreach ( wc_get_product_backorder_options() as $key => $value ) { |
| 353 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 354 | } |
| 355 | ?> |
| 356 | </select> |
| 357 | </span> |
| 358 | </label> |
| 359 | |
| 360 | <?php endif; ?> |
| 361 | |
| 362 | <label> |
| 363 | <span class="title"><?php esc_html_e( 'Sold individually?', 'woocommerce' ); ?></span> |
| 364 | <span class="input-text-wrap"> |
| 365 | <select class="sold_individually" name="_sold_individually"> |
| 366 | <?php |
| 367 | $options = array( |
| 368 | '' => __( '— No change —', 'woocommerce' ), |
| 369 | 'yes' => __( 'Yes', 'woocommerce' ), |
| 370 | 'no' => __( 'No', 'woocommerce' ), |
| 371 | ); |
| 372 | foreach ( $options as $key => $value ) { |
| 373 | echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>'; |
| 374 | } |
| 375 | ?> |
| 376 | </select> |
| 377 | </span> |
| 378 | </label> |
| 379 | |
| 380 | <?php do_action( 'woocommerce_product_bulk_edit_end' ); ?> |
| 381 | |
| 382 | <input type="hidden" name="woocommerce_bulk_edit" value="1" /> |
| 383 | <input type="hidden" name="woocommerce_quick_edit_nonce" value="<?php echo wp_create_nonce( 'woocommerce_quick_edit_nonce' ); ?>" /> |
| 384 | </div> |
| 385 | </fieldset> |
| 386 |