Jump to content

prestashop cart variant image not showing


Baturex

Recommended Posts

version: 1.7.8.10
Hello, I wish you a good forum. I would like to see the photo of the selected variant product on the cart and payment page. Could you help. Thank you.

cart-detailed-product-line.tpl :

<span class="product-image media-middle col-md-4 col-xs-4">
 <img src="{$product.cover.bySize.cart_default.url}" alt="{$product.name|escape:'quotes'}">
</span>

I tried many things but I couldn't take a variant picture.
 

cart.PNG

product.PNG

Link to comment
Share on other sites

  • 4 weeks later...

Hi Baturex,

Please use the below reference code in the cart-detailed-product-line.tpl and clear cache as well.
{if isset($product.attributes)}
{assign var="selected_variant" value=$product.attributes}
<span class="product-image media-middle col-md-4 col-xs-4">
{if isset($selected_variant.cover) && isset($selected_variant.cover.bySize.cart_default.url)}
<img src="{$selected_variant.cover.bySize.cart_default.url}" alt="{$selected_variant.name|escape:'htmlall':'UTF-8'}">
{else}<img src="{$product.cover.bySize.cart_default.url}" alt="{$product.name|escape:'htmlall':'UTF-8'}">
{/if}</span>
{else}
<span class="product-image media-middle">
{if $product.cover}
<img src="{$product.cover.bySize.cart_default.url}" alt="{$product.name|escape:'quotes'}">
{else}
<img src="{$urls.no_picture_image.bySize.cart_default.url}" />
{/if}</span>{/if}
Please make sure to have a backup of the original files before doing the same.
File path: themes\classic\templates\checkout\_partials\cart-detailed-product-line.tpl

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...