How to edit the OpenCart footer links
There are a few basic things regarding the OpenCart shopping cart system which every OC store owner is good to be aware of. In this blogpost we will cover the topic on the default footer in OpenCart and how you can easily edit the links in it. So keep on reading if you would like to learn how to:
- Edit existing links
- Delete links
- Add new links
- Bonus: Remove the ‘Powered By’ message
Note: Please, be aware that in this tutorial we will be modifying core OpenCart files and it is highly recommended to make a backup before proceeding.
Edit existing links
We will start our tutorial with the editing of existing links. The first thing that we will cover would be how to change only the names of the links.
Edit the names of the links
In order to change the names of the links in your footer, you will need to locate the following file in your server: catalog/language/the-language-that-you-are-using/common/footer.php. Open the file and go through the names of the links and change the desired ones in the following manner:
let’s suppose you would like the Information link to be renamed to Details, then you’ll need to find the following line:
$_['text_information'] = 'Information';
And change it to:
$_['text_information'] = 'Details';
After you have made the desired changes, save and upload the file to your server.
Edit the destination of the links
If you would like to edit the destination of your links, you will need to locate the following file: catalog/controller/common/footer.php. The links are defined in the following way:
$data['special'] = $this->url->link('product/special'); $data['account'] = $this->url->link('account/account', '', 'SSL');
Let’s suppose that for some reason you would like the voucher link to redirect to your shopping cart. In order to do this, you will need to modify the following line:
$data['voucher'] = $this->url->link('account/voucher', '', 'SSL');
To
$data['voucher'] = $this->url->link('checkout/cart, '', 'SSL');
This pretty much covers everything that you need to know about the modification of the existing OpenCart footer links and now we will show you how you can remove them.
Delete links
The easiest way to remove a link from your footer, is to go to catalog/view/theme/the-theme-that-you-are-using/template/common/footer.tpl.
In the general case the links are displayed in the following way
<?php if ($informations) { ?> <div class="col-sm-3"> <h5><?php echo $text_information; ?></h5> <ul class="list-unstyled"> <?php foreach ($informations as $information) { ?> <li><a href="<?php echo $information['href']; ?>"><?php echo $information['title']; ?></a></li> <?php } ?> </ul> </div> <?php } ?> <div class="col-sm-3"> <h5><?php echo $text_service; ?></h5> <ul class="list-unstyled"> <li><a href="<?php echo $contact; ?>"><?php echo $text_contact; ?></a></li> <li><a href="<?php echo $return; ?>"><?php echo $text_return; ?></a></li> <li><a href="<?php echo $sitemap; ?>"><?php echo $text_sitemap; ?></a></li> </ul> </div> <div class="col-sm-3"> <h5><?php echo $text_extra; ?></h5> <ul class="list-unstyled"> <li><a href="<?php echo $manufacturer; ?>"><?php echo $text_manufacturer; ?></a></li> <li><a href="<?php echo $voucher; ?>"><?php echo $text_voucher; ?></a></li> <li><a href="<?php echo $affiliate; ?>"><?php echo $text_affiliate; ?></a></li> <li><a href="<?php echo $special; ?>"><?php echo $text_special; ?></a></li> </ul> </div> <div class="col-sm-3"> <h5><?php echo $text_account; ?></h5> <ul class="list-unstyled"> <li><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a></li> <li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li> <li><a href="<?php echo $wishlist; ?>"><?php echo $text_wishlist; ?></a></li> <li><a href="<?php echo $newsletter; ?>"><?php echo $text_newsletter; ?></a></li> </ul> </div>
And in order to delete any of the links under each column, you can either delete or put the code in html quotes <!-- code here -->.
Example:
Let’s suppose that you would like to delete the Wishlist link under the Account column. You can either delete the row:
<div class="col-sm-3"> <h5><?php echo $text_account; ?></h5> <ul class="list-unstyled"> <li><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a></li> <li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li> <li><a href="<?php echo $wishlist; ?>"><?php echo $text_wishlist; ?></a></li> <li><a href="<?php echo $newsletter; ?>"><?php echo $text_newsletter; ?></a></li> </ul> </div>
Or put it in quotes:
<div class="col-sm-3"> <h5><?php echo $text_account; ?></h5> <ul class="list-unstyled"> <li><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a></li> <li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li> <!-- <li><a href="<?phpecho $wishlist; ?>"><?php echo $text_wishlist; ?></a></li> --> <li><a href="<?php echo $newsletter; ?>"><?php echo $text_newsletter; ?></a></li> </ul> </div>
If you would like to delete the whole column, which in our case is Account, you should either delete the whole container:
<div class="col-sm-3"> <h5><?php echo $text_account; ?></h5> <ul class="list-unstyled"> <li><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a></li> <li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li> <li><a href="<?php echo $wishlist; ?>"><?php echo $text_wishlist; ?></a></li> <li><a href="<?php echo $newsletter; ?>"><?php echo $text_newsletter; ?></a></li> </ul> </div>
Or put it in quotes:
<!-- <div class="col-sm-3"> <h5><?php echo $text_account; ?></h5> <ul class="list-unstyled"> <li><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a></li> <li><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li> <li><a href="<?php echo $wishlist; ?>"><?php echo $text_wishlist; ?></a></li> <li><a href="<?php echo $newsletter; ?>"><?php echo $text_newsletter; ?></a></li> </ul> </div> -->
Add new links
Adding new links is a little bit more complex, as it involves modifications of three files: the language file, the file in the controller and the file in the view folder. It should be done as follows:
Example:
Let’s suppose that you would like to add a link to the cart under the Extras column named ‘iSenseLabs’. First, you’ll need to go to the language file: catalog/language/the-language-that-you-are-using/common/footer.php
And add the following line:
$_['text_isenselabs'] = 'iSenseLabs';
after
$_['text_newsletter'] = 'Newsletter';
Save and upload the file.
Then go to catalog/controller/common/footer.php and add the following line:
$data['text_isenselabs'] = $this->language->get('text_isenselabs');
after
$data['text_newsletter'] = $this->language->get('text_newsletter');
Now, we have to define the page to which the link will redirect. If you would the link to lead to an existing page in your website, let’s say the shopping cart, you should add the following line:
$data['isenselabs'] = $this->url->link('checkout/cart', '', 'SSL');
However, if you would like the link to point to another website, you should define the link like:
$data['isenselabs'] = 'https://isenselabs.com/';
The line should be added after:
$data['newsletter'] = $this->url->link('account/newsletter', '', 'SSL');
Save and upload the file.
Then go to the tpl: catalog/view/theme/the-theme-that-you-are-using/template/common/footer.tpl and add the following line:
<li><a href="<?php echo $isenselabs; ?>"><?php echo $text_isenselabs; ?></a></li>
before
<li><a href="<?php echo $manufacturer; ?>"><?php echo $text_manufacturer; ?></a></li>
Save and upload the file to your server.
Now the new link will be added under the Extras column, above the Manufacturer link.
How to remove “Powered by OpenCart”
The last thing that we will show you is how you can remove the ‘Powered by’ message at the bottom of the footer. As in our other examples, the message can be removed either by deleting or quoting the following line in the
catalog/view/theme/the-theme-that-you-are-using/template/common/footer.tpl:
<p><?php echo $powered; ?></p>
The quotation should be applied in the following manner:
<!-- <p><?php echo $powered; ?></p> -->
Final Words
We hope that you will find our tutorial helpful and easy-to-follow and that it will give you a basic idea on how you can easily customize the links in the footer of your OpenCart store.