Fix: show original image on product page if size < thumbnail size

I just made a modification (4.0.1) which I want to share: No resize of Product-Details-Page image/thumbnail if the original image width/height is < Thumbnail width/height.



Problem of cscart: If “Product details page thumbnail height/width” is set to 250 for example, it will auto-resize a width:100 product-image to 250, making it to look blur of course.



Solution:



create: hooks/products/image_wrap.override.tpl:


{if !$no_images}



{if $product.list_discount_prc}

{strip}
{__("save_discount")} {$product.list_discount_prc}%
{/strip}

{/if}

{* custom *}
{$my_image_data=$product.main_pair|fn_image_to_display}
{if $my_image_data.width < $settings.Thumbnails.product_details_thumbnail_width && $my_image_data.height < $settings.Thumbnails.product_details_thumbnail_height}
{* original size *}
{include file="views/products/components/product_images.tpl" product=$product show_detailed_link="Y"}
{else}
{* thumbnail size *}
{include file="views/products/components/product_images.tpl" product=$product show_detailed_link="Y" image_width=$settings.Thumbnails.product_details_thumbnail_width image_height=$settings.Thumbnails.product_details_thumbnail_height}
{/if}
{* /custom *}

{/if}