milaonline Posted June 14, 2017 Share Posted June 14, 2017 Hi there. I'm changing homefeatured module to display category, category link and category thumbnail before product list. I've manage to achieve this code in product-list.tpl: {foreach from=$products item=product name=products} {if isset($product.id_category_default)} <p>Najchętniej wybierane</p> <h3>{assign var='catname' value=Category::getCategoryInformations(array($product.id_category_default))} <span>{$catname[$product.id_category_default].name}</span></h3> <a href="{$link->getCategoryLink({$product.id_category_default})}"><span class="more-icon">{l s='More'}</span></a> {/if}{/foreach} It works but I get all categories and list for everyone product as foreach shouldn't be used here. What I want is code to take category, link and category thumbnails for category hooked in back office or category of first item. Link to comment Share on other sites More sharing options...
milaonline Posted June 21, 2017 Author Share Posted June 21, 2017 I've made it {foreach from=$products item=product name=products} {if isset($product.id_category_default)} <img class="cat-image-link" src="{$link->getCatImageLink($product.category, $product.id_category_default, 'medium_default')}" /> <h3>{assign var='catname' value=Category::getCategoryInformations(array($product.id_category_default))} <span>{$catname[$product.id_category_default].name}</span></h3> <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getCategoryLink({$product.id_category_default})}"><span class="more-icon">{l s='More'}</span></a> {/if} {break} {/foreach} 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