
How can I put small thumbnails of category images before the name of the category? I know it's one line of code, but...

Thanks in advance.
Code: Select all
$product_total = $this->model_catalog_product->getTotalProducts($data);
Code: Select all
if($result['image'])
{
$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
}
else
{
$image = '';
}
Code: Select all
$this->data['categories'][] = array(
'name' => $result['name'] . ' (' . $product_total . ')',
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
);
Code: Select all
$this->data['categories'][] = array(
'name' => $result['name'] . ' (' . $product_total . ')',
'image' => $image,
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
);
Code: Select all
<li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
Code: Select all
<li>
<?php if ($category['image']){ ?>
<a href="<?php echo $category['href']; ?>">
<img src="<?php echo $category['image']; ?>" title="<?php echo $category['name']; ?>" alt="<?php echo $category['name']; ?>" />
</a>
<?php } ?>
<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
</li>
Code: Select all
$this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
Code: Select all
$this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
You would do that with CSS. Unless I am not understanding your question.jimaras wrote:Can we add the images in the same row?
Good call. I agree.Script webshop wrote:Nice one butt why useWhy notCode: Select all
$this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
Code: Select all
$this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
Sweet! Worked fine for me in 1.5.1.3 (using Script webshop's minor change).pagetopixel wrote:In catalog/controller/product/category.php
around line 134 findand paste below itCode: Select all
$product_total = $this->model_catalog_product->getTotalProducts($data);
Then below that you will seeCode: Select all
if($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')); } else { $image = ''; }
Change toCode: Select all
$this->data['categories'][] = array( 'name' => $result['name'] . ' (' . $product_total . ')', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url) );
Then in /catalog/view/theme/yourtheme/template/product/category.tplCode: Select all
$this->data['categories'][] = array( 'name' => $result['name'] . ' (' . $product_total . ')', 'image' => $image, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url) );
line 25 changetoCode: Select all
<li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
Code: Select all
<li> <?php if ($category['image']){ ?> <a href="<?php echo $category['href']; ?>"> <img src="<?php echo $category['image']; ?>" title="<?php echo $category['name']; ?>" alt="<?php echo $category['name']; ?>" /> </a> <?php } ?> <a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a> </li>
Then style away
Code: Select all
$product_total = $this->model_catalog_product->getTotalProducts($data);
if($result['image'])
{
$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
}
else
{
$image = '';
}
Code: Select all
else
{
$image = '';
Users browsing this forum: Amazon [Bot], Baidu [Spider] and 103 guests