Panther.software Posted November 29, 2015 Share Posted November 29, 2015 (edited) Hello, i want to display category images on categories filter (seted as a radio) - only those which are available. I've already makes few changes to custom display Layered Navigation module. It's hooked above product list and displays category images from hard coded path: <img class="img-responsive layered_radio" alt="{$value.name}" src="{$link->getCatImageLink($value.name, $id_value, 'medium_default')|escape:'html':'UTF-8'}" /> Is there any chance to retrieve Category as a object? Like on category.tpl: {if isset($category)} {if $category->id AND $category->active} {if $category->id_image} <img class="category-img img-responsive" alt="" src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default')|escape:'html':'UTF-8'}" /> {/if} See an attachment, thanks in advance Edited November 30, 2015 by mlodociany (see edit history) Link to comment Share on other sites More sharing options...
Panther.software Posted November 29, 2015 Author Share Posted November 29, 2015 Or maybe just posibility to display categories which have uploaded category image? Link to comment Share on other sites More sharing options...
Panther.software Posted November 30, 2015 Author Share Posted November 30, 2015 (edited) Okay i figured it out, it's as simple as php function "file_exist". Code work: in blocklayered.tpl after "{if $filter.filter_type == 1}" which means it's category type filter: {if file_exists($cat_img_dir|cat:$id_value|cat:'.jpg')} 1 {else} 0 {/if} 1 - true, 0 - false Remember to put this code in foreach loop to initiate vars. In blocklayered.php above "'col_img_dir' => _PS_COL_IMG_DIR_" add: 'cat_img_dir' => _PS_CAT_IMG_DIR_, If you have any question or i am wrong about smth, feel free to reply. Cheers, Damian from web-zlecenia.pl Edited November 30, 2015 by mlodociany (see edit history) 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