Re: 1.5 Subcategory Images
Posted: Tue Mar 20, 2012 8:19 pm
Is there any way of removing the sub cat image at the top within the sub categories themselves? 1.5.2.1 using custom theme (gentle).
OpenCart Community Forum - Discuss shopping cart and e-commerce solutions.
https://forum.opencart.com/
Tested on 1.5.2.1?
REPLACE WITH:$product_total = $this->model_catalog_product->getTotalProducts($data); $this->data['categories'][] = array( 'name' => $result['name'] . ' (' . $product_total . ')', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url) ); }
Save and upload.$product_total = $this->model_catalog_product->getTotalProducts($data); $image = $this->model_tool_image->resize($result['image'], 60, 60); $this->data['categories'][] = array( 'name' => $result['name'] . ' (' . $product_total . ')', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image ); }
REPLACE WITH:<?php if ($categories) { ?> <h2><?php echo $text_refine; ?></h2> <div class="category-list"> <?php if (count($categories) <= 5) { ?> <ul> <?php foreach ($categories as $category) { ?> <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></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><a href="<?php echo $categories[$i]['href']; ?>"><?php echo $categories[$i]['name']; ?></a></li> <?php } ?> <?php } ?> </ul> <?php } ?> <?php } ?> </div> <?php } ?>
Save the file and upload.<?php if ($categories) { ?> <div class="box"> <div class="box-heading"><?php echo $text_refine; ?></div> <div class="box-content"> <div class="box-product"> <?php foreach ($categories as $category) { ?> <div> <?php if ($category['thumb']) { ?> <div class="image" style="text-align: center"> <a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['thumb']; ?>" alt="<?php echo $category['name']; ?>" /></a> </div> <?php } ?> <div style="text-align: center"><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></div></div> <?php } ?> </div> </div> </div> <?php } ?>
Not yetGoncharenko wrote:Tested on 1.5.2.1?
Code: Select all
<div class="pagination"><?php echo $pagination; ?></div>
YesGoncharenko wrote:Tested on 1.5.2.1?
Yes, just use http://forum.opencart.com/viewtopic.php ... 60#p268278 guideThuNderGr wrote:Does this mod work on 1.5.4.1?
Code: Select all
<modification>
<id>Subcategory Images</id>
<version>1.0</version>
<vqmver>1.2.3</vqmver>
<author>vger.co.uk</author>
<file name="catalog/controller/product/category.php">
<operation>
<search position="replace" index="1" offset="6"><![CDATA[
$product_total = $this->model_catalog_product->getTotalProducts($data);
]]></search>
<add><![CDATA[
$product_total = $this->model_catalog_product->getTotalProducts($data);
$image = $this->model_tool_image->resize($result['image'], 60, 60);
$this->data['categories'][] = array(
'name' => $result['name'] . ' (' . $product_total . ')',
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
'thumb' => $image
);
}
]]></add>
</operation>
</file>
<file name="catalog/view/theme/*/template/product/category.tpl">
<operation>
<search position="replace" index="1" offset="22"><![CDATA[
<?php if ($categories) { ?>
]]></search>
<add><![CDATA[
<?php if ($categories) { ?>
<div class="box">
<div class="box-heading"><?php echo $text_refine; ?></div>
<div class="box-content">
<div class="box-product">
<?php foreach ($categories as $category) { ?>
<div>
<?php if ($category['thumb']) { ?>
<div class="image" style="text-align: center">
<a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['thumb']; ?>" alt="<?php echo $category['name']; ?>" /></a>
</div>
<?php } ?>
<div style="text-align: center"><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></div></div>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
]]></add>
</operation>
</file>
</modification>
Code: Select all
<?php if (count($categories) <= 5) { ?>
With difficulty.dodokids wrote:Is it possible to insert subcategorie images without resize?