* Override this template by copying it to yourtheme/woocommerce/content-single-product.php * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ if (!defined('ABSPATH')) { exit; } // Exit if accessed directly global $product; $size = yit_image_content_single_width(); $style = ""; if (!empty($size) && $size['content'] != 100) { $style = 'width:' . $size['content'] . '%; padding-left: 20px;'; } elseif (is_quick_view()) { $style = 'width:50%;'; } elseif (!empty($size)) { $style = 'width:' . $size['content'] . '%;'; } do_action('yit_check_single_product_layout'); ?> <?php /** * woocommerce_before_single_product hook * * @hooked wc_print_notices - 10 */ do_action('woocommerce_before_single_product'); if (post_password_required()) {
*/ if (!defined('ABSPATH')) { exit; } // Exit if accessed directly if (get_option('woocommerce_enable_review_rating') === 'no') { return; } global $product; $rating_count = $product->get_rating_count(); $rating = $product->get_average_rating(); // if we have some rating we'll show the div content. if ($rating_count > 0) { ?> <div class="woocommerce-product-rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"> <?php echo '<div class="star-rating"><span style="width:' . $rating / 5 * 100 . '%"></span></div>'; if (is_quick_view()) { echo "<span class='woocommerce-review-link a-style-2' rel='nofollow'> <span itemprop='reviewCount'>" . $rating_count . " </span>" . _n("review", "reviews", $rating_count, "yit") . " </span>"; } else { echo "<a href='#reviews' class='woocommerce-review-link a-style-2' rel='nofollow'> <span itemprop='reviewCount'>" . $rating_count . " </span>" . _n("review", "reviews", $rating_count, "yit") . " </a>"; } ?> <meta itemprop="ratingValue" content="<?php echo esc_attr($rating); ?> " /> </div> <div class="clearfix"></div> <?php }
<?php /** * Variable product add to cart * * @author WooThemes * @package WooCommerce/Templates * @version 2.3.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly global $product, $post; // resize the main image of each variations if ( function_exists( 'yith_wcmg_is_enabled' ) && yith_wcmg_is_enabled() && !is_quick_view() ) { foreach ( $available_variations as $variation_id => $variation ) { $available_variations[$variation_id]['image_src'] = yit_image( "src=$variation[image_src]&size=shop_single&output=url", false ); $available_variations[$variation_id]['image_magnifier'] = yit_image( "src=$variation[image_magnifier]&size=shop_magnifier&output=url", false ); } } /* woocommerce subscription price fix */ $class_subscription = ""; if ( $product->product_type == 'variable-subscription' ) { $class_subscription = "subscription"; $woo_option = get_option( 'woocommerce_subscriptions_add_to_cart_button_text' ); $label = $woo_option ? $woo_option : apply_filters( 'subscription_add_to_cart_text', __( 'Sign Up Now', 'yit' ) ); } else { $label = apply_filters( 'single_add_to_cart_text',yit_icl_translate( "theme", "yit", "add_to_cart_text", yit_get_option( 'add-to-cart-text' ) ) , $product->product_type );
/** * Set image and content width for single product image * * @return array * @since 1.0.0 * @author Francesco Licando <*****@*****.**> */ function yit_image_content_single_width() { $size = array(); if ( ( yit_get_option( 'general-layout-type' ) == 'fluid' && ! wp_is_mobile() ) || is_quick_view() ) return $size; $img_size = yit_shop_single_w(); $sidebar = YIT_Layout()->sidebars; if ( intval( $img_size ) < $GLOBALS['content_width'] ) { $size['image'] = ( intval( $img_size ) * 100 ) / $GLOBALS['content_width']; if ( $sidebar['layout'] != 'sidebar-no' && ! wp_is_mobile() ) $size['image'] -= 20; } else { $size['image'] = 100; } $size['content'] = 100 - ( $size['image'] ); $min_size = ( wp_is_mobile() ) ? '40' : '20'; if ( $size['content'] < $min_size ) { $size['content'] = 100; } return $size; }
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); if ( yit_get_option( 'shop-single-product-name' ) == 'yes' ) add_action( 'yit_product_with_sidebar', 'woocommerce_template_single_title', 5 ); if ( yit_get_option('shop-enable') == 'yes' && yit_get_option('shop-single-product-price') == 'yes' ) add_action( 'yit_product_with_sidebar', 'woocommerce_template_single_price', 10 ); } if ( yit_get_option('shop-enable') == 'no' || yit_get_option( 'shop-single-add-to-cart' ) == 'no' ) { remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); } ?> <div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?>" id="product-<?php the_ID(); ?>" <?php post_class('product'); ?>> <?php if( $sidebar['layout'] != 'sidebar-no' && ! is_quick_view() ) : ?> <div class="clearfix product-title-section"> <?php do_action('yit_product_with_sidebar'); ?> </div> <?php endif; ?> <?php /** * woocommerce_before_single_product_summary hook * * @hooked woocommerce_show_product_sale_flash - 10 * @hooked woocommerce_show_product_images - 20 */ do_action( 'woocommerce_before_single_product_summary' ); ?>
function yit_product_form_position_is( $check = '' ) { $layout = yit_get_option( 'shop-products-details-meta-position', 'in-sidebar' ); if(is_quick_view()) $layout = 'in-content'; if ( empty( $check ) ) { return $layout; } else { return (bool) ( $check == $layout ); } }
/** * Set image and content width for single product image * * @return array * @since 1.0.0 * @author Francesco Licando <*****@*****.**> */ function yit_image_content_single_width() { $size = array(); if (is_quick_view()) { return $size; } $img_size = yit_shop_single_w(); $sidebar = YIT_Layout()->sidebars; if (intval($img_size) < $GLOBALS['content_width']) { $size['image'] = intval($img_size) * 100 / $GLOBALS['content_width']; if ($sidebar['layout'] != 'sidebar-no' && !wp_is_mobile()) { $size['image'] -= 20; } } else { $size['image'] = 100; } $size['content'] = 100 - $size['image']; $min_size = wp_is_mobile() ? '40' : '20'; if ($size['content'] < $min_size) { $size['content'] = 100; } return $size; }