Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #566509

    While product default placeholder is displaying fine in all other views (single, cart, recent products, etc.), it doesn’t show in the archive view.
    The problem seems to be related with one of the last Enfold updates.
    If I switch to another theme like TwentyFifteen, default placeholders are showing fine.
    But with Enfold or my child theme, placeholders don’t show (there is no output where the image is supposed to be displayed).
    I already tried this solution but it doesn’t work : https://kriesi.at/support/topic/woocommerce-product-without-a-product-image/

    Enfold : 3.4.7
    Child theme : yes
    WordPress : 4.4.1

    Thanks for your help!

    #566577

    Okay, I just managed a fix. I think this is a little bug in Enfold so I suggest to fix it in a further release :)

    # Override avia management of thumbnails.
    # See : https://kriesi.at/support/topic/woocommerce-cayalog-page/
    # See : https://kriesi.at/support/topic/woocommerce-archive-page-default-product-placeholder-not-showing/
    add_action( 'after_setup_theme', 'enfold_woocommerce_child_theme_override' );
    function enfold_woocommerce_child_theme_override()
    {
    	remove_action( 'woocommerce_before_shop_loop_item_title', 'avia_woocommerce_thumbnail', 10);
    	add_action( 'woocommerce_before_shop_loop_item_title', 'avia_woocommerce_thumbnail_child_theme', 10);
    
    	function avia_woocommerce_thumbnail_child_theme($asdf)
    	{
    		global $product, $avia_config;
    		$rating = $product->get_rating_html(); //get rating
    
    		$id = get_the_ID();
    		$size = 'shop_catalog';
    		
    		$gallery_thumbnail = avia_woocommerce_gallery_first_thumbnail( $id , $size);
    		$post_thumbnail = get_the_post_thumbnail( $id , $size );
    		
    		// Get the default WC thumbnail if empty.
    		$post_thumbnail = empty($gallery_thumbnail) && empty($post_thumbnail) ? 
    			$post_thumbnail = wc_placeholder_img(): $post_thumbnail;
    
    		echo "<div class='thumbnail_container'>";
    			echo $gallery_thumbnail;
    			echo $post_thumbnail;
    			if(!empty($rating)) echo "<span class='rating_container'>".$rating."</span>";
    			if($product->product_type == 'simple') echo "<span class='cart-loading'></span>";
    		echo "</div>";
    	}
    }

    Works fine now, yeah!

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘WooCommerce archive page : default product placeholder not showing’ is closed to new replies.