Esempio n. 1
0
    exit;
}
// Exit if accessed directly
global $post, $woocommerce, $product;
?>
<div class="images">

	<?php 
if (has_post_thumbnail()) {
    $image_title = esc_attr(get_the_title(get_post_thumbnail_id()));
    $image_link = wp_get_attachment_url(get_post_thumbnail_id());
    $image = get_the_post_thumbnail($post->ID, apply_filters('single_product_large_thumbnail_size', 'shop_single'), array('title' => $image_title));
    $attachment_count = count($product->get_gallery_attachment_ids());
    if ($attachment_count > 0) {
        $gallery = '[product-gallery]';
    } else {
        $gallery = '';
    }
    echo apply_filters('woocommerce_single_product_image_html', sprintf('<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s" data-rel="prettyPhoto' . $gallery . '">%s</a>', $image_link, $image_title, $image), $post->ID);
} else {
    echo apply_filters('woocommerce_single_product_image_html', sprintf('<img src="%s" alt="%s" />', wc_placeholder_img_src(), __('Placeholder', 'woocommerce')), $post->ID);
}
?>

	<?php 
do_action('woocommerce_product_thumbnails');
woocommerce_output_related_products();
?>
	
</div>
 /**
  * Outputs WooCommerce related products using its own matching algorithm (using product categories and tags).
  * Tested to work only on Single Product pages. This is not meant to be used on product loops.
  * @access public
  * @return void
  */
 public function wpv_woo_related_products_func()
 {
     global $post, $woocommerce;
     ob_start();
     //Check if $product is set
     if (is_object($woocommerce)) {
         //WooCommerce plugin activated
         //Get products
         $product = $this->wcviews_setup_product_data($post);
         if (isset($product) && is_product()) {
             //Executable only on single product page
             //We need to verify if product_type is duly set and exist
             if (isset($product->product_type)) {
                 //Set,
                 $product_type = $product->product_type;
                 if (!empty($product_type)) {
                     //Set and exist
                     //Simple or variable products
                     if (function_exists('woocommerce_output_related_products')) {
                         //Call WooCommerce core public function on oututting related products exists.
                         woocommerce_output_related_products();
                     }
                     return ob_get_clean();
                 }
             }
         }
     }
 }
Esempio n. 3
0
function tokopress_related_upsells_placement()
{
    if (is_product()) {
        if (!of_get_option('tokopress_wc_hide_upsells_products')) {
            woocommerce_upsell_display();
        }
        if (!of_get_option('tokopress_wc_hide_related_products')) {
            woocommerce_output_related_products();
        }
    }
}
Esempio n. 4
0
function woocommerce_custom_related_products()
{
    woocommerce_output_related_products();
}
Esempio n. 5
0
function woocommerce_upsell_related_carousel()
{
    global $product;
    $upsells = $product->get_upsells();
    $related = $product->get_related();
    if (sizeof($upsells) === 0 && sizeof($related) === 0) {
        return;
    }
    $tabs = array();
    if (sizeof($upsells) !== 0) {
        $tabs['upsells'] = esc_html__('You may also like', 'mondova');
    }
    /*if ( sizeof( $related ) !== 0){
          $tabs['related'] = esc_html__( 'Related Products', 'woocommerce' );;
      }
      */
    if (count($tabs)) {
        echo '<div class="related-upsells-tabs">';
        echo '<div class="container">';
        echo '<ul class="nav">';
        foreach ($tabs as $key => $tab) {
            ?>
            <li class="<?php 
            echo esc_attr($key);
            ?>
_tab">
                <a href="#tab-<?php 
            echo esc_attr($key);
            ?>
"><?php 
            echo esc_html($tab);
            ?>
</a>
            </li>
        <?php 
        }
        echo '</ul>';
        foreach ($tabs as $key => $tab) {
            if ($key == 'upsells') {
                woocommerce_upsell_display();
            } elseif ($key == 'related') {
                woocommerce_output_related_products();
            }
        }
        echo '</div>';
        echo '</div>';
    }
}