Breadcrumbs for the Products module
Previous article Next articleThere isn't one method for adding a breadcrumb trail to the Products module for CMS Made Simple™.
Climbing down the 'hierarchy ladder' to the product, you pass three templates and each template has its own method.
Example:
[+] Hierarchy 1 (Hierarchy template)
[+] Hierarchy 1.1 (Hierarchy template)
[+] Hierarchy 1.1.1 (Summary template)
[ - ] Product (Detail template)
How to use
Add to the Products module templates:
Hierarchy template
{products_hierarchy_breadcrumb hierarchyid=$hierarchy_item.parent_id|default:'' assign=tmp}
<a href="{root_url}">Home</a> » {if $tmp != ''}{$tmp} » {/if}{$hierarchy_item.name|default:''}
</div>
Summary template
{products_hierarchy_parent hierarchyid=$actionparams.hierarchyid assign=tmp}
{products_hierarchy_breadcrumb hierarchyid=$tmp assign=tmp2}
{$hierarchy_info = $Products->GetHierarchyInfo($active_hierarchy)}
<a href="{root_url}">Home</a> » {if $tmp2 != ''}{$tmp2} » {/if}{$hierarchy_info.name}
</div>
Detail template
<a href="{root_url}">Home</a> » {$entry->breadcrumb} » {$entry->product_name}
</div>
Comment Form
ReviewManager
ReviewManager
2 Comments
Ok, the breadcrumb loss the "list" template link : when i navigate in the hierarchies, links are good. When i go from hierachy page > list page > detail of product, and i want to come back to "list page" the link is not good ("by" missing in url).
Nota : i use Products 2.26.8
Hi, thanks for the tip!
I actually got a bug. I have 1 hierarchy with 1 sub-hierarchy and the products inside.
The breadcrumbs displays the names correctly : Home > Hierarchy > SubHierarchy > Product Name. But when i click "SubHier" to come 1 step before, i can't get all the datas of the hierarchy template, it seems after debug that $hierdata is set to 0 in the line {foreach from=$hierdata key='key' item='item'} ...
When i'm in product details, and i can come back 2 steps before to "Hierarchy1" it works nice, so the problem seems only appear in the "subHierarchy" link.