Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Original code by Jake Rutter
- * @website: http://www.onerutter.com/web/magento-custom-category-images-listing-block-tutorial.html#idc-ctools
- * Fixed by func0der
- *
- **/
- <div id="categories">
- <div class="col_full">
- <div class="listing" >
- <?php
- $_maincategorylisting = $this->getCurrentCategory();
- $_categories = $this->getCurrentChildCategories()
- if($_categories->count()):
- foreach ($_categories as $_category):
- if($_category->getIsActive()):
- $cur_category=Mage::getModel('catalog/category')->load($_category->getId());
- $layer = Mage::getSingleton('catalog/layer');
- $layer->setCurrentCategory($cur_category);
- $catName = $this->getCurrentCategory()->getName();
- if($_imageUrl = $this->getCurrentCategory()->getImageUrl()):
- ?>
- <div class="category-box">
- <div class="category-image-box">
- <a href="<?php echo $this->getCategoryUrl($_category)?>"><img src="<?php echo $_imageUrl?>" height="80"></a>
- </div>
- <div class="category-name">
- <p>
- <a href="<?php echo $this->getCategoryUrl($_category)?>"> <?php echo $_category->getName()?></a>
- </p>
- </div>
- </div>
- <?php
- else:
- ?>
- <div class="category-box">
- <div class="category-image-box">
- <a href="<?php echo $this->getCategoryUrl($_category)?>"><img src="<?php echo $this->getSkinUrl('images/category_image_default.gif'); ?>"></a>
- </div>
- <div class="category-name">
- <p>
- <a href="<?php echo $this->getCategoryUrl($_category)?>"><?php echo $catName ?></a>
- </p>
- </div>
- </div>
- <?php
- endif; /* END: if($_imageUrl=!$this->getCurrentCategory()->getImageUrl()) */
- endif; /* END: $_category->getIsActive()) */
- endforeach; /* END: ($_categories as $_category) */
- /* This resets the category back to the original pages category
- **** If this is not done, subsequent calls on the same page will use the last category
- **** in the foreach loop
- */
- $layer->setCurrentCategory($_maincategorylisting);
- endif; /* END: if($_categories->count()) */
- ?>
- </div>
- <br clear=all>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement