Home Forums WoodMart support forum Featured image different than product image

Featured image different than product image

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #180094

    John
    Participant

    Hello there, I would like to set different images for shop page and product page so I found the code below.
    Is there any chance to implement this code in your theme ? Thanks in advance.

    <?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' ); ?>

    In theme/woocommerce/single-product/product-image.php

    Here is an initial request:
    https://stackoverflow.com/questions/24636593/woocommerce-featured-image-different-than-product-image

    #180108

    John
    Participant


    @newsprince
    can you check the code above? Thanks in advance.

    #180148

    Hello,

    Our support does not cover testing the third-party code. We cannot guarantee its smooth 100% working.

    Best Regards

    #180285

    John
    Participant

    So you can’t help me, I need somehow to display a product image instead of feature image. Maybe you can implement this in the future…

    #180295

    Hello,

    We shall consider that however, we do not promise to implement that in the nearest future. You wuld better to find a developer who would customize that for you.

    Best Regards

    #180297

    John
    Participant

    @newsprince maybe you can help me with this, thanks in advance

Viewing 6 posts - 1 through 6 (of 6 total)