Skip to content

Instantly share code, notes, and snippets.

@EdwardIII
Created November 14, 2012 10:17
Show Gist options
  • Save EdwardIII/4071367 to your computer and use it in GitHub Desktop.
Save EdwardIII/4071367 to your computer and use it in GitHub Desktop.
<div class="category-products">
<ul class="products-grid">
<?php
$_categories=$this->getCurrentChildCategories();
if($_categories->count()):
$categorycount = 0;
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 ($categorycount == 0){
$class = "first";
}
elseif ($categorycount == 4){
$class = "last";
}
else{
$class = "";
}
?>
<li class="item <?=$class?>">
<h2 class="product-name"><a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>"><?php echo $this->htmlEscape($_category->getName()) ?></a></h2>
<a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
<img src="<?php echo $_category->getThumbnailUrl() ?>" width="100" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" />
<img src="<?php echo $_category->getImage() ?>" width="100" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" />
</a>
-<?php var_dump($_category->getImageUrl())?>-
</li>
<?php
endif;
if($categorycount == 3){
$categorycount = 0;
echo "</ul>\n\n<ul class=\"products-grid\">";
}
else{
$categorycount++;
}
endforeach;
endif;
?>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment