first_four_category_menu ecommerce designs
first_four_category_menu ecommerce designs

Today I am happy that someone appreciates my work as I have helped him on his e-commerce designs to show the first four menu item in Opencart.

I simply changed the code and posted it on the forum and his reply was:

You, my friend, are a legend! That is exactly what I was looking for. Thank you so much! its really appreciated. I just checked out your website, some useful information on there, bookmarked :)

Now I got more excited to help out other :), as I do it always (exaggerating).

What was the problem and how I solved it?

Problem:

wackyracer8 want to show the first four categories to meet his e-commerce designs.

first_four_category_menu e-commerce designs

Solution:

<?php if ($categories) { ?>
<div id="menu">
<ul>
<?php foreach ($categories as $key=>$category) { if($key<4){
?>
<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>
</div>
<?php } ?>

Changes done is bolded.

LEAVE A REPLY

Please enter your comment!
Please enter your name here