How to create breadcrumb in OpenCart?

Objectives of the blog

Breadcrumbs typically appear horizontally across the top of a web page, often below title bars or headers allows users to keep track of their locations within pages.

After reading this blog we will be able to add custom breadcrumb in Opencart page.

Problem Statement

Many of the paid custom theme does not provide breadcrumbs in their theme. But it’s not that hard for a user to add a breadcrumb in OpenCart pages.

Refer below screenshot for the same:

breadcrumb in OpenCart pages


You just need to add block of  code in your custom view template file of page in which you want to add breadcrumb. Block of code is as follow –


<div class="page-top">
<div class="container">
<ol class="breadcrumb">
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<li><a href="<?php echo $breadcrumb['href']; ?>"><?php if($breadcrumb['text'] != '<i class="fa fa-home"></i>') { echo $breadcrumb['text']; } else { if($theme_options->get( 'home_text', $config->get( 'config_language_id' ) ) != '') { echo $theme_options->get( 'home_text', $config->get( 'config_language_id' ) ); } else { echo 'Home'; } } ?></a></li>
<?php } ?>
</div><!-- End .container -->


You can add the above code  after <?php echo $column_left; ?> declaration.

This custom breadcrumb can be added on product pages, account pages, category pages and others.

$breadcrumb variable called in above tpl is already defined in all the pages controller in opencart. It is defined in below format in controller file of page –

$data['breadcrumbs'] = array();

$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home')
$data['breadcrumbs'][] = array(
'text' => $category_info['name'],
'href' => $this->url->link('product/category', 'path=' . $path)


Once, you added the code in tpl file you can check your breadcrumb on your page. Please check our custom breadcrumb  (HOME | FORD TRACTOR ANCHOR PATTI SET) on product page below –


custom breadcrumb


After reading the above solution, you will be able to add your own custom breadcrumb in the OpenCart pages.

Leave a Reply

Your email address will not be published. Required fields are marked *