| 1 |
<?php |
| 2 |
/** |
| 3 |
* Orderbump variable product template |
| 4 |
* |
| 5 |
* @package |
| 6 |
*/ |
| 7 |
if ( ! defined( 'ABSPATH' ) ) { |
| 8 |
exit; |
| 9 |
} |
| 10 |
global $product; |
| 11 |
|
| 12 |
$attribute_keys = array_keys( $attributes ); |
| 13 |
$variations_json = wp_json_encode( $available_variations ); |
| 14 |
$variations_attr = function_exists( 'wc_esc_json' ) ? wc_esc_json( $variations_json ) : _wp_specialchars( $variations_json, ENT_QUOTES, 'UTF-8', true ); |
| 15 |
?> |
| 16 |
|
| 17 |
<div class="wpfnl-variable-product-modal-content product"> |
| 18 |
<div class="wp-block-columns alignwide is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex"> |
| 19 |
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"> |
| 20 |
<div class="woocommerce-product-gallery woocommerce-product-gallery--with-images woocommerce-product-gallery--columns-4 images" data-columns="4" style="width: 100%"> |
| 21 |
<figure class="woocommerce-product-gallery__wrapper"> |
| 22 |
<?php |
| 23 |
$image_id = $product->get_image_id(); |
| 24 |
$image_url = wp_get_attachment_image_url( $image_id, 'full' ); |
| 25 |
echo '<div class="woocommerce-product-gallery__image"><a href="' . esc_url( $image_url ) . '"><img src="' . esc_url( $image_url ) . '" class="wp-post-image" alt="' . esc_attr( get_post_meta( $image_id, '_wp_attachment_image_alt', true ) ) . '"></a></div>'; |
| 26 |
?> |
| 27 |
</figure> |
| 28 |
<ol class="flex-control-nav flex-control-thumbs"> |
| 29 |
<?php |
| 30 |
$attachment_ids = $product->get_gallery_image_ids(); |
| 31 |
if ( $attachment_ids && $product->get_image_id() ) { |
| 32 |
$image_class = 'flex-active'; |
| 33 |
$image_url = wp_get_attachment_image_url( $product->get_image_id(), 'thumbnail' ); |
| 34 |
$full_src_url = wp_get_attachment_image_url( $product->get_image_id(), 'full' ); |
| 35 |
echo '<li><img src="' . esc_url( $image_url ) . '" class="' . esc_attr( $image_class ) . '" data-full_src="' . esc_url( $full_src_url ) . '"></li>'; |
| 36 |
foreach ( $attachment_ids as $attachment_id ) { |
| 37 |
$image_url = wp_get_attachment_image_url( $attachment_id, 'thumbnail' ); |
| 38 |
$full_src_url = wp_get_attachment_image_url( $attachment_id, 'full' ); |
| 39 |
echo '<li><img src="' . esc_url( $image_url ) . '" data-full_src="' . esc_url( $full_src_url ) . '"></li>'; |
| 40 |
} |
| 41 |
} |
| 42 |
?> |
| 43 |
</ol> |
| 44 |
</div> |
| 45 |
</div> |
| 46 |
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"> |
| 47 |
<h1 class="product_title entry-title"><?php echo esc_html( $product->get_name() ); ?></h1> |
| 48 |
<?php woocommerce_template_single_excerpt(); ?> |
| 49 |
<form class="variations_form cart" action="" method="post" enctype='multipart/form-data' data-product_id="<?php echo absint( $product->get_id() ); ?>" data-product_variations="<?php echo $variations_attr; // WPCS: XSS ok. ?>"> |
| 50 |
<?php if ( empty( $available_variations ) && false !== $available_variations ) : ?> |
| 51 |
<p class="stock out-of-stock"><?php echo esc_html( apply_filters( 'woocommerce_out_of_stock_message', __( 'This product is currently out of stock and unavailable.', 'wpfnl' ) ) ); ?></p> |
| 52 |
<?php else : ?> |
| 53 |
<table class="variations" cellspacing="0"> |
| 54 |
<tbody> |
| 55 |
<?php foreach ( $attributes as $attribute_name => $options ) : ?> |
| 56 |
<tr> |
| 57 |
<td class="label"><label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo wc_attribute_label( $attribute_name ); // WPCS: XSS ok. ?></label></td> |
| 58 |
<td class="value"> |
| 59 |
<?php |
| 60 |
wc_dropdown_variation_attribute_options( |
| 61 |
array( |
| 62 |
'options' => $options, |
| 63 |
'attribute' => $attribute_name, |
| 64 |
'product' => $product, |
| 65 |
) |
| 66 |
); |
| 67 |
echo end( $attribute_keys ) === $attribute_name ? wp_kses_post( apply_filters( 'woocommerce_reset_variations_link', '<a class="reset_variations" href="#">' . esc_html__( 'Clear', 'wpfnl' ) . '</a>' ) ) : ''; |
| 68 |
?> |
| 69 |
</td> |
| 70 |
</tr> |
| 71 |
<?php endforeach; ?> |
| 72 |
</tbody> |
| 73 |
</table> |
| 74 |
<div class="description"> |
| 75 |
<p class="description-label">Description: </p> |
| 76 |
<?php echo apply_filters( 'woocommerce_short_description', $product->get_short_description() ); ?> |
| 77 |
</div> |
| 78 |
|
| 79 |
<p class="price"><?php echo $product->get_price_html(); ?></p> |
| 80 |
<div class="single_variation_wrap"> |
| 81 |
<?php |
| 82 |
/** |
| 83 |
* Hook: woocommerce_before_single_variation. |
| 84 |
*/ |
| 85 |
do_action( 'woocommerce_before_single_variation' ); |
| 86 |
|
| 87 |
/** |
| 88 |
* Hook: woocommerce_single_variation. Used to output the cart button and placeholder for variation data. |
| 89 |
* |
| 90 |
* @since 2.4.0 |
| 91 |
* @hooked woocommerce_single_variation - 10 Empty div for variation data. |
| 92 |
* @hooked woocommerce_single_variation_add_to_cart_button - 20 Qty and cart button. |
| 93 |
*/ |
| 94 |
do_action( 'woocommerce_single_variation' ); |
| 95 |
|
| 96 |
/** |
| 97 |
* Hook: woocommerce_after_single_variation. |
| 98 |
*/ |
| 99 |
do_action( 'woocommerce_after_single_variation' ); |
| 100 |
?> |
| 101 |
</div> |
| 102 |
<?php endif; ?> |
| 103 |
</form> |
| 104 |
</div> |
| 105 |
</div> |
| 106 |
</div> |
| 107 |
|