OpenCart is one of the more popular open source eCommerce systems available. We use it here for many of our clients and like most aspects of it. One of it’s failings, however, is the lack of attention to clean URLs in the breadcrumb structure.
Fortunately this is a relatively easy fix.
As installed, the Home link in the breadcrumb navigation is the rather unweildy /index.php?route=common/home instead of pointing to the clean URL of your choice.
You will need to edit the following pages:
- /catalog/controller/category.php
- /catalog/controller/manufacturer.php
- /catalog/controller/product.php
- /catalog/controller/search.php
- /catalog/controller/special.php
Find the following code in each file:
$this->document->breadcrumbs[] = array(
‘href’ => HTTP_SERVER . ‘index.php?route=common/home’,
Replace it with this code:
$this->document->breadcrumbs[] = array(
‘href’ => ‘http://www.domain.com’,
Obviously you will need to enter your domain name.
This small change will go a long way toward cleaning up your URL structure and reduce the potential impact of having the Search Engines finding what they see as duplicate content.
You will find other pages where this needs to be fixed. Simply replace the code as needed.
“You will find other pages where this needs to be fixed. Simply replace the code as needed.”
Why thank you. Were you feeling a bit lazy today?
By the way, the directory is catalog/controller/product
and your “fix” does absolutely NOTHING. So if you’re out to make a name for yourself, you’ve started out on the wrong foot.
Thanks for the comment James. Let me reply to a few things.
1. No, not lazy, just figured that anyone interested in doing this would have special needs and would take my input and modify it for their personal needs. Also, to go through the entire code base to find all of the areas that need correcting in order to spoon feed lazy people answers was unnecessary.
2. Thanks, but I knew that.
3. You are right, It does absolutely ‘nothing’ ‘now’. If you look, this was written nearly 2 years ago and since then there have been multiple revisions of OpenCart. So it is quite likely that the code base for this solution has changed.
4. I don’t have any wrong feet, I have been accused of having two left feet, but I blame my dad for that.
Thanks for stopping by!
I don’t care how old this post is, you have helped me greatly.
Cheers.
Saved me hunting for it anyway and I found the links for the continue buttons there too…
$this->data[‘continue’] = $this->url->link(‘common/home’);
changed to
$this->data[‘continue’] = ‘/’;
Once again thanks.