Page 1 of 3
Products 2.8 > how to use hierarchy and categorylist ?
Posted: Wed May 19, 2010 2:24 pm
by athena_pallas
Hello,
I just upgraded Products and {Products action='hierarchy'} doesn't work anymore.
Release notes says "You should read the help for information as to how to use the new view." but there are no indications about using this new view in the help.
useoldhierarchy dont't works for me
Code: Select all
{Products action='hierarchy' lang='fr_FR' hierarchytemplate='short_hierarchy' useoldhierarchy='1'}
other problem :
Code: Select all
{Products action='categorylist' lang='fr_FR' categorylisttemplate='fr-categorylist'} doesn't work
Does somebody have any idea ? Thanks.
Re: Products 2.8: Hierarchy not showing up in template
Posted: Mon May 24, 2010 12:54 am
by admsh
same problem here. upgraded to 2.8 and the store went blank... doesn't show hierarchy anymore.
only thing i could figure out was to remove all products form their position in the hierarchy and now they show up on root. i don't have many products so it's not a huge deal for the time being... but i've banged my head at the screen for a couple of hours trying to figure this out. bug?
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Mon May 24, 2010 5:33 am
by Coldman
Code: Select all
(optional) useoldhierarchy="Use old hierarchy mode which generates a flat list of hierarchies below the current level. This mode is deprecated and will be removed at a later date."
A) Go to the default templates tab and click on the 'restore to defaults' button for the 'hierarchy template'
B) Go to the hierarchy templates tab and create a new hierarchy template.
Try {Products action="hierarchy" useoldhierarchy="1" hierarchytemplate="YOUR NEW TEMPLATE"}
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Mon May 24, 2010 9:04 am
by maranc
Use parameter "useoldhierarchy" is temporary solution, autor of module Porducts wrote, that in next relese this parameter will be not supported:
"useoldhierarchy="Use old hierarchy mode which generates a flat list of hierarchies below the current level. This mode is deprecated and will be removed at a later date." -"
I have the same problem such all above and haven't any solution (for me parameter "useoldhierarchy" is working without any changes in hierarchyy templates). It's wiil be good, if autor module Calgay write how use hierarchy now after upgrade to 2.8.
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Mon May 24, 2010 12:58 pm
by Coldman
maranc
Try this:
1) Create a test template.
2) Add your current hierarchy template beetween {else} {/if}
See example down here.
3) Call it with {Products action="hierarchy" useoldhierarchy="1" hierarchytemplate="YOUR TEST TEMPLATE"}
Code: Select all
{* hierarchy report template *}
{if !isset($hdepth)}
<h3>Hierarchy Data for {$hierarchy_item.name} ({$hierarchy_item.id})</h3>
{/if}
{if isset($hierdata)}
{if !isset($hdepth)}{assign var='hdepth' value='0'}{/if}
{*
// create a nested set of unordered lists
// if the active_hierarchy smarty variable exists
// and matches the current hierarchy id
// the active class will be given
// to the ul. You may want to modify your summary template
// to set this variable
*}
{foreach from=$hierdata key='key' item='item'}
{strip}
{if $key == $datakey}
{* it's a node we display it *}
<li {if isset($active_hierarchy) and $item.id == $active_hierarchy} active{/if}>{if $item.count gt 0}<a href="{$item.url}">{$item.name} ({$item.count})</a>{else}{$item.name} ({$item.count}){/if}</li>
{else}
{* it's a child -- call this template again with the node *}
<ul class="products_hierarchy_level{$hdepth}">
{include file=$smarty.template hierdata=$item datakey='node' hdepth=$hdepth+1}
</ul>
{/if}
{/strip}
{/foreach}
{* old hierarchy stuff *}
{else}
[b]Add your current hierarchy template here [/b]
{/if}{* old hierarchy stuff *}
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Tue May 25, 2010 9:06 am
by maranc
Thanks, but I dont have problem with my template. If I use {Products action="hierarchy" useoldhierarchy="1"} everythings works fine and on page I see my hierarchy (I use default hierarchy template). But I'm serching answer for question: why hierarchy dosen't works now after upgrade?
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Tue May 25, 2010 4:31 pm
by Coldman
If you read changelog:
Adds a true hierarchy mode.
Note: This will break existing sites using the older hierarchy view. You should read the help for information as to how to use the new view.
That's why.
/Coldman
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Tue May 25, 2010 6:55 pm
by maranc
Yes, I have read this description, but in help information isn't any description how use hierarchy template to display hierarchy product witch I prepared with older version module Product. More - when I make new template with default code:
{* hierarchy report template *}
Hierarchy Data for {$hierarchy_item.name} ({$hierarchy_item.id})
{if isset($upurl)}
Lang('parent')}">{$mod->Lang('parent')}
{/if}
{assign var='prodmod' value=$mod}
{if isset($parent)}
This Node
Name: {$parent.name}
Description: {$parent.description}
{/if}
Child Nodes
{if isset($child_nodes) && count($child_nodes)}
{foreach from=$child_nodes item='node'}
{if isset($node.downurl)}
{$node.name}
{else}
{$node.name}
{/if}
{if !empty($node.image)}
{capture assign='image'}{$hierarchy_image_location}/{$node.image}{/capture}
{capture assign='name'}{$node.name}{/capture}
{if !empty($node.thumbnail)}
{capture assign='thumb'}{$hierarchy_image_location}/{$node.thumbnail}{/capture}
{else}
{/if}
{/if}
{if !empty($node.description)}
Description: {$node.description}
{/if}
{/foreach}
{/if}
Products matching this location in hierarchy
{Products hierarchyid=$hierarchy_item.id}
I dont see my product hierarchy on page. BTW - your code in template works fine, when I make new template example: "test" and set it as default template, I can see hierarchy.
Best regards,
Marek A.
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Fri May 28, 2010 11:10 am
by maranc
Coldman wrote:
maranc
Try this:
1) Create a test template.
2) Add your current hierarchy template beetween {else} {/if}
See example down here.
3) Call it with {Products action="hierarchy" useoldhierarchy="1" hierarchytemplate="YOUR TEST TEMPLATE"}
Code: Select all
{* hierarchy report template *}
{if !isset($hdepth)}
<h3>Hierarchy Data for {$hierarchy_item.name} ({$hierarchy_item.id})</h3>
{/if}
{if isset($hierdata)}
{if !isset($hdepth)}{assign var='hdepth' value='0'}{/if}
{*
// create a nested set of unordered lists
// if the active_hierarchy smarty variable exists
// and matches the current hierarchy id
// the active class will be given
// to the ul. You may want to modify your summary template
// to set this variable
*}
{foreach from=$hierdata key='key' item='item'}
{strip}
{if $key == $datakey}
{* it's a node we display it *}
<li {if isset($active_hierarchy) and $item.id == $active_hierarchy} active{/if}>{if $item.count gt 0}<a href="{$item.url}">{$item.name} ({$item.count})</a>{else}{$item.name} ({$item.count}){/if}</li>
{else}
{* it's a child -- call this template again with the node *}
<ul class="products_hierarchy_level{$hdepth}">
{include file=$smarty.template hierdata=$item datakey='node' hdepth=$hdepth+1}
</ul>
{/if}
{/strip}
{/foreach}
{* old hierarchy stuff *}
{else}
[b]Add your current hierarchy template here [/b]
{/if}{* old hierarchy stuff *}
Hi Coldman, yesterday I upgraded module to ver. 2.8.1 and I must tell you, that your template don't work with this version. But hier is one change - default hierarchy template now works fine - but hier is one little bug: default hierarchy template show only parent, when I click on parent I dont see child. The same is with parameter "useoldhierarchy": I see only parent. I thing its a litlle bug in module. I'm not expert in smarty etc. If someone can look in code default hierarchy template and tell what is wrong:
{* hierarchy report template *}
Hierarchy Data for {$hierarchy_item.name} ({$hierarchy_item.id})
{if isset($upurl)}
Lang('parent')}">{$mod->Lang('parent')}
{/if}
{assign var='prodmod' value=$mod}
{if isset($parent)}
This Node
Name: {$parent.name}
Description: {$parent.description}
{/if}
Child Nodes
{if isset($child_nodes) && count($child_nodes)}
{foreach from=$child_nodes item='node'}
{if isset($node.downurl)}
{$node.name}
{else}
{$node.name}
{/if}
{if !empty($node.image)}
{capture assign='image'}{$hierarchy_image_location}/{$node.image}{/capture}
{capture assign='name'}{$node.name}{/capture}
{if !empty($node.thumbnail)}
{capture assign='thumb'}{$hierarchy_image_location}/{$node.thumbnail}{/capture}
{else}
{/if}
{/if}
{if !empty($node.description)}
Description: {$node.description}
{/if}
{/foreach}
{/if}
Products matching this location in hierarchy
{Products hierarchyid=$hierarchy_item.id}
Marek A.
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Wed Jun 09, 2010 1:00 pm
by Stom
Also having this problem. Using the (simplified) template below:
Code: Select all
{if !isset($hdepth)}
<h3>Hierarchy Data for {$hierarchy_item.name} ({$hierarchy_item.id})</h3>
{/if}
{if isset($hdepth)}
{$hdepth}
{/if}
{if !isset($hdepth)}{assign var='hdepth' value='0'}{/if}
<ul class="products_hierarchy_level{$hdepth}">
{foreach from=$hierdata key='key' item='item'}
{strip}
{if isset($item.node)}
<div class="hierarchy-category">
{if isset($item.node.url)}<a href="{$item.node.url}" title=" View {$item.node.name}">{/if}<h4>{$item.node.name}</h4>{if isset($item.node.url)}</a>{/if}
</div>
{/if}
{/strip}
{/foreach}
</ul>
The root hierarchy shows fine. eg
http://website.com/products.html
As soon as you click on a child hierarchy you get redirected to something similar to:
http://website.com/products/byhierarchy/1/56.html and it shows nothing in the content area.
Products module is being called with: {Products action="hierarchy" hierarchytemplate="test"}
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Wed Jun 09, 2010 3:17 pm
by maranc
I have the same, I use module in last newest version (2.8.2). The same is when I use parameter "useoldhierarchy": I see only "parent", and when I click on parent I dont see list of childs. New sample hierarchy template dont work for me, my old template with parameter "useoldhierarchy" work's as I wrote... I dont know what's happend. I thing that many user witch had upgraded module from older version (2.7 etc.) have the same problem. Any ideas?
Best regards,
Marek A.
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Wed Jun 09, 2010 3:27 pm
by janb
Try this one.. (new default template from v.2.8.2)
Code: Select all
{* hierarchy report template *}
{if !isset($hdepth)}
<h3>Hierarchy Data for {$hierarchy_item.name} ({$hierarchy_item.id})</h3>
{/if}
{if !isset($hdepth)}{assign var='hdepth' value='0'}{/if}
{*
// create a nested set of unordered lists
// if the active_hierarchy smarty variable exists
// and matches the current hierarchy id
// the active class will be given
// to the ul. You may want to modify your summary template
// to set this variable
*}
<ul class="products_hierarchy_level{$hdepth}">
{foreach from=$hierdata key='key' item='item'}
{strip}
{if isset($item.node)}
<li {if isset($active_hierarchy) and $item.node.id == $active_hierarchy} active{/if}>{if $item.node.count gt 0}<a href="{$item.node.url}">{$item.node.name} ({$item.node.count})</a>{else}{$item.node.name} ({$item.node.count}){/if}</li>
{/if}
{if $key|is_numeric}
{* it's a child -- call this template again with the node *}
{include file=$smarty.template hierdata=$item hdepth=$hdepth+1}
{/if}
{/strip}
{/foreach}
</ul>
JanB
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Thu Jun 10, 2010 3:49 pm
by Stom
JanB,
Thanks for the suggestions. The default template works fine but not if you want to customise it. Image a store with the following hierarchy:
- Section A
- - - Sub section 1
- - - Sub section 2
- - - Sub section 3
- Section B
- - - Sub section 1
- - - Sub section 2
- - - Sub section 3
- Section C
- - - Sub section 1
- - - Sub section 2
- - - Sub section 3
- Section D
- - - Sub section 1
- - - Sub section 2
- - - Sub section 3
Now, you dont want to display all the parents and children in one go, instead when viewing the root page you only want to see Sections A, B, C & D. But if these have no products in them directly it doesn't work. Modifying the default template by removing the
will force a link, but that link doesn't work either. Instead, you get an empty page.
In previous version of the products module it was possible to only show the current level and not it's children but this feature seems to have been removed. I can't find any reference to the parameter in the Products module help page. Perhaps I'm missing something?
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Thu Jun 10, 2010 4:03 pm
by janb
Hi
I have fight with this for a while and got a solution for my own purpose.
Showing A,B,C,D with link to a category page (with the category picture and info +"selected" products)
Sub sections are going directly to the product subcategories.
In addition i use jquery accordion to hide sub-sections until i click or mouse-over.
I'm not sure it's ready for the public sorry about that! (have done some tricky things and i'm not sure this is the way to go)
Now i'm waiting for the next release of CG e-commerce suite modules, CG have done some work on the modules lately...
JanB
Re: Products 2.8 > how to use hierarchy and categorylist ?
Posted: Fri Jun 11, 2010 1:00 pm
by maranc
Default new hierarchy template work, but:
- dont show an image of parent, childs
- dont show description of parent, childs etc.
How display image and description?
Marek A.