Move opencart gift voucher

Avatar
  • updated
  • Answered
Hi
Im a noob to eCommerce and busy building my first opencart shop. Is it possible to to move the Gift voucher link in the footer to my categories menu?

Regards
Pinned replies
Avatar
JacobIMH
  • Answer
  • Answered

Hello bintecs, and thank you for your question.


The easiest way to get your Gift voucher link up to your top categories menu would be to edit a OpenCart template.


By default you should have a header template file that is building up the menu in the following location:

/catalog/view/theme/default/template/common/header.tpl


If you edit that file around line 93 you can manually put the Gift voucher link into the menu.


You'd want to look for the code in that template file that looks like this:


<div id="menu">

<ul>

<?php foreach ($categories as $category) { ?>

<li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a> <?php if ($category['children']) { ?> <div> <?php for ($i = 0; $i < count($category['children']);) { ?> <ul> <?php $j = $i + ceil(count($category['children']) / $category['column']); ?> <?php for (; $i < $j; $i++) { ?> <?php if (isset($category['children'][$i])) { ?> <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li> <?php } ?> <?php } ?> </ul> <?php } ?> </div> <?php } ?> </li> <?php } ?>

</ul>


Between the those two lines at the end &lt?php } ?> and </ul> you'd want to add your link. So it would end up looking like this:

<?php } ?> <li><a href="./index.php?route=account/voucher">Gift Voucher</a></li> </ul>


You can make these edits using the File Manager Code Editor in cPanel.

Hope that helps you out, if you're still having any issues getting it to work please let us know.

- Jacob

Avatar
JacobIMH
  • Answer
  • Answered

Hello bintecs, and thank you for your question.


The easiest way to get your Gift voucher link up to your top categories menu would be to edit a OpenCart template.


By default you should have a header template file that is building up the menu in the following location:

/catalog/view/theme/default/template/common/header.tpl


If you edit that file around line 93 you can manually put the Gift voucher link into the menu.


You'd want to look for the code in that template file that looks like this:


<div id="menu">

<ul>

<?php foreach ($categories as $category) { ?>

<li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a> <?php if ($category['children']) { ?> <div> <?php for ($i = 0; $i < count($category['children']);) { ?> <ul> <?php $j = $i + ceil(count($category['children']) / $category['column']); ?> <?php for (; $i < $j; $i++) { ?> <?php if (isset($category['children'][$i])) { ?> <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li> <?php } ?> <?php } ?> </ul> <?php } ?> </div> <?php } ?> </li> <?php } ?>

</ul>


Between the those two lines at the end &lt?php } ?> and </ul> you'd want to add your link. So it would end up looking like this:

<?php } ?> <li><a href="./index.php?route=account/voucher">Gift Voucher</a></li> </ul>


You can make these edits using the File Manager Code Editor in cPanel.

Hope that helps you out, if you're still having any issues getting it to work please let us know.

- Jacob