Page 1 of 1

how to display breadcrumb in between left and right column?

Posted: Mon Dec 28, 2009 11:47 am
by superuser
Can I know what file o edit in order to get the breadcrumb display between left and right column(above the page content and not in the header file)?

I tried to cut and paste the breadcrumb script from the header.tpl to a new breadcrumb.tpl file.

Code: Select all

<div id="breadcrumb">
      <?php foreach ($breadcrumbs as $breadcrumb) { ?>
      <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
      <?php } ?>
    </div> 
Then I create a new breadcrumb.php in controller/common

Code: Select all

<?php   
class ControllerCommonBreadcrumb extends Controller {
	protected function index() {
		$this->language->load('common/header');
		
		$this->data['breadcrumbs'] = $this->document->breadcrumbs;
		
		
		$this->id = 'breadcrumb';

		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/breadcrumb.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/common/breadcrumb.tpl';
		} else {
			$this->template = 'default/template/common/breadcrumb.tpl';
		}
		
    	$this->render();
	}
}
?>
Finally I testing it in the product page by adding <?php echo $breadcrumbs; ?> somewhere in the product.tpl

However, it shows:
Notice: Undefined variable: breadcrumbs in /home/mysite/public_html/catalog/view/theme/default/template/product/product.tpl on line 8
May I know anything wrong with my code? Thank you!

Re: how to display breadcrumb in between left and right column?

Posted: Mon Dec 28, 2009 8:18 pm
by vimal
In the css file. Check for

#breadcrumb {
padding: 0px 0px 5px 15px;
}

Change the value of red number to align it in the center.

Re: how to display breadcrumb in between left and right column?

Posted: Tue Dec 29, 2009 11:02 am
by superuser
vimal wrote:In the css file. Check for

#breadcrumb {
padding: 0px 0px 5px 15px;
}

Change the value of red number to align it in the center.

Thanks for your suggestion vimal...

However, if i do it that way, the left and right column will appear below the breadcrumb.

Do you have any other idea?

Re: how to display breadcrumb in between left and right column?

Posted: Wed Dec 30, 2009 6:41 pm
by vimal
I tried to change the home file and it works on the first page but not sure how to get it on all the pages. There are files form column left and right but none for center! hehe

Anyone could point to how to modify the column middle for all pages?

Re: how to display breadcrumb in between left and right column?

Posted: Wed Jan 13, 2010 12:19 am
by christopherdarling

Code: Select all

<?php foreach (Controller::__get('document')->breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
<?php } ?>
in your .tpl file will get the breadcrumbs

Re: how to display breadcrumb in between left and right column?

Posted: Wed Jan 13, 2010 12:28 am
by christopherdarling
p.s. you will need to add that for each .tpl file that you want it to display on.. i.e.

templates/product/category.tpl
templates/product/product.tpl
etc..


Alternatively, you can make it appear inside the middle column by using CSS and floats. That will avoid having to edit each .tpl file