CMS MADE SIMPLE FORGE

Products

 

[#7999] In Hierarchy Report $hierdata $item.url is generating a Product Summary link instead of Hierarchy Report link

avatar
Created By: Kenneth Griffith (kendo451)
Date Submitted: Tue May 29 04:37:58 -0400 2012

Assigned To: Robert Campbell (calguy1000)
Version: 2.17
CMSMS Version: 1.10.3
Severity: Minor
Resolution: Invalid
State: Closed
Summary:
In Hierarchy Report $hierdata $item.url is generating a Product Summary link instead of Hierarchy Report link
Detailed Description:
I have found a discrepancy in the way hierarchy works that explains a previously
submitted "works for me" bug: (http://dev.cmsmadesimple.org/bug/view/6066)

Given a simple 1-level hierarchy with three hierarchy items, and each item
having several product items, the products page has the tag:
{Products action='hierarchy' detailpage='products'}

TOP LEVEL:
Visiting the Products page, you will see the three child hierarchy items of the
top level.
$hierdata is populated with the three child hierarchy items.
$hierarchy_item is empty
Template = Hierarchy Report

CHILD LEVEL 1:
If you click on one of the child hierarchy items, the page will refresh to show
a list of child products of the hierarchy item with the following info:
$hierdata is empty
$hierarchy_item is empty
Template = Product Summary

The only way to obtain the Hierarchy Item Name for this page is to get the
$entry->breadcrumb from one of the products in $items.  If I use this breadcrumb
it produces a link to the Hierarchy Item Name...more on this below.

CHILD LEVEL 2:
If you click on one of the products in the page above, the page goes to the
Product Detail Page for that product with the following info:
$hierdata is empty
$hierarchy_item is empty
Template = Product Detail

The $entry->breadcrumb will give a link to the parent Hierarchy Item.

BREADCRUMB HIEARCHY ITEM LINK:
If in either Level 1 or 2 above we click the Breadcrumb Link for the hierarchy
item, it takes us to a page for that hierarchy item that is DIFFERENT from the
Child Level 1 page that got us here.

$hierdata is empty (even though there are child products of this hierarchy item)
$hierarchy_item is populated with the fields for this hierarchy item.
Template = Hierarchy Report

Summary of the Problem(s):

Navingating down the hierarchy drilldown to a product, and then using Breadcrumb
links to try to go back up the way you came, leads to a different page/template
for the parent hierarchy item than you passed through on the way down.  This is
very confusing for both developer and website user.

1. When clicking on a child hierarchy item (obtained from the link in $hierdata
array), it should go to a hierarchy page for that item using the same template,
Hierarchy Report, not Product Summary as it currently does.  This url should be
the same as the one in $entry->breadcrumb for any child Products of this
hierarchy item.  Currently the URL in $hierdata is differnet from the one in
$entry->breadcrumb.

2. The Sample Hierarchy Report Template does not output any fields from
{$hierarchy_item}.  If you click on a lowest level Hierarchy Item (from the
breadcrumbs) this template will result in a blank page because: $hierdata is
empty, when it should have child Products, & the default template does not use
the $hierarchy_item fields which ARE populated.

This explains the bug reported here: http://dev.cmsmadesimple.org/bug/view/6066

Suggested Solution:

1. For the Hierarchy Report Template $hierdata should be populated with both
child hierarchy items, but there should also be an array of child products.  Or
else a separate array of child products should be included.

2. The links to child hierarchy items in $hierdata should keep within the
Hierarchy Report Template instead of going to Product Summary Template.  They
should be generated by the same bit of code that generates the
$entry->breadcrumb so that the links drilling down will be the same as if you
follow the breadcrumb back up.

3. Modify the default Hierarchy Report Template to show:
- the current $hierarchy_item
- The child Products of the current $hierarchy_item in their own array ($items)
- The child hierarchy items from $hierdata
(This will save some bug reports and support requests.)


History

Comments
avatar
Date: 2012-05-29 04:47
Posted By: Kenneth Griffith (kendo451)

I realize that perhaps leaving the child products out of the default Hierarchy
Report template was so that the developer can choose how to do it.  For example,
I display the products for that hierarchy item using this tag in the Hierarchy
Report Template:

{Products hierarchy=$hierarchy_item->name}

It may not be obvious to many that it is possible to call Products from a
Products template - because the Hierarchy Report variable names do not conflict
with the Summary report variables.

It might be a good idea to add the line above to the Sample Hierarchy Report
Template.
      
avatar
Date: 2012-05-29 05:44
Posted By: Kenneth Griffith (kendo451)

Ok, I now realized there is another variable $item.down_url that does the
correct hierarchy link.  Therefore this is not a module bug at all.  Just a
difficult to understand template.

So my suggestion to this module is to only change the templates:

1. In the sample Hierarchy template change {$item.url} to {$item.down_url}

2. In the sample Hierarchy Template include {Products action='hierarchy'
hierarchy=$hierarchy_item.name}

3. In the sample template throw in {$hierarchy_item|@print_r} so people don't
hit a blank results page at the bottom level of the hierarchy.
      
avatar
Date: 2012-06-07 05:06
Posted By: Kenneth Griffith (kendo451)

Long story short - Need a Hierarchy Summary Template that allows traversing up
and down the template, but this is not a module bug.
      
Updates

Updated: 2012-06-07 05:06
resolution_id: 5 => 9
state: Open => Closed

Updated: 2012-05-29 05:44
severity_id: 2 => 3

Updated: 2012-05-29 05:05
summary: Hierarchy Drilldown Discrepancy => In Hierarchy Report $hierdata $item.url is generating a Product Summary link instead of Hierarchy Report link

Updated: 2012-05-29 04:47
resolution_id: => 5