Jump to content

Replace category text with thumbnail on the 'Sub-Category' landing page


Recommended Posts

see: It is the category landing page which displays the sub-category products (the page that only has a text category heading).

 

1. Main category: http://kamaainahawaii.com/3-island-wear-women
 

2. Sub-categories: http://kamaainahawaii.com/14-beachwear
 

3. Sub-categories landing page: http://kamaainahawaii.com/13-sarongs

 

or

 

http://kamaainahawaii.com/5-t-shirts-tees

Link to comment
Share on other sites

in category.tpl this is the code that brings up the category text heading, I need to replace it with the relevant category/sub-category thumbnail image instead of the category name.

 

{if $category->id AND $category->active}
<h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}">
<span class="cat-name">
{$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'}{/if}
</span></h1>
Link to comment
Share on other sites

Thank you, your help is really appreciated. It works great, but it displays the large image instead of the smaller size - see image below?

 

post-839533-0-43753300-1429095344_thumb.jpg

 

This is what I added:

 

<h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}">
<span class="cat-name">
<img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default')|escape:'html':'UTF-8'}"/>
 
<!-- {$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'} -->{/if}
 
</span></h1>
Edited by kamaaina (see edit history)
Link to comment
Share on other sites

I did this and it worked - however is it ok to use:

 

<h1 class="page-heading{if (isset($subcategories) && !$products) || (isset($subcategories) && $products) || !isset($subcategories) && $products} product-listing{/if}">
 
<div class="col-md-4">
<div class="image">
<img class="replace-2x img-responsive" src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default')|escape:'html':'UTF-8'}"/>
 
<!-- {$category->name|escape:'html':'UTF-8'}{if isset($categoryNameComplement)} {$categoryNameComplement|escape:'html':'UTF-8'} -->{/if}
</span></h1>
 
post-839533-0-91717900-1429290249_thumb.jpg
Link to comment
Share on other sites

×
×
  • Create New...