| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template: Product Options. |
| 4 |
* |
| 5 |
* This template can be overridden by copying it to yourtheme/orderable/options.php |
| 6 |
* |
| 7 |
* HOWEVER, on occasion Orderable will need to update template files and you |
| 8 |
* (the theme developer) will need to copy the new files to your theme to |
| 9 |
* maintain compatibility. We try to do this as little as possible, but it does |
| 10 |
* happen. When this occurs the version of the template file will be bumped and |
| 11 |
* the readme will list any important changes. |
| 12 |
* |
| 13 |
* @package Orderable/Templates |
| 14 |
* |
| 15 |
* @var WC_Product $product Product. |
| 16 |
* @var bool $orderable_single_product Determines whether it's possible to add to cart (i.e. a single product view). |
| 17 |
* @var array $args Array of args. |
| 18 |
*/ |
| 19 |
|
| 20 |
defined( 'ABSPATH' ) || exit; |
| 21 |
|
| 22 |
global $orderable_single_product; |
| 23 |
|
| 24 |
$orderable_single_product = true; ?> |
| 25 |
|
| 26 |
<div class="orderable-product orderable-product--options orderable-product--image-cropped"> |
| 27 |
<?php require Orderable_Helpers::get_template_path( 'templates/product/hero.php' ); ?> |
| 28 |
|
| 29 |
<div class="orderable-sb-container" data-orderable-scroll-id="product"> |
| 30 |
<?php do_action( 'orderable_side_menu_before_product_title', $product, $args ); ?> |
| 31 |
|
| 32 |
<h2 class="orderable-product__title"><?php echo wp_kses_post( $product->get_name() ); ?></h2> |
| 33 |
|
| 34 |
<?php do_action( 'orderable_side_menu_before_product_options_wrapper', $product, $args ); ?> |
| 35 |
|
| 36 |
<div class="orderable-product__options-wrap"> |
| 37 |
<?php do_action( 'orderable_side_menu_before_product_options', $product, $args ); ?> |
| 38 |
|
| 39 |
<?php if ( ! empty( $attributes ) ) { ?> |
| 40 |
<table class="orderable-product__options" cellspacing="0" cellpadding="0"> |
| 41 |
<?php foreach ( $attributes as $attribute_name => $options ) : ?> |
| 42 |
<tr class="orderable-product__option"> |
| 43 |
<th class="orderable-product__option-label"> |
| 44 |
<label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo wc_attribute_label( $attribute_name ); // WPCS: XSS ok. ?></label> |
| 45 |
</th> |
| 46 |
<td class="orderable-product__option-select"> |
| 47 |
<?php |
| 48 |
wc_dropdown_variation_attribute_options( |
| 49 |
array( |
| 50 |
'options' => $options, |
| 51 |
'attribute' => $attribute_name, |
| 52 |
'selected' => empty( $selected[ wc_variation_attribute_name( $attribute_name ) ] ) ? false : $selected[ wc_variation_attribute_name( $attribute_name ) ], |
| 53 |
'product' => $product, |
| 54 |
'class' => 'orderable-input orderable-input--select orderable-input--validate', |
| 55 |
) |
| 56 |
); |
| 57 |
?> |
| 58 |
</td> |
| 59 |
</tr> |
| 60 |
<?php endforeach; ?> |
| 61 |
</table> |
| 62 |
<?php } ?> |
| 63 |
|
| 64 |
<?php do_action( 'orderable_side_menu_after_product_options', $product, $args ); ?> |
| 65 |
|
| 66 |
<div class="orderable-product__messages"></div> |
| 67 |
|
| 68 |
<?php if ( ! empty( $variations_json ) ) : ?> |
| 69 |
<script class="orderable-product__variations" type="application/json"><?php echo $variations_json; ?></script> |
| 70 |
<?php endif; ?> |
| 71 |
</div> |
| 72 |
|
| 73 |
</div> |
| 74 |
|
| 75 |
<?php do_action( 'orderable_side_menu_after_product_options_wrapper', $product, $args ); ?> |
| 76 |
|
| 77 |
<?php require Orderable_Helpers::get_template_path( 'templates/product/actions.php' ); ?> |
| 78 |
</div> |
| 79 |
|