html-bulk-edit-product.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <?php
  2. /**
  3. * Admin View: Bulk Edit Products
  4. */
  5. if ( ! defined( 'ABSPATH' ) ) {
  6. exit; // Exit if accessed directly
  7. }
  8. ?>
  9. <fieldset class="inline-edit-col-right">
  10. <div id="woocommerce-fields-bulk" class="inline-edit-col">
  11. <h4><?php _e( 'Product data', 'woocommerce' ); ?></h4>
  12. <?php do_action( 'woocommerce_product_bulk_edit_start' ); ?>
  13. <div class="inline-edit-group">
  14. <label class="alignleft">
  15. <span class="title"><?php _e( 'Price', 'woocommerce' ); ?></span>
  16. <span class="input-text-wrap">
  17. <select class="change_regular_price change_to" name="change_regular_price">
  18. <?php
  19. $options = array(
  20. '' => __( '— No change —', 'woocommerce' ),
  21. '1' => __( 'Change to:', 'woocommerce' ),
  22. '2' => __( 'Increase existing price by (fixed amount or %):', 'woocommerce' ),
  23. '3' => __( 'Decrease existing price by (fixed amount or %):', 'woocommerce' ),
  24. );
  25. foreach ( $options as $key => $value ) {
  26. echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
  27. }
  28. ?>
  29. </select>
  30. </span>
  31. </label>
  32. <label class="change-input">
  33. <input type="text" name="_regular_price" class="text regular_price" placeholder="<?php printf( esc_attr__( 'Enter price (%s)', 'woocommerce' ), get_woocommerce_currency_symbol() ); ?>" value="" />
  34. </label>
  35. </div>
  36. <div class="inline-edit-group">
  37. <label class="alignleft">
  38. <span class="title"><?php _e( 'Sale', 'woocommerce' ); ?></span>
  39. <span class="input-text-wrap">
  40. <select class="change_sale_price change_to" name="change_sale_price">
  41. <?php
  42. $options = array(
  43. '' => __( '— No change —', 'woocommerce' ),
  44. '1' => __( 'Change to:', 'woocommerce' ),
  45. '2' => __( 'Increase existing sale price by (fixed amount or %):', 'woocommerce' ),
  46. '3' => __( 'Decrease existing sale price by (fixed amount or %):', 'woocommerce' ),
  47. '4' => __( 'Set to regular price decreased by (fixed amount or %):', 'woocommerce' ),
  48. );
  49. foreach ( $options as $key => $value ) {
  50. echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
  51. }
  52. ?>
  53. </select>
  54. </span>
  55. </label>
  56. <label class="change-input">
  57. <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="" />
  58. </label>
  59. </div>
  60. <?php if ( wc_tax_enabled() ) : ?>
  61. <label>
  62. <span class="title"><?php _e( 'Tax status', 'woocommerce' ); ?></span>
  63. <span class="input-text-wrap">
  64. <select class="tax_status" name="_tax_status">
  65. <?php
  66. $options = array(
  67. '' => __( '— No change —', 'woocommerce' ),
  68. 'taxable' => __( 'Taxable', 'woocommerce' ),
  69. 'shipping' => __( 'Shipping only', 'woocommerce' ),
  70. 'none' => _x( 'None', 'Tax status', 'woocommerce' ),
  71. );
  72. foreach ( $options as $key => $value ) {
  73. echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
  74. }
  75. ?>
  76. </select>
  77. </span>
  78. </label>
  79. <label>
  80. <span class="title"><?php _e( 'Tax class', 'woocommerce' ); ?></span>
  81. <span class="input-text-wrap">
  82. <select class="tax_class" name="_tax_class">
  83. <?php
  84. $options = array(
  85. '' => __( '— No change —', 'woocommerce' ),
  86. 'standard' => __( 'Standard', 'woocommerce' ),
  87. );
  88. $tax_classes = WC_Tax::get_tax_classes();
  89. if ( ! empty( $tax_classes ) ) {
  90. foreach ( $tax_classes as $class ) {
  91. $options[ sanitize_title( $class ) ] = esc_html( $class );
  92. }
  93. }
  94. foreach ( $options as $key => $value ) {
  95. echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
  96. }
  97. ?>
  98. </select>
  99. </span>
  100. </label>
  101. <?php endif; ?>
  102. <?php if ( wc_product_weight_enabled() ) : ?>
  103. <div class="inline-edit-group">
  104. <label class="alignleft">
  105. <span class="title"><?php _e( 'Weight', 'woocommerce' ); ?></span>
  106. <span class="input-text-wrap">
  107. <select class="change_weight change_to" name="change_weight">
  108. <?php
  109. $options = array(
  110. '' => __( '— No change —', 'woocommerce' ),
  111. '1' => __( 'Change to:', 'woocommerce' ),
  112. );
  113. foreach ( $options as $key => $value ) {
  114. echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
  115. }
  116. ?>
  117. </select>
  118. </span>
  119. </label>
  120. <label class="change-input">
  121. <input type="text" name="_weight" class="text weight" placeholder="<?php printf( esc_attr__( '%1$s (%2$s)', 'woocommerce' ), wc_format_localized_decimal( 0 ), get_option( 'woocommerce_weight_unit' ) ); ?>" value="">
  122. </label>
  123. </div>
  124. <?php endif; ?>
  125. <?php if ( wc_product_dimensions_enabled() ) : ?>
  126. <div class="inline-edit-group dimensions">
  127. <label class="alignleft">
  128. <span class="title"><?php _e( 'L/W/H', 'woocommerce' ); ?></span>
  129. <span class="input-text-wrap">
  130. <select class="change_dimensions change_to" name="change_dimensions">
  131. <?php
  132. $options = array(
  133. '' => __( '— No change —', 'woocommerce' ),
  134. '1' => __( 'Change to:', 'woocommerce' ),
  135. );
  136. foreach ( $options as $key => $value ) {
  137. echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
  138. }
  139. ?>
  140. </select>
  141. </span>
  142. </label>
  143. <label class="change-input">
  144. <input type="text" name="_length" class="text length" placeholder="<?php printf( esc_attr__( 'Length (%s)', 'woocommerce' ), get_option( 'woocommerce_dimension_unit' ) ); ?>" value="">
  145. <input type="text" name="_width" class="text width" placeholder="<?php printf( esc_attr__( 'Width (%s)', 'woocommerce' ), get_option( 'woocommerce_dimension_unit' ) ); ?>" value="">
  146. <input type="text" name="_height" class="text height" placeholder="<?php printf( esc_attr__( 'Height (%s)', 'woocommerce' ), get_option( 'woocommerce_dimension_unit' ) ); ?>" value="">
  147. </label>
  148. </div>
  149. <?php endif; ?>
  150. <label>
  151. <span class="title"><?php _e( 'Shipping class', 'woocommerce' ); ?></span>
  152. <span class="input-text-wrap">
  153. <select class="shipping_class" name="_shipping_class">
  154. <option value=""><?php _e( '— No change —', 'woocommerce' ); ?></option>
  155. <option value="_no_shipping_class"><?php _e( 'No shipping class', 'woocommerce' ); ?></option>
  156. <?php
  157. foreach ( $shipping_class as $key => $value ) {
  158. echo '<option value="' . esc_attr( $value->slug ) . '">' . $value->name . '</option>';
  159. }
  160. ?>
  161. </select>
  162. </span>
  163. </label>
  164. <label>
  165. <span class="title"><?php _e( 'Visibility', 'woocommerce' ); ?></span>
  166. <span class="input-text-wrap">
  167. <select class="visibility" name="_visibility">
  168. <?php
  169. $options = array(
  170. '' => __( '— No change —', 'woocommerce' ),
  171. 'visible' => __( 'Catalog &amp; search', 'woocommerce' ),
  172. 'catalog' => __( 'Catalog', 'woocommerce' ),
  173. 'search' => __( 'Search', 'woocommerce' ),
  174. 'hidden' => __( 'Hidden', 'woocommerce' ),
  175. );
  176. foreach ( $options as $key => $value ) {
  177. echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
  178. }
  179. ?>
  180. </select>
  181. </span>
  182. </label>
  183. <label>
  184. <span class="title"><?php _e( 'Featured', 'woocommerce' ); ?></span>
  185. <span class="input-text-wrap">
  186. <select class="featured" name="_featured">
  187. <?php
  188. $options = array(
  189. '' => __( '— No change —', 'woocommerce' ),
  190. 'yes' => __( 'Yes', 'woocommerce' ),
  191. 'no' => __( 'No', 'woocommerce' ),
  192. );
  193. foreach ( $options as $key => $value ) {
  194. echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
  195. }
  196. ?>
  197. </select>
  198. </span>
  199. </label>
  200. <label>
  201. <span class="title"><?php _e( 'In stock?', 'woocommerce' ); ?></span>
  202. <span class="input-text-wrap">
  203. <select class="stock_status" name="_stock_status">
  204. <?php
  205. echo '<option value="">' . esc_html__( '— No Change —', 'woocommerce' ) . '</option>';
  206. foreach ( wc_get_product_stock_status_options() as $key => $value ) {
  207. echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
  208. }
  209. ?>
  210. </select>
  211. </span>
  212. </label>
  213. <?php if ( 'yes' == get_option( 'woocommerce_manage_stock' ) ) : ?>
  214. <label>
  215. <span class="title"><?php _e( 'Manage stock?', 'woocommerce' ); ?></span>
  216. <span class="input-text-wrap">
  217. <select class="manage_stock" name="_manage_stock">
  218. <?php
  219. $options = array(
  220. '' => __( '— No change —', 'woocommerce' ),
  221. 'yes' => __( 'Yes', 'woocommerce' ),
  222. 'no' => __( 'No', 'woocommerce' ),
  223. );
  224. foreach ( $options as $key => $value ) {
  225. echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
  226. }
  227. ?>
  228. </select>
  229. </span>
  230. </label>
  231. <div class="inline-edit-group">
  232. <label class="alignleft stock_qty_field">
  233. <span class="title"><?php _e( 'Stock qty', 'woocommerce' ); ?></span>
  234. <span class="input-text-wrap">
  235. <select class="change_stock change_to" name="change_stock">
  236. <?php
  237. $options = array(
  238. '' => __( '— No change —', 'woocommerce' ),
  239. '1' => __( 'Change to:', 'woocommerce' ),
  240. );
  241. foreach ( $options as $key => $value ) {
  242. echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
  243. }
  244. ?>
  245. </select>
  246. </span>
  247. </label>
  248. <label class="change-input">
  249. <input type="text" name="_stock" class="text stock" placeholder="<?php esc_attr_e( 'Stock qty', 'woocommerce' ); ?>" step="any" value="">
  250. </label>
  251. </div>
  252. <label>
  253. <span class="title"><?php _e( 'Backorders?', 'woocommerce' ); ?></span>
  254. <span class="input-text-wrap">
  255. <select class="backorders" name="_backorders">
  256. <?php
  257. echo '<option value="">' . esc_html__( '— No Change —', 'woocommerce' ) . '</option>';
  258. foreach ( wc_get_product_backorder_options() as $key => $value ) {
  259. echo '<option value="' . esc_attr( $key ) . '">' . $value . '</option>';
  260. }
  261. ?>
  262. </select>
  263. </span>
  264. </label>
  265. <?php endif; ?>
  266. <label>
  267. <span class="title"><?php esc_html_e( 'Sold individually?', 'woocommerce' ); ?></span>
  268. <span class="input-text-wrap">
  269. <select class="sold_individually" name="_sold_individually">
  270. <?php
  271. $options = array(
  272. '' => __( '— No change —', 'woocommerce' ),
  273. 'yes' => __( 'Yes', 'woocommerce' ),
  274. 'no' => __( 'No', 'woocommerce' ),
  275. );
  276. foreach ( $options as $key => $value ) {
  277. echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>';
  278. }
  279. ?>
  280. </select>
  281. </span>
  282. </label>
  283. <?php do_action( 'woocommerce_product_bulk_edit_end' ); ?>
  284. <input type="hidden" name="woocommerce_bulk_edit" value="1" />
  285. <input type="hidden" name="woocommerce_quick_edit_nonce" value="<?php echo wp_create_nonce( 'woocommerce_quick_edit_nonce' ); ?>" />
  286. </div>
  287. </fieldset>