Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add parent category to breadcrumbs path


Guest

Recommended Posts

Posted

Hi,

 

I've just installed osCommerce, and the STS modification, and I've noticed that in the $breadcrumbs function only displays 'Top > Catalog > Accessories' (Accessories being a sample category). Is it possible to display the parent category of Accessories before it, so it reads 'Top > Catalog > Parent Category > Accessories'? I've done a bit of Googling and I couldn't find the answer.

 

Cheers!

Posted
Hi,

 

I've just installed osCommerce, and the STS modification, and I've noticed that in the $breadcrumbs function only displays 'Top > Catalog > Accessories' (Accessories being a sample category). Is it possible to display the parent category of Accessories before it, so it reads 'Top > Catalog > Parent Category > Accessories'? I've done a bit of Googling and I couldn't find the answer.

 

Cheers!

 

catalog/includes/classes/breadcrumb.php

 

<?php
/*
 $Id: breadcrumb.php,v 1.3 2003/02/11 00:04:50 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class breadcrumb {
var $_trail;

function breadcrumb() {
  $this->reset();
}

function reset() {
  $this->_trail = array();
}

function add($title, $link = '') {
  $this->_trail[] = array('title' => $title, 'link' => $link);
}

function trail($separator = ' - ') {
  $trail_string = '';

  for ($i=0, $n=sizeof($this->_trail); $i<$n; $i++) {
	if (isset($this->_trail[$i]['link']) && tep_not_null($this->_trail[$i]['link'])) {
	  $trail_string .= '<a href="' . $this->_trail[$i]['link'] . '" class="headerNavigation">' . $this->_trail[$i]['title'] . '</a>';
	} else {
	  $trail_string .= $this->_trail[$i]['title'];
	}

	if (($i+1) < $n) $trail_string .= $separator;
  }

  return $trail_string;
}
 }
?>

 

this is my file and my site lists all of the categories and subcategories.

I thought this stuff was gonna be easy!!

BACK IT UP BEFORE YOU JACK IT UP!!!!

Posted

I'll give that a go, thanks very much for your help.

 

Edit: Didn't work, it's the same file as I've got. It still displays 'Top > Catalog > Accessories'. Do I have to edit the script to make it display the parent category or something?

Posted

Whoops, turns out I was linking it wrong. I was just linking to index.php?cPath=26 rather than index.php?cPath=25_26 :blush:

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...