Post by Zarsk » Fri Jan 27, 2012 6:21 pm

Hi All

I've searched high and low in both standard forum and VQMOD but cannot seem to find an answer. I want to be able to offer clients the Gift Voucher link as a Category item at the top menu.

is there a way to do this.

Kind regards

Andy

Newbie

Posts

Joined
Thu Jan 12, 2012 5:33 pm

Post by eddieandroid » Sun Jan 29, 2012 7:46 am

hey There
I managed to do this earlier you have to have some sub categories setup for it to work, as it is I only have one sub cat and it works for me,
In the header.tpl file insert the last line below your code obivously change the domain name... and it should work..

Code: Select all

<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>
	<li><a href="http://www.yourdomain.com/index.php?route=checkout/voucher"> Vouchers</a></li>

Newbie

Posts

Joined
Sun Jan 29, 2012 7:38 am

Post by Zarsk » Mon Jan 30, 2012 6:56 pm

Hi eddieandroid
I messed about with it and indeed it works a treat!!! Brilliant, so simple. Thanks a million!!!

Newbie

Posts

Joined
Thu Jan 12, 2012 5:33 pm

Post by Bg-foxx » Wed Apr 18, 2012 11:17 pm

If you have multiple subcategories the code above will cause "Vouchers" to appear after each subcategory. The correct code is:

Code: Select all

<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 } ?>
		  <li><a href="/index.php?route=checkout/voucher">Gift Vouchers</a></li>
		</ul>
Also, note the link to your website's Voucher URL - it's relative. It's better that way. Besides, you can copy and paste the code above without the necessity of any edits.

Cheers ;D

New member

Posts

Joined
Wed Feb 22, 2012 7:55 am
Who is online

Users browsing this forum: No registered users and 16 guests