add-to-cart
9 years ago
tabs
9 years ago
meta.php
9 years ago
photoswipe.php
9 years ago
price.php
9 years ago
product-attributes.php
9 years ago
product-image.php
9 years ago
product-thumbnails.php
9 years ago
rating.php
9 years ago
related.php
9 years ago
review-meta.php
9 years ago
review-rating.php
9 years ago
review.php
9 years ago
sale-flash.php
9 years ago
share.php
9 years ago
short-description.php
9 years ago
stock.php
9 years ago
title.php
9 years ago
up-sells.php
9 years ago
product-attributes.php
72 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Product attributes |
| 4 | * |
| 5 | * Used by list_attributes() in the products class. |
| 6 | * |
| 7 | * This template can be overridden by copying it to yourtheme/woocommerce/single-product/product-attributes.php. |
| 8 | * |
| 9 | * HOWEVER, on occasion WooCommerce will need to update template files and you |
| 10 | * (the theme developer) will need to copy the new files to your theme to |
| 11 | * maintain compatibility. We try to do this as little as possible, but it does |
| 12 | * happen. When this occurs the version of the template file will be bumped and |
| 13 | * the readme will list any important changes. |
| 14 | * |
| 15 | * @see https://docs.woocommerce.com/document/template-structure/ |
| 16 | * @author WooThemes |
| 17 | * @package WooCommerce/Templates |
| 18 | * @version 3.0.0 |
| 19 | */ |
| 20 | |
| 21 | if ( ! defined( 'ABSPATH' ) ) { |
| 22 | exit; |
| 23 | } |
| 24 | ?> |
| 25 | <table class="shop_attributes"> |
| 26 | <?php if ( $display_dimensions && $product->has_weight() ) : ?> |
| 27 | <tr> |
| 28 | <th><?php _e( 'Weight', 'woocommerce' ) ?></th> |
| 29 | <td class="product_weight"><?php echo esc_html( wc_format_weight( $product->get_weight() ) ); ?></td> |
| 30 | </tr> |
| 31 | <?php endif; ?> |
| 32 | |
| 33 | <?php if ( $display_dimensions && $product->has_dimensions() ) : ?> |
| 34 | <tr> |
| 35 | <th><?php _e( 'Dimensions', 'woocommerce' ) ?></th> |
| 36 | <td class="product_dimensions"><?php echo esc_html( wc_format_dimensions( $product->get_dimensions( false ) ) ); ?></td> |
| 37 | </tr> |
| 38 | <?php endif; ?> |
| 39 | |
| 40 | <?php foreach ( $attributes as $attribute ) : ?> |
| 41 | <tr> |
| 42 | <th><?php echo wc_attribute_label( $attribute->get_name() ); ?></th> |
| 43 | <td><?php |
| 44 | $values = array(); |
| 45 | |
| 46 | if ( $attribute->is_taxonomy() ) { |
| 47 | $attribute_taxonomy = $attribute->get_taxonomy_object(); |
| 48 | $attribute_values = wc_get_product_terms( $product->get_id(), $attribute->get_name(), array( 'fields' => 'all' ) ); |
| 49 | |
| 50 | foreach ( $attribute_values as $attribute_value ) { |
| 51 | $value_name = esc_html( $attribute_value->name ); |
| 52 | |
| 53 | if ( $attribute_taxonomy->attribute_public ) { |
| 54 | $values[] = '<a href="' . esc_url( get_term_link( $attribute_value->term_id, $attribute->get_name() ) ) . '" rel="tag">' . $value_name . '</a>'; |
| 55 | } else { |
| 56 | $values[] = $value_name; |
| 57 | } |
| 58 | } |
| 59 | } else { |
| 60 | $values = $attribute->get_options(); |
| 61 | |
| 62 | foreach ( $values as &$value ) { |
| 63 | $value = esc_html( $value ); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values ); |
| 68 | ?></td> |
| 69 | </tr> |
| 70 | <?php endforeach; ?> |
| 71 | </table> |
| 72 |