philbydevil wrote:BTW - I added the sub-category images to the sub-categories list. I think it's good this way. Might as well use the images if they're there.
EDIT - actually, this isn't working correctly. It's using the parent category thumb, not the individual thumb from each sub-category.
Here's my code:
Code: Select all
<?php } ?>
<?php if ($categories) { ?>
<h2> <?php echo $text_sub_category; ?></h2>
<div class="category-list">
<?php if (count($categories) <= 5) { ?>
<ul>
<?php foreach ($categories as $category) { ?>
<li><?php if ($thumb) { ?><a href="<?php echo $category['href']; ?>"><img src="<?php echo $thumb; ?>" alt="<?php echo $heading_title; ?>" img style="vertical-align:middle" /><?php } ?>
<b> <?php echo $category['name']; ?></a></b></li>
<?php } ?>
</ul>
<?php } else { ?>
<?php for ($i = 0; $i < count($categories);) { ?>
<ul>
<?php $j = $i + ceil(count($categories) / 4); ?>
<?php for (; $i < $j; $i++) { ?>
<?php if (isset($categories[$i])) { ?>
<li><?php if ($thumb) { ?><a href="<?php echo $categories[$i]['href']; ?>"><img src="<?php echo $thumb; ?>" alt="<?php echo $heading_title; ?>" img style="vertical-align:middle" /><?php } ?>
<b> <?php echo $categories[$i]['name']; ?></a></b></li>
<?php } ?>
<?php } ?>
</ul>
<?php } ?>
<?php } ?>
</div>
hi, to and the thumb to each subcategory, pls do like this:
- open the catalog/controller/news/category.php
- search this block
Code: Select all
$this->data['categories'][] = array(
'name' => ($this->config->get('news_setting_article_count')) ? $result['name'] . ' (' . $article_total . ')' : $result['name'],
'href' => $this->url->link('news/category', 'npath=' . $this->request->get['npath'] . '_' . $result['news_category_id'] . $url),
);
- right after the first line of that block, add this line:
Code: Select all
'thumb' => $this->model_tool_image->resize(($result['image']) ? ($result['image']) : 'news_logo.png', 100, 100),
- you can change the number 100 to other size you like
- in the block of you added code to the category.tpl, search
Code: Select all
<?php if ($thumb) { ?><a href="<?php echo $category['href']; ?>"><img src="<?php echo $thumb; ?>
- replace the
$thumb with
$category['thumb']
umh, how to say, I can't not make sure your code is correct to display as you like.
I have just show you how to get the individual thumb from each sub-category (by edit the category.php) and how to use that value in the code you added.