Hi there,
I'm trying to put the name of the category in the summary template.
I'm using the Products module.
I saw another post about this but it didn't help me.
http://forum.cmsmadesimple.org/viewtopi ... ry#p252563
Can anybody explain this to me?
Many thanks.
Gr. Job
Get category in summary template [Prodcuts]
Re: Get category in summary template [Prodcuts]
Ok - I had to try and do this too. the following solution is a bit hacky and a real coder will be able to give you a better way to do it I am sure, but as a simple trick, stick this at the top of your summary template - it simply grabs the first product on the page's category and sticks it at the top of the list.
{assign var='number' value=1}
{foreach from=$items item=entry}
{if isset($entry->categories)}<br />
{foreach from=$entry->categories item='category'}
{if $number == 1}
<h1>{$category->name}</h1>
{/if}
{assign var='number' value=2}
{/foreach}
{/if}
{/foreach}
{assign var='number' value=1}
{foreach from=$items item=entry}
{if isset($entry->categories)}<br />
{foreach from=$entry->categories item='category'}
{if $number == 1}
<h1>{$category->name}</h1>
{/if}
{assign var='number' value=2}
{/foreach}
{/if}
{/foreach}