1

Is it possible to use the sub-category thumbnails as a link to the category? So that you can click the thumbnail instead of the text, if yes, can you then also remove the text?

2 Answers 2

0

Create a static block with the code: subcategories and insert:

{{block type="core/template" template="catalog/category/sub.phtml"}}

Create catalog/category/sub.phtml

<?php
$category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
$categories = $category->getCollection()
        ->addAttributeToSelect(array('name', 'thumbnail'))
        ->addAttributeToFilter('is_active', 1)
        ->addUrlRewriteToResult()
        ->addIdFilter($category->getChildren())
?>
<ul class="subcategories">
    <?php foreach ($categories as $category): ?>
        <li>
            <a href="<?php echo $category->getUrl() ?>"><img src="<?php echo Mage::getBaseUrl('media') . 'catalog' . DS . 'category' . DS . $category->getThumbnail() ?>" alt="<?php echo $this->htmlEscape($category->getName()) ?>" />
                <span><?php echo $category->getName() ?></span></a>
        </li>
    <?php endforeach; ?>
</ul>

Now assign and set whatever root category you want to show its sub categories as their thumbnails with the assigned subcategories CMS Block created. Make sure Display mode is set to either Static block only or Products and Static block.

Source:

In order to resize the category icons/thumbnails you'll need this:

Resize Category Images:

With the above installed the change to make is:

<?php //echo Mage::getBaseUrl('media') . 'catalog' . DS . 'category' . DS . $category->getThumbnail() ?>
<img src="<?php echo $this->helper('timage')->init(Mage::getBaseUrl('media') . 'catalog' . DS . 'category' . DS . $category->getThumbnail())->resize(null, 140) ?>" width="140" height="140" alt="<?php echo $this->htmlEscape($category->getName()) ?>" />
0

Yes you can. first get the category collection. in that collection give same anchor tag to thumb also which is given to it's title.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.