CMS MADE SIMPLE FORGE

Products

 

[#7246] Trouble with breadcrumb in detail page

avatar
Created By: yann lamy (snatch1974)
Date Submitted: Fri Nov 25 05:31:34 -0500 2011

Assigned To: Robert Campbell (calguy1000)
Version: 2.15.1
CMSMS Version: 1.10.2
Severity: None
Resolution: None
State: Open
Summary:
Trouble with breadcrumb in detail page
Detailed Description:
with différent levels of hierarchy, when we are on the detail page of an itel in
the last hierarchy level, the breadcrumb doesn't  print the right hierarchy of
the item. it prints the différents first levels.

example:
 we have 4 levels: 'level1', 'level2', 'level3', 'level4'
we have 2 sub-levels in each level: 'sublevel1.1', 'sublevel1.2',
'sublevel2.1', 'sublevel2.2'....
we have 2 last-levels in each sub-level: 'lastlevel1.1.1', 'lastlevel1.1.2',
'lastlevel1.2.1'...

for an item witch is in 'lastlevel1.1.2', the breadcrumb prints:

Breadcrumb: level1 > level2 > level3

instead of:

Breadcrumb: level1 > sublevel1. > lastlevel1.1.2




History

Comments
avatar
Date: 2011-12-13 06:34
Posted By: Antoine Bajard (Gast00n)

Seems like a confusion between id & item_order into get_hierarchy_path function

I fixed it by replacing lines 95-100 of class.hierarchy_ops.php : 

$breadcrumbs = array();
    foreach($tmp as $one)
      {
	$breadcrumbs[] = (int)$one;
      }
    return $breadcrumbs;

become :

$breadcrumbs = array();
    $db = cmsms()->GetDb();
	$prev_one = -1 ;
	foreach($tmp as $one)
     {
		  $query = 'SELECT * FROM '.cms_db_prefix().'module_products_hierarchy
               WHERE parent_id = ? AND item_order = ?';
    	$row = $db->GetRow($query,array($prev_one, $one * 1));
		if ( $row )
		{
			$breadcrumbs[] = $row["id"];
		}
		$prev_one = $one * 1 ;
    }
    return $breadcrumbs;
      
avatar
Date: 2011-12-13 07:41
Posted By: yann lamy (snatch1974)

Your fix works with two levels but not with 3 or more!
      
avatar
Date: 2011-12-21 11:27
Posted By: Deleted User (deleteduser_11200)

I can confirm this bug.

Created a hierarchy like:

- Main
-- Sub 1
-- Sub 2
-- Sub 3

I added 3 products one,two,tree

On the detailview.

product "one" shows "Main >> Main" as breadcrumb <------------ weird the first
product is assigned to the second level "--Sub 1"
product "two" shows "Main >> Sub 2" as breadcrumb
product "one" shows "Main >> Sub 3" as breadcrumb 
      
Updates

Updated: 2011-12-13 07:41
resolution_id: => 5