Post by eWarrior » Sat Apr 14, 2018 9:13 am

I am modifying some code for a store running OC v1.5.5.1 and have successfully managed to add the brands to the header. The only problem is that this is output in a single list.

I am attempting to divide the columns in a similar manner to the categories. So I borrowed the code that performs this operation for the categories in the header. However, I am clearly missing something as this is not working.

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

Code: Select all

<?php foreach ($manufacturers as $manufacturer) { ?>
<?php for ($i = 0; $i < count($manufacturer);) { ?>
<ul>
  <?php $j = $i + ceil(count($manufacturer) / 3); ?>
  <?php for (; $i < $j; $i++) { ?>
  <?php if (isset($manufacturer[$i])) { ?>
  <li><a href="<?php echo $manufacturer[$i]['href']; ?>"><?php echo $manufacturer[$i]['name']; ?></a></li>
  <?php } ?>
  <?php } ?>
</ul>
<?php } ?>
<?php } ?>

I'm sure for the talented individuals around here that this would be an easy fix!

Could someone advise what I have done wrong?

New member

Posts

Joined
Wed Aug 29, 2012 4:27 pm

Post by straightlight » Sat Apr 14, 2018 9:53 pm

Countless examples can be seen in your catalog/view/theme/<your_theme>/template/module folder. Almost each TPL files displays a multi-dimensional loop and segments the rows as you described above.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by eWarrior » Fri Apr 27, 2018 9:43 am

straightlight wrote:
Sat Apr 14, 2018 9:53 pm
Countless examples can be seen in your catalog/view/theme/<your_theme>/template/module folder. Almost each TPL files displays a multi-dimensional loop and segments the rows as you described above.
Yes, I have tried to understand the code, but web development is not my primary vocation.

I was hoping for some help with the above code. Looks like I will continue to work on this in the hope that I can identify the correct code.

New member

Posts

Joined
Wed Aug 29, 2012 4:27 pm
Who is online

Users browsing this forum: edkny and 126 guests