Hi Guys,

Shopping cart : Magento CE

I need to display category image, title next to it and description under title. I want to display two columns per line.


At the moment the display order is category image, title and description under... No columns, one per line...


Code below:

<?php $_maincategorylisting=$this->getCurrentCategory();?>
<?php $_categories=$this->getCurrentChildCategories();?>
<div class="widget widget-viewed">
<div class="widget-products">
<?php $_columnCount = $this->getColumnCount(); ?>
<?php $i=0; foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive()): ?>
<?php $cur_category=Mage::getModel('catalog/category')->load($_category->getId()); ?>
<?php $layer = Mage::getSingleton('catalog/layer'); ?>
<?php $layer->setCurrentCategory($cur_category); ?>
<?php if($_imageUrl=$this->getCurrentCategory()->getImageUrl()):?>
<?php if ($i++%$_columnCount==0): ?>
<ul class="products-grid">
<?php endif; ?>
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
<a href="<?php echo $this->getCategoryUrl($_category); ?>" title="<?php echo $this->htmlEscape($_category->getName()); ?>"> <img src="<?php echo $_imageUrl; ?>" width="200px" height="180px" alt="<?php echo $this->htmlEscape($_category->getName()); ?>" </a>
<h3><?php echo $this->htmlEscape($_category->getName()); ?></h3>
<?php if($_description=$this->getCurrentCategory()->getDescription()):?>
<p class="category-description"> <?php echo $_description; ?></p>
<?php endif; ?>
</li>
<?php if ($i%$_columnCount==0 || $i==count($_products)): ?>
</ul>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>

View more threads in the same category: