• I would like the main featured image on the single product page to be different from the catalog featured image for that same product. Every time I change the featured image on the product page itself, the same image appears as the catalog featured image. I tried adding the featured image on the Shop page then exluding that same image on the corresponding single product page but that didn’t work. Any ideas? I’m sure there’s some shortcode or conditional tag but I can’t figure out what it is and where to put it. Thanks 😀

    http://wordpress.org/extend/plugins/woocommerce/

    [ Please do not bump, that’s not permitted here. ]

Viewing 1 replies (of 1 total)
  • Hi Scott,

    I had similar need and here’s what worked for me –

    copy product-image.php file from woo commerce plugin folder to your theme/woocommerce/single-product/product-image.php

    replace the <div> part with the following code –

    <div class="images">
    
    	<?php
    
    		$attachment_ids = $product->get_gallery_attachment_ids();
     		isset ($placeholder_width)? : $placeholder_width=0;
    		isset ($placeholder_height)? : $placeholder_height=0;
    
    		if ( $attachment_ids ) {
    	  		$attachment_id = $attachment_ids[0];
    
    		if ( ! $placeholder_width )
    			$placeholder_width = $woocommerce->get_image_size( 'shop_catalog_image_width' );
    		if ( ! $placeholder_height )
    			$placeholder_height = $woocommerce->get_image_size( 'shop_catalog_image_height' );
    
    			$output = '<div class="imagewrapper">';
    
    //			$classes = array( 'imagewrapper' );
    			$classes = array();
    			$image_link = wp_get_attachment_url( $attachment_id );
    
    			if ( $image_link ) {
    
    			$image       = wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_thumbnail_size', 'shop_thumbnail' ) );
    			$image_class = esc_attr( implode( ' ', $classes ) );
    			$image_title = esc_attr( get_the_title( $attachment_id ) );
    
    			echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s"  rel="prettyPhoto[product-gallery]">%s</a>', $image_link, $image_title, $image ), $post->ID );
    
    			} else {
    
    				echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<img src="%s" alt="Placeholder" />', woocommerce_placeholder_img_src() ), $post->ID );
    
    			}
    
    		}
    	?>
    
    	<?php do_action( 'woocommerce_product_thumbnails' ); ?>
    
    </div>

    hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Different single product image than Catalog image?’ is closed to new replies.