Remove Thumbnail Images for products without image

I need a way to remove the placeholder thumbnail from the shopping cart widget and the cart and checkout pages for products that do not have images.

How can I do that?

Thanks

  • Ash
    • WordPress Hacker

    Hello @Jay

    Welcome to WPMU community!

    I hope you are well today and thanks for asking the question.

    Please go to /wp-content/plugins/marketpress/marketpress-includes/template-functions.php line no 657

    $content .= '	 <td class="mp_cart_col_thumb">' . mp_product_image(false, 'widget', $product_id, 25) . '</td>';

    replace with:

    $thumb = get_the_post_thumbnail($product_id);
                                                                                    if(!$thumb)
                                                                                        $content .= '	 <td class="mp_cart_col_thumb">&nbsp;</td>';
                                                                                    else
                                                                                        $content .= '	 <td class="mp_cart_col_thumb">' .$thumb . mp_product_image(false, 'widget', $product_id, 25) . '</td>';

    And please go to /wp-content/plugins/marketpress/marketpress-includes/template-functions.php line no 423:

    $content .= '	 <td class="mp_cart_col_thumb">' . mp_product_image(false, 'widget', $product_id, 50) . '</td>';

    replace with:

    $thumb = get_the_post_thumbnail($product_id);
                                                                                    if(!$thumb)
                                                                                        $content .= '	 <td class="mp_cart_col_thumb">&nbsp;</td>';
                                                                                    else
                                                                                        $content .= '	 <td class="mp_cart_col_thumb">' . mp_product_image(false, 'widget', $product_id, 50) . '</td>';

    Let me know if it works.

    Please note that, this changes will be lost in next update. So it's worth to note down this changes somewhere and apply again after your updates.

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.