Ivo Posted March 11, 2018 Share Posted March 11, 2018 (edited) Hi, I am working with PrestaShop 1.7.2.4. My need is to have the category image below the navigation, that is why I have added the following code, found in this post, to my layout file "breadcrumb.tpl": <div class="content_scene_cat_bg" {if $category->id_image}style="background:url({$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default')|escape:'html':'UTF-8'}) 0 top no-repeat;" {/if}></div> That works perfect on pages with products from that category: <div class="content_scene_cat_bg" style="background:url(http://domain.ch/c/51-category_default/image.jpg) 0 top no-repeat;" ></div> but not on the category listing itself, there the dynamic content is not filled in, I only get a empty div: <div class="content_scene_cat_bg" ></div> I have also tryed to use the snippet from "category.tpl": <img class="img-fluid" src="{$category.image.large.url}" alt="{$category.image.legend}"> But as consequence, I get only a white page on product details (the code is visible in the source text until that image call). Can anybody help me with that problem? Thank you and kind regards, Ivo Edited March 17, 2018 by Ivo (see edit history) Link to comment Share on other sites More sharing options...
Ivo Posted March 17, 2018 Author Share Posted March 17, 2018 Hi folks, I have found myself a working solution: I put two images, the first one for the sub pages of the main category and then the second one for the main category itself. {if $category->id_image} <div class="content_scene_cat_bg1" style="background:url({$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default')|escape:'html':'UTF-8'}) 0 top no-repeat;"></div> {else} <div class="content_scene_cat_bg2"><img src="{$urls.img_cat_url}{$smarty.get.id_category}-category_default.jpg" /></div> {/if} Hope to help myself one day with this post ... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now