html-product-data-general.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. exit;
  4. }
  5. ?>
  6. <div id="general_product_data" class="panel woocommerce_options_panel">
  7. <div class="options_group show_if_external">
  8. <?php
  9. woocommerce_wp_text_input(
  10. array(
  11. 'id' => '_product_url',
  12. 'value' => is_callable( array( $product_object, 'get_product_url' ) ) ? $product_object->get_product_url( 'edit' ) : '',
  13. 'label' => __( 'Product URL', 'woocommerce' ),
  14. 'placeholder' => 'http://',
  15. 'description' => __( 'Enter the external URL to the product.', 'woocommerce' ),
  16. )
  17. );
  18. woocommerce_wp_text_input(
  19. array(
  20. 'id' => '_button_text',
  21. 'value' => is_callable( array( $product_object, 'get_button_text' ) ) ? $product_object->get_button_text( 'edit' ) : '',
  22. 'label' => __( 'Button text', 'woocommerce' ),
  23. 'placeholder' => _x( 'Buy product', 'placeholder', 'woocommerce' ),
  24. 'description' => __( 'This text will be shown on the button linking to the external product.', 'woocommerce' ),
  25. )
  26. );
  27. ?>
  28. </div>
  29. <div class="options_group pricing show_if_simple show_if_external hidden">
  30. <?php
  31. woocommerce_wp_text_input(
  32. array(
  33. 'id' => '_regular_price',
  34. 'value' => $product_object->get_regular_price( 'edit' ),
  35. 'label' => __( 'Regular price', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')',
  36. 'data_type' => 'price',
  37. )
  38. );
  39. woocommerce_wp_text_input(
  40. array(
  41. 'id' => '_sale_price',
  42. 'value' => $product_object->get_sale_price( 'edit' ),
  43. 'data_type' => 'price',
  44. 'label' => __( 'Sale price', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')',
  45. 'description' => '<a href="#" class="sale_schedule">' . __( 'Schedule', 'woocommerce' ) . '</a>',
  46. )
  47. );
  48. $sale_price_dates_from = $product_object->get_date_on_sale_from( 'edit' ) && ( $date = $product_object->get_date_on_sale_from( 'edit' )->getOffsetTimestamp() ) ? date_i18n( 'Y-m-d', $date ) : '';
  49. $sale_price_dates_to = $product_object->get_date_on_sale_to( 'edit' ) && ( $date = $product_object->get_date_on_sale_to( 'edit' )->getOffsetTimestamp() ) ? date_i18n( 'Y-m-d', $date ) : '';
  50. echo '<p class="form-field sale_price_dates_fields">
  51. <label for="_sale_price_dates_from">' . esc_html__( 'Sale price dates', 'woocommerce' ) . '</label>
  52. <input type="text" class="short" name="_sale_price_dates_from" id="_sale_price_dates_from" value="' . esc_attr( $sale_price_dates_from ) . '" placeholder="' . esc_html( _x( 'From&hellip;', 'placeholder', 'woocommerce' ) ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
  53. <input type="text" class="short" name="_sale_price_dates_to" id="_sale_price_dates_to" value="' . esc_attr( $sale_price_dates_to ) . '" placeholder="' . esc_html( _x( 'To&hellip;', 'placeholder', 'woocommerce' ) ) . ' YYYY-MM-DD" maxlength="10" pattern="' . esc_attr( apply_filters( 'woocommerce_date_input_html_pattern', '[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])' ) ) . '" />
  54. <a href="#" class="description cancel_sale_schedule">' . esc_html__( 'Cancel', 'woocommerce' ) . '</a>' . wc_help_tip( __( 'The sale will end at the beginning of the set date.', 'woocommerce' ) ) . '
  55. </p>';
  56. do_action( 'woocommerce_product_options_pricing' );
  57. ?>
  58. </div>
  59. <div class="options_group show_if_downloadable hidden">
  60. <div class="form-field downloadable_files">
  61. <label><?php esc_html_e( 'Downloadable files', 'woocommerce' ); ?></label>
  62. <table class="widefat">
  63. <thead>
  64. <tr>
  65. <th class="sort">&nbsp;</th>
  66. <th><?php esc_html_e( 'Name', 'woocommerce' ); ?> <?php echo wc_help_tip( __( 'This is the name of the download shown to the customer.', 'woocommerce' ) ); ?></th>
  67. <th colspan="2"><?php esc_html_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>
  68. <th>&nbsp;</th>
  69. </tr>
  70. </thead>
  71. <tbody>
  72. <?php
  73. $downloadable_files = $product_object->get_downloads( 'edit' );
  74. if ( $downloadable_files ) {
  75. foreach ( $downloadable_files as $key => $file ) {
  76. include 'html-product-download.php';
  77. }
  78. }
  79. ?>
  80. </tbody>
  81. <tfoot>
  82. <tr>
  83. <th colspan="5">
  84. <a href="#" class="button insert" data-row="
  85. <?php
  86. $key = '';
  87. $file = array(
  88. 'file' => '',
  89. 'name' => '',
  90. );
  91. ob_start();
  92. require 'html-product-download.php';
  93. echo esc_attr( ob_get_clean() );
  94. ?>
  95. "><?php esc_html_e( 'Add File', 'woocommerce' ); ?></a>
  96. </th>
  97. </tr>
  98. </tfoot>
  99. </table>
  100. </div>
  101. <?php
  102. woocommerce_wp_text_input(
  103. array(
  104. 'id' => '_download_limit',
  105. 'value' => -1 === $product_object->get_download_limit( 'edit' ) ? '' : $product_object->get_download_limit( 'edit' ),
  106. 'label' => __( 'Download limit', 'woocommerce' ),
  107. 'placeholder' => __( 'Unlimited', 'woocommerce' ),
  108. 'description' => __( 'Leave blank for unlimited re-downloads.', 'woocommerce' ),
  109. 'type' => 'number',
  110. 'custom_attributes' => array(
  111. 'step' => '1',
  112. 'min' => '0',
  113. ),
  114. )
  115. );
  116. woocommerce_wp_text_input(
  117. array(
  118. 'id' => '_download_expiry',
  119. 'value' => -1 === $product_object->get_download_expiry( 'edit' ) ? '' : $product_object->get_download_expiry( 'edit' ),
  120. 'label' => __( 'Download expiry', 'woocommerce' ),
  121. 'placeholder' => __( 'Never', 'woocommerce' ),
  122. 'description' => __( 'Enter the number of days before a download link expires, or leave blank.', 'woocommerce' ),
  123. 'type' => 'number',
  124. 'custom_attributes' => array(
  125. 'step' => '1',
  126. 'min' => '0',
  127. ),
  128. )
  129. );
  130. do_action( 'woocommerce_product_options_downloads' );
  131. ?>
  132. </div>
  133. <?php if ( wc_tax_enabled() ) : ?>
  134. <div class="options_group show_if_simple show_if_external show_if_variable">
  135. <?php
  136. woocommerce_wp_select(
  137. array(
  138. 'id' => '_tax_status',
  139. 'value' => $product_object->get_tax_status( 'edit' ),
  140. 'label' => __( 'Tax status', 'woocommerce' ),
  141. 'options' => array(
  142. 'taxable' => __( 'Taxable', 'woocommerce' ),
  143. 'shipping' => __( 'Shipping only', 'woocommerce' ),
  144. 'none' => _x( 'None', 'Tax status', 'woocommerce' ),
  145. ),
  146. 'desc_tip' => 'true',
  147. 'description' => __( 'Define whether or not the entire product is taxable, or just the cost of shipping it.', 'woocommerce' ),
  148. )
  149. );
  150. woocommerce_wp_select(
  151. array(
  152. 'id' => '_tax_class',
  153. 'value' => $product_object->get_tax_class( 'edit' ),
  154. 'label' => __( 'Tax class', 'woocommerce' ),
  155. 'options' => wc_get_product_tax_class_options(),
  156. 'desc_tip' => 'true',
  157. 'description' => __( 'Choose a tax class for this product. Tax classes are used to apply different tax rates specific to certain types of product.', 'woocommerce' ),
  158. )
  159. );
  160. do_action( 'woocommerce_product_options_tax' );
  161. ?>
  162. </div>
  163. <?php endif; ?>
  164. <?php do_action( 'woocommerce_product_options_general_product_data' ); ?>
  165. </div>