Page 1 of 1

Help on using Products module

Posted: Sun Feb 24, 2013 6:38 pm
by Mich-adg
Hi,
i'm trying to make a very simple thing with Products module : get the active hierarchy and category, not only in the Detail view but also in Summary view. Don't know if i don't understand this module mechanism but i can't get a simple solution to achieve it.

For example, if i have this hierarchy :
1 - Sport
a - soccer
b - basket
...
2 - Arts
a - painting
b - drawing
...

Now, i call this in one page : {Products action="hierarchy"}

If i click on "Sport", i get a summary list with "soccer", "basket" etc., but i can't get simply the active hierarchy name "Sport".
Same question if i call {Products action="categorylist"}, can't get the active category name.

After many researches on the web, i found that we can get these variables in the details views, but this is not a solution. We need these variables avaiables after the first hierarchy / category click.

Thanks for any help or explanation if i totally missed anything in the Products module use.

Re: Help on using Products module

Posted: Sun Feb 24, 2013 6:49 pm
by applejack
In the summary template to get the Hierarchy you can use

{$entry->breadcrumb}

for the categories I think you will have to put them into their own loop.

In order to see what variables are available in a template in the foreach loop you can do


{foreach from=$items|@print_r item=entry}

Re: Help on using Products module

Posted: Mon Feb 25, 2013 6:53 am
by Mich-adg
Hi, thks for the reply.

I tried to use breadcrumb in the summary template but it doesn't work.

For the moment, the best solution i found to get the active hierarchy in the summary template:

{assign var='get_hierarchy_info' value=$Products->GetHierarchyInfo($items[0]->hierarchy_id)}
<h1>{$get_hierarchy_info.name}</h1>

Now i must get the category name of item0 too.