html-product-data-attributes.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. exit;
  4. }
  5. ?>
  6. <div id="product_attributes" class="panel wc-metaboxes-wrapper hidden">
  7. <div class="toolbar toolbar-top">
  8. <span class="expand-close">
  9. <a href="#" class="expand_all"><?php esc_html_e( 'Expand', 'woocommerce' ); ?></a> / <a href="#" class="close_all"><?php esc_html_e( 'Close', 'woocommerce' ); ?></a>
  10. </span>
  11. <select name="attribute_taxonomy" class="attribute_taxonomy">
  12. <option value=""><?php esc_html_e( 'Custom product attribute', 'woocommerce' ); ?></option>
  13. <?php
  14. global $wc_product_attributes;
  15. // Array of defined attribute taxonomies.
  16. $attribute_taxonomies = wc_get_attribute_taxonomies();
  17. if ( ! empty( $attribute_taxonomies ) ) {
  18. foreach ( $attribute_taxonomies as $tax ) {
  19. $attribute_taxonomy_name = wc_attribute_taxonomy_name( $tax->attribute_name );
  20. $label = $tax->attribute_label ? $tax->attribute_label : $tax->attribute_name;
  21. echo '<option value="' . esc_attr( $attribute_taxonomy_name ) . '">' . esc_html( $label ) . '</option>';
  22. }
  23. }
  24. ?>
  25. </select>
  26. <button type="button" class="button add_attribute"><?php esc_html_e( 'Add', 'woocommerce' ); ?></button>
  27. </div>
  28. <div class="product_attributes wc-metaboxes">
  29. <?php
  30. // Product attributes - taxonomies and custom, ordered, with visibility and variation attributes set.
  31. $attributes = $product_object->get_attributes( 'edit' );
  32. $i = -1;
  33. foreach ( $attributes as $attribute ) {
  34. $i++;
  35. $metabox_class = array();
  36. if ( $attribute->is_taxonomy() ) {
  37. $metabox_class[] = 'taxonomy';
  38. $metabox_class[] = $attribute->get_name();
  39. }
  40. include 'html-product-attribute.php';
  41. }
  42. ?>
  43. </div>
  44. <div class="toolbar">
  45. <span class="expand-close">
  46. <a href="#" class="expand_all"><?php esc_html_e( 'Expand', 'woocommerce' ); ?></a> / <a href="#" class="close_all"><?php esc_html_e( 'Close', 'woocommerce' ); ?></a>
  47. </span>
  48. <button type="button" class="button save_attributes button-primary"><?php esc_html_e( 'Save attributes', 'woocommerce' ); ?></button>
  49. </div>
  50. <?php do_action( 'woocommerce_product_options_attributes' ); ?>
  51. </div>