html-order-download-permission.php
6 years ago
html-order-fee.php
3 months ago
html-order-item-meta.php
4 years ago
html-order-item.php
9 months ago
html-order-items.php
1 month ago
html-order-notes.php
1 month ago
html-order-refund.php
3 months ago
html-order-shipping.php
3 months ago
html-product-attribute-inner.php
1 month ago
html-product-attribute.php
3 years ago
html-product-data-advanced.php
5 months ago
html-product-data-attributes.php
1 month ago
html-product-data-general.php
2 months ago
html-product-data-inventory.php
4 months ago
html-product-data-linked-products.php
3 months ago
html-product-data-panel.php
1 year ago
html-product-data-shipping.php
3 years ago
html-product-data-variations.php
1 month ago
html-product-download.php
4 months ago
html-product-variation-download.php
4 months ago
html-variation-admin.php
1 month ago
html-product-attribute-inner.php
122 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Product attribute table for reuse. |
| 4 | * |
| 5 | * @package WooCommerce\Admin |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; |
| 10 | } |
| 11 | ?> |
| 12 | |
| 13 | <table cellpadding="0" cellspacing="0"> |
| 14 | <tbody> |
| 15 | <tr> |
| 16 | <td class="attribute_name"> |
| 17 | <label><?php esc_html_e( 'Name', 'woocommerce' ); ?>:</label> |
| 18 | |
| 19 | <?php if ( $attribute->is_taxonomy() ) : ?> |
| 20 | <strong><?php echo esc_html( wc_attribute_label( $attribute->get_name() ) ); ?></strong> |
| 21 | <input type="hidden" name="attribute_names[<?php echo esc_attr( $i ); ?>]" value="<?php echo esc_attr( $attribute->get_name() ); ?>" /> |
| 22 | <?php else : ?> |
| 23 | <input type="text" class="attribute_name" name="attribute_names[<?php echo esc_attr( $i ); ?>]" value="<?php echo esc_attr( $attribute->get_name() ); ?>" placeholder="<?php esc_attr_e( 'e.g. length or weight', 'woocommerce' ); ?>" /> |
| 24 | <?php endif; ?> |
| 25 | <input type="hidden" name="attribute_position[<?php echo esc_attr( $i ); ?>]" class="attribute_position" value="<?php echo esc_attr( $attribute->get_position() ); ?>" /> |
| 26 | </td> |
| 27 | <td rowspan="3"> |
| 28 | <label><?php esc_html_e( 'Value(s)', 'woocommerce' ); ?>:</label> |
| 29 | <?php |
| 30 | if ( $attribute->is_taxonomy() && $attribute->get_taxonomy_object() ) { |
| 31 | $attribute_taxonomy = $attribute->get_taxonomy_object(); |
| 32 | $attribute_types = wc_get_attribute_types(); |
| 33 | |
| 34 | if ( ! array_key_exists( $attribute_taxonomy->attribute_type, $attribute_types ) ) { |
| 35 | $attribute_taxonomy->attribute_type = 'select'; |
| 36 | } |
| 37 | |
| 38 | if ( |
| 39 | 'select' === $attribute_taxonomy->attribute_type || |
| 40 | 'wc-visual' === $attribute_taxonomy->attribute_type |
| 41 | ) { |
| 42 | $attribute_orderby = ! empty( $attribute_taxonomy->attribute_orderby ) ? $attribute_taxonomy->attribute_orderby : 'name'; |
| 43 | /** |
| 44 | * Filter the length (number of terms) rendered in the list. |
| 45 | * |
| 46 | * @since 8.8.0 |
| 47 | * @param int $term_limit The maximum number of terms to display in the list. |
| 48 | */ |
| 49 | $term_limit = absint( apply_filters( 'woocommerce_admin_terms_metabox_datalimit', 50 ) ); |
| 50 | ?> |
| 51 | <select multiple="multiple" |
| 52 | data-minimum_input_length="0" |
| 53 | data-limit="<?php echo esc_attr( $term_limit ); ?>" data-return_id="id" |
| 54 | data-placeholder="<?php esc_attr_e( 'Select values', 'woocommerce' ); ?>" |
| 55 | data-orderby="<?php echo esc_attr( $attribute_orderby ); ?>" |
| 56 | class="multiselect attribute_values wc-taxonomy-term-search" |
| 57 | name="attribute_values[<?php echo esc_attr( $i ); ?>][]" |
| 58 | data-taxonomy="<?php echo esc_attr( $attribute->get_taxonomy() ); ?>"> |
| 59 | <?php |
| 60 | $selected_terms = $attribute->get_terms(); |
| 61 | if ( $selected_terms ) { |
| 62 | foreach ( $selected_terms as $selected_term ) { |
| 63 | /** |
| 64 | * Filter the selected attribute term name. |
| 65 | * |
| 66 | * @since 3.4.0 |
| 67 | * @param string $name Name of selected term. |
| 68 | * @param array $term The selected term object. |
| 69 | */ |
| 70 | echo '<option value="' . esc_attr( $selected_term->term_id ) . '" selected="selected">' . esc_html( apply_filters( 'woocommerce_product_attribute_term_name', $selected_term->name, $selected_term ) ) . '</option>'; |
| 71 | } |
| 72 | } |
| 73 | ?> |
| 74 | </select> |
| 75 | <button class="button plus select_all_attributes"><?php esc_html_e( 'Select all', 'woocommerce' ); ?></button> |
| 76 | <button class="button minus select_no_attributes"><?php esc_html_e( 'Select none', 'woocommerce' ); ?></button> |
| 77 | <button class="button fr plus add_new_attribute" data-is-visual-attribute="<?php echo esc_attr( wc_bool_to_string( 'wc-visual' === $attribute_taxonomy->attribute_type ) ); ?>"><?php esc_html_e( 'Create value', 'woocommerce' ); ?></button> |
| 78 | <?php |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Hook to display custom attribute terms. |
| 83 | * |
| 84 | * @since 3.4.0 |
| 85 | * @param array|null $attribute_taxonomy Attribute taxonomy object. |
| 86 | * @param int $i Attribute index. |
| 87 | * @param WC_Product_Attribute $attribute Attribute object. |
| 88 | */ |
| 89 | do_action( 'woocommerce_product_option_terms', $attribute_taxonomy, $i, $attribute ); |
| 90 | } else { |
| 91 | ?> |
| 92 | <textarea name="attribute_values[<?php echo esc_attr( $i ); ?>]" cols="5" rows="5"><?php echo esc_textarea( wc_implode_text_attributes( $attribute->get_options() ) ); ?></textarea> |
| 93 | <?php |
| 94 | } |
| 95 | ?> |
| 96 | </td> |
| 97 | </tr> |
| 98 | <tr> |
| 99 | <td> |
| 100 | <label><input type="checkbox" class="woocommerce_attribute_visible_on_product_page checkbox" <?php checked( $attribute->get_visible(), true ); ?> name="attribute_visibility[<?php echo esc_attr( $i ); ?>]" value="1" /> <?php esc_html_e( 'Visible on the product page', 'woocommerce' ); ?></label> |
| 101 | </td> |
| 102 | </tr> |
| 103 | <tr> |
| 104 | <td> |
| 105 | <div class="enable_variation show_if_variable"> |
| 106 | <label><input type="checkbox" class="woocommerce_attribute_used_for_variations checkbox" <?php checked( $attribute->get_variation(), true ); ?> name="attribute_variation[<?php echo esc_attr( $i ); ?>]" value="1" /> <?php esc_html_e( 'Used for variations', 'woocommerce' ); ?></label> |
| 107 | </div> |
| 108 | </td> |
| 109 | </tr> |
| 110 | <?php |
| 111 | /** |
| 112 | * Hook to display custom attribute terms. |
| 113 | * |
| 114 | * @since 3.4.0 |
| 115 | * @param WC_Product_Attribute $attribute Attribute object. |
| 116 | * @param int $i Attribute index. |
| 117 | */ |
| 118 | do_action( 'woocommerce_after_product_attribute_settings', $attribute, $i ); |
| 119 | ?> |
| 120 | </tbody> |
| 121 | </table> |
| 122 |