Post by Flysan » Mon Aug 31, 2015 9:24 pm

[Solved] Hello everyone, on OC 2.0.2.0 I need to display the subcategory image (thumb) beside the name when the header category dropdown menu is open. I try to get it by myself acting on code but nothing tried has worked. I need your help thanks in advance.

In the code below (header.tpl) you see where I want the subcategory image php string. It wil appear in the dropdown menu. How to customize the header.php file to achieve that?

Code: Select all

<?php if ($categories) { ?>
<div class="container">
  <nav id="menu" class="navbar">
    <div class="navbar-header"><span id="category" class="visible-xs"><?php echo $text_category; ?></span>
      <button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"><i class="fa fa-bars"></i></button>
    </div>
    <div class="collapse navbar-collapse navbar-ex1-collapse">
      <ul class="nav navbar-nav">
        <?php foreach ($categories as $category) { ?>
        <?php if ($category['children']) { ?>
        <li class="dropdown"><a href="<?php echo $category['href']; ?>" class="dropdown-toggle" data-toggle="dropdown"><?php echo $category['name']; ?></a>
          <div class="dropdown-menu">
            <div class="dropdown-inner">
              <?php foreach (array_chunk($category['children'], ceil(count($category['children']) / $category['column'])) as $children) { ?>
              <ul class="list-unstyled">
                <?php foreach ($children as $child) { ?>
                <li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>

                 SUBCATEGORY IMAGE HERE

                <?php } ?>
              </ul>
              <?php } ?>
            </div>
            <a href="<?php echo $category['href']; ?>" class="see-all"><?php echo $text_all; ?> <?php echo $category['name']; ?></a> </div>
        </li>
        <?php } else { ?>
        <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
        <?php } ?>
        <?php } ?>
      </ul>
    </div>
  </nav>
</div>
<?php } ?>
Last edited by Flysan on Thu Sep 03, 2015 10:23 pm, edited 2 times in total.

New member

Posts

Joined
Tue Apr 28, 2015 6:25 pm

Post by viethemes » Mon Aug 31, 2015 9:44 pm

I have made a VQMOD extension to do that. You download it here: https://www.dropbox.com/s/o7k1ymtx20347 ... e.xml?dl=0

http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by Flysan » Thu Sep 03, 2015 10:20 pm

It works perfectly thanks a lot.

New member

Posts

Joined
Tue Apr 28, 2015 6:25 pm
Who is online

Users browsing this forum: Baidu [Spider] and 50 guests