| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <?php
- if (!defined('WPINC')) {
- die;
- }
- /** @var WC_Product_Variable $product */
- /** @var array $variations */
- /** @var array $attributes */
- /** @var int $max_file_size */
- $product_id = $product->get_id();
- $currency_symbol = get_woocommerce_currency_symbol();
- ?>
- <div class="studiou-fpp-product" data-product-id="<?php echo esc_attr($product_id); ?>" data-max-file-size="<?php echo esc_attr($max_file_size); ?>">
- <div class="studiou-fpp-product-header">
- <?php if ($product->get_image_id()) : ?>
- <div class="studiou-fpp-product-image">
- <?php echo $product->get_image('woocommerce_thumbnail'); ?>
- </div>
- <?php endif; ?>
- <div class="studiou-fpp-product-info">
- <h2 class="studiou-fpp-product-title"><?php echo esc_html($product->get_name()); ?></h2>
- <?php if ($product->get_short_description()) : ?>
- <div class="studiou-fpp-product-description">
- <?php echo wp_kses_post($product->get_short_description()); ?>
- </div>
- <?php endif; ?>
- </div>
- </div>
- <div class="studiou-fpp-section">
- <h3><?php esc_html_e('Select Variant', 'studiou-wc-free-photo-product'); ?></h3>
- <div class="studiou-fpp-variants-table-wrap">
- <table class="studiou-fpp-variants-table">
- <thead>
- <tr>
- <th class="studiou-fpp-col-select"></th>
- <?php
- $attr_labels = array();
- foreach ($attributes as $attr_name => $attr_values) {
- $taxonomy = str_replace('attribute_', '', $attr_name);
- if (taxonomy_exists($attr_name)) {
- $tax_obj = get_taxonomy($attr_name);
- $label = $tax_obj->labels->singular_name;
- } else {
- $label = wc_attribute_label($attr_name, $product);
- }
- $attr_labels[$attr_name] = $label;
- ?>
- <th><?php echo esc_html($label); ?></th>
- <?php
- }
- ?>
- <th class="studiou-fpp-col-price"><?php esc_html_e('Price', 'studiou-wc-free-photo-product'); ?></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($variations as $index => $variation) :
- $var_product = wc_get_product($variation['variation_id']);
- if (!$var_product || !$var_product->is_purchasable() || !$var_product->is_in_stock()) {
- continue;
- }
- ?>
- <tr class="studiou-fpp-variant-row" data-variation-id="<?php echo esc_attr($variation['variation_id']); ?>">
- <td class="studiou-fpp-col-select">
- <input type="radio" name="studiou_fpp_variation" value="<?php echo esc_attr($variation['variation_id']); ?>" id="studiou-fpp-var-<?php echo esc_attr($variation['variation_id']); ?>" />
- </td>
- <?php foreach ($attributes as $attr_name => $attr_values) :
- $attr_key = 'attribute_' . sanitize_title($attr_name);
- $attr_value = isset($variation['attributes'][$attr_key]) ? $variation['attributes'][$attr_key] : '';
- // Get term name if it's a taxonomy
- if (taxonomy_exists($attr_name) && !empty($attr_value)) {
- $term = get_term_by('slug', $attr_value, $attr_name);
- $display_value = $term ? $term->name : $attr_value;
- } else {
- $display_value = $attr_value;
- }
- ?>
- <td><?php echo esc_html($display_value); ?></td>
- <?php endforeach; ?>
- <td class="studiou-fpp-col-price">
- <?php echo wp_kses_post($var_product->get_price_html()); ?>
- </td>
- </tr>
- <?php endforeach; ?>
- </tbody>
- </table>
- </div>
- </div>
- <div class="studiou-fpp-section">
- <h3><?php esc_html_e('Upload Your Photo', 'studiou-wc-free-photo-product'); ?></h3>
- <p class="studiou-fpp-upload-info">
- <?php echo esc_html(sprintf(
- __('Maximum file size: %s MB. Accepted formats: JPEG, PNG, TIFF, BMP, PSD, RAW (CR2, NEF, ARW, DNG, ORF, RW2, RAF), WebP.', 'studiou-wc-free-photo-product'),
- $max_file_size
- )); ?>
- </p>
- <div class="studiou-fpp-upload-area" id="studiou-fpp-dropzone">
- <div class="studiou-fpp-upload-prompt">
- <span class="studiou-fpp-upload-icon dashicons dashicons-upload"></span>
- <p><?php esc_html_e('Drag & drop your file here or click to browse', 'studiou-wc-free-photo-product'); ?></p>
- </div>
- <input type="file" id="studiou-fpp-file-input" class="studiou-fpp-file-input"
- accept=".jpg,.jpeg,.png,.tiff,.tif,.bmp,.psd,.cr2,.nef,.arw,.dng,.orf,.rw2,.raf,.webp" />
- </div>
- <div class="studiou-fpp-progress" style="display:none;">
- <div class="studiou-fpp-progress-bar">
- <div class="studiou-fpp-progress-fill" style="width:0%"></div>
- </div>
- <span class="studiou-fpp-progress-text">0%</span>
- </div>
- <div class="studiou-fpp-preview" style="display:none;">
- <div class="studiou-fpp-preview-image">
- <img src="" alt="<?php esc_attr_e('Preview', 'studiou-wc-free-photo-product'); ?>" />
- </div>
- <div class="studiou-fpp-preview-info">
- <span class="studiou-fpp-preview-name"></span>
- <button type="button" class="button studiou-fpp-remove-file"><?php esc_html_e('Remove', 'studiou-wc-free-photo-product'); ?></button>
- </div>
- </div>
- </div>
- <div class="studiou-fpp-section studiou-fpp-actions">
- <input type="hidden" id="studiou-fpp-attachment-id" value="" />
- <input type="hidden" id="studiou-fpp-file-record-id" value="" />
- <div class="studiou-fpp-messages"></div>
- <button type="button" class="button alt studiou-fpp-add-to-cart-btn" disabled>
- <?php esc_html_e('Add to Cart', 'studiou-wc-free-photo-product'); ?>
- </button>
- </div>
- </div>
|