{"id":7512,"date":"2019-10-11T08:24:50","date_gmt":"2019-10-11T02:54:50","guid":{"rendered":"https:\/\/www.hiddentechies.com\/blog\/?p=7512"},"modified":"2020-10-08T19:43:20","modified_gmt":"2020-10-08T14:13:20","slug":"how-to-get-product-cover-image-by-product-id-in-prestashop-1-7","status":"publish","type":"post","link":"https:\/\/www.hiddentechies.com\/blog\/prestashop\/how-to-get-product-cover-image-by-product-id-in-prestashop-1-7\/","title":{"rendered":"How to get product cover image by Product Id in PrestaShop 1.7"},"content":{"rendered":"<p>In this post I am going to explain how to get product cover image by Product Id in PrestaShop 1.7.<\/p>\n<pre class=\"lang:default decode:true \">\/\/ Your Product Id\r\n$id_product = 10;\r\n\r\n\/\/ Language id\r\n$id_lang = (int) Configuration::get('PS_LANG_DEFAULT');\r\n\r\n\/\/ Get cover image for your product\r\n$image = Image::getCover($id_product);\r\n\r\n\/\/ Load Product Object\r\n$product = new Product($id_product);\r\n\r\n\/\/ Initialize the link object\r\n$link = new Link;\r\n\r\n$imagePath = $link-&gt;getImageLink($product-&gt;link_rewrite[Context::getContext()-&gt;language-&gt;id], $image['id_image'], 'home_default');\r\n\r\necho $imagePath;<\/pre>\n<p>&nbsp;<\/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=1779104117\" 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 this post I am going to explain how to get product cover image by Product Id in PrestaShop 1.7. \/\/ Your Product Id $id_product = 10; \/\/ Language id $id_lang = (int) Configuration::get(&#8216;PS_LANG_DEFAULT&#8217;); \/\/ Get cover image for your product $image = Image::getCover($id_product); \/\/ Load Product Object $product = new Product($id_product); \/\/ Initialize the&#8230; <\/p>\n<div class=\"actions\"><a href=\"https:\/\/www.hiddentechies.com\/blog\/prestashop\/how-to-get-product-cover-image-by-product-id-in-prestashop-1-7\/\">Continue Reading<\/a><\/div>\n","protected":false},"author":1,"featured_media":7525,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[221,222,2139],"tags":[629,313,329,331],"_links":{"self":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/7512"}],"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=7512"}],"version-history":[{"count":1,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/7512\/revisions"}],"predecessor-version":[{"id":7513,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/7512\/revisions\/7513"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/media\/7525"}],"wp:attachment":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/media?parent=7512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/categories?post=7512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/tags?post=7512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}