{"id":7220,"date":"2019-09-23T13:43:04","date_gmt":"2019-09-23T08:13:04","guid":{"rendered":"https:\/\/www.hiddentechies.com\/blog\/?p=7220"},"modified":"2024-04-09T18:28:14","modified_gmt":"2024-04-09T12:58:14","slug":"show-cover-image-product-combination-prestashop","status":"publish","type":"post","link":"https:\/\/www.hiddentechies.com\/blog\/prestashop\/show-cover-image-product-combination-prestashop\/","title":{"rendered":"How to show cover image of your product with combination in PrestaShop 1.7?"},"content":{"rendered":"<p>In e-Commerce business, Product image is a vital aspect, to attract a visitor\u2019s eye in the first place. In PrestaShop 1.7, If you have combination product then PrestaShop shows image of the one selected by default in product combination instead of the generic (Cover) image of your product.<\/p>\n<p>Do you want to show generic (Cover) image of your product on the product listing (On the homepage and category page)? If yes, then find out how to show generic (Cover) image of your product on the product listing in PrestaShop 1.7 programmatically.<\/p>\n<div style=\"display: block; float: left; width: 100%; border-radius: 5px; margin: 0 0 25px 0;\"><a style=\"color: #fff; font-size: 28px; font-weight: 600;\" href=\"https:\/\/addons.prestashop.com\/en\/analytics-statistics\/92705-google-analytics-google-analytics-4-ga4-integration.html\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-13583\" src=\"https:\/\/www.hiddentechies.com\/blog\/wp-content\/uploads\/2018\/11\/google-analytics-prestashop-ga4.gif\" alt=\"\" width=\"780\" height=\"110\" \/><\/a><\/div>\n<p><strong>Step 1:\u00a0<\/strong>Open\u00a0the file, In your theme directory : templates\\catalog\\_partials\\miniatures\\product.tpl<\/p>\n<p><strong>Step 2:\u00a0<\/strong>Find the below code:<\/p>\n<pre class=\"lang:default decode:true\">{if $product.cover}\r\n  &lt;a class=\"thumbnail product-thumbnail\" href=\"{$product.canonical_url}\"&gt;\r\n\t&lt;img src=\"{$product.cover.bySize.home_default.url}\" alt=\"{if !empty($product.cover.legend)}{$product.cover.legend}{else}{$product.name|truncate:30:'...'}{\/if}\" data-full-size-image-url=\"{$product.cover.large.url}\" \/&gt;\r\n  &lt;\/a&gt;\r\n{else}\r\n  &lt;a class=\"thumbnail product-thumbnail\" href=\"{$product.canonical_url}\"&gt;\r\n\t&lt;img src=\"{$urls.no_picture_image.bySize.home_default.url}\" \/&gt;\r\n  &lt;\/a&gt;\r\n{\/if}<\/pre>\n<p><strong>Step 3:\u00a0<\/strong>Replace the below code snippet:<\/p>\n<pre class=\"lang:default decode:true\">{if $product.cover}\r\n\t{assign var='coverImage' value=Product::getCover($product-&gt;id)}\r\n\t{assign var='coverImageId' value=\"{$product-&gt;id}-{$coverImage.id_image}\"}\r\n\t&lt;a class=\"thumbnail product-thumbnail\" href=\"{$product.canonical_url}\"&gt;\r\n\t\t&lt;img src=\"{$link-&gt;getImageLink($product.link_rewrite, $coverImageId)}\" alt=\"{if !empty($product.cover.legend)}{$product.cover.legend}{else}{$product.name|truncate:30:'...'}{\/if}\" data-full-size-image-url=\"{$product.cover.large.url}\" \/&gt;\r\n\t&lt;\/a&gt;\r\n{else}\r\n\t&lt;a class=\"thumbnail product-thumbnail\" href=\"{$product.canonical_url}\"&gt;\r\n\t\t&lt;img src=\"{$urls.no_picture_image.bySize.home_default.url}\" \/&gt;\r\n\t&lt;\/a&gt;\r\n{\/if}<\/pre>\n<p><strong>Step 4:\u00a0<\/strong>Clear the Cache and check for the same. Done!<\/p>\n<p>Enjoy <strong>PrestaShop 1.7<\/strong>!<\/p>\n<div class=\"angwp_12010 _ning_cont _ning_hidden _ning_outer _align_center responsive\" data-size=\"custom\" data-bid=\"12010\" data-aid=\"0\" style=\"max-width:800px; width:100%;height:inherit;\"><div class=\"_ning_label _left\" style=\"\"><\/div><div class=\"_ning_inner\" style=\"\"><a href=\"https:\/\/www.hiddentechies.com\/blog?_dnlink=12010&t=1779277304\" class=\"strack_cli _ning_link\" target=\"_blank\">&nbsp;<\/a><div class=\"_ning_elmt\"><img decoding=\"async\" src=\"https:\/\/www.hiddentechies.com\/blog\/wp-content\/uploads\/angwp\/items\/12010\/Banner-2.png\" \/><\/div><\/div><\/div><div class=\"clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>In e-Commerce business, Product image is a vital aspect, to attract a visitor\u2019s eye in the first place. In PrestaShop 1.7, If you have combination product then PrestaShop shows image of the one selected by default in product combination instead of the generic (Cover) image of your product. Do you want to show generic (Cover)&#8230; <\/p>\n<div class=\"actions\"><a href=\"https:\/\/www.hiddentechies.com\/blog\/prestashop\/show-cover-image-product-combination-prestashop\/\">Continue Reading<\/a><\/div>\n","protected":false},"author":1,"featured_media":7252,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[221,222,2139,2],"tags":[678,681,677,679,680,682,329,676],"_links":{"self":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/7220"}],"collection":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/comments?post=7220"}],"version-history":[{"count":24,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/7220\/revisions"}],"predecessor-version":[{"id":13600,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/7220\/revisions\/13600"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/media\/7252"}],"wp:attachment":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/media?parent=7220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/categories?post=7220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/tags?post=7220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}