Page 1 of 1

Products

Posted: Sun Dec 24, 2017 11:38 pm
by Brandt
Hello CMSMS'ers

Happy Christmas!

I have a question regarding the Products module with the following hierarchy as a menu:

- Women
-- Clothing
--- Jeans
--- Sweater
- Men
-- Clothing
--- Jeans
--- Sweater

At the position where I want my menu i put following tag:

Code: Select all

{Products action="hierarchy" hierarchytemplate="Products Menu"}
And the hierarchytemplate="Products Menu" looks like:

Code: Select all

{if !isset($hdepth) && isset($hierarchy_item)}
<h1>{$hierarchy_item.name}</h1>
{/if}

{if !isset($hdepth)}{assign var='hdepth' value='0'}{/if}

<ul {if $hdepth == 0}id="products_hierarchy"{/if} class="products_hierarchy_level{$hdepth}">
{foreach from=$hierdata key='key' item='item'}
{strip}
  {$class='product_hier'}
  {if isset($active_hierarchy) and $item.id == $active_hierarchy}{$class=$class|cat:' active'}{/if}
  {if isset($item.children)}{$class=$class|cat:' parent'}{/if}
  <li{if $class != ''} class="{$class}"{/if}>

  {if isset($item.children)}
    <a href="{$item.down_url}">{$item.name}</a>
{include file=$smarty.template hierdata=$item.children hdepth=$hdepth+1}
  {else}
    <a href="{$item.url}">{$item.name}</a>
  {/if}
  {if $nochildren}
  {/if}

  </li>
{/strip}
{/foreach}
</ul>
First question:
How do I get to show all jeans and sweater when I click on clothing?

The ul part of hierarchytemplate="Products Menu" is only shown in my template where I want my menu, which is great. The whole code is shown in the content part of the website.

Second question:
How is it defined that only the ul is shown in the menu and the whole code shown in the content part?

Thanks in advance!

Joep

Re: Products

Posted: Thu Jan 04, 2018 1:40 pm
by Brandt
Is there anybody who has a clue, because I have been struggling with it.

For me the most plausible was using

Code: Select all

{if !isset($hdepth) && isset($hierarchy_item)}
<h1>{$hierarchy_item.name}</h1>
{Products hierarchy="default"}
{/if}
… but no succes.

Anybody? Please!