Displaying 3 items instead of 4
Posted: Wed Oct 29, 2008 4:04 pm
Hi all. Since I am not a php guy at all, I was hoping someone could point this out for me.
I am trying to display 4 items across instead of 3. I'm not sure which line of code does this. I want to hard wire in 4 items across if possible and maybe clean up some of the unnecessary code that is in here. I got this from a program we have that will display in a grid or list mode. I only want it to display in a grid mode. So if there is a way to take out the list mode parts that would be great too.
Thanks in advance - Daniel
I am trying to display 4 items across instead of 3. I'm not sure which line of code does this. I want to hard wire in 4 items across if possible and maybe clean up some of the unnecessary code that is in here. I got this from a program we have that will display in a grid or list mode. I only want it to display in a grid mode. So if there is a way to take out the list mode parts that would be great too.
Thanks in advance - Daniel
Code: Select all
<?php $_productCollection=$this->getLoadedProductCollection() ?>
<?php if(!$_productCollection->count()): ?>
<?php else: ?>
<?php // List mode ?>
<?php if($this->getMode()!='grid'): ?>
<?php $_iterator = 0; ?>
<?php else: ?>
<?php // Grid Mode ?>
<div class="listing-type-grid-homepage catalog-listing-homepage"> <!-- the class name will change to .listing-type-cell if viewing in list mode -->
<?php $_collectionSize = $_productCollection->count() ?>
<table cellspacing="0" class="homepage-product-grid" id="product-list-table">
<?php $i=0; foreach ($_productCollection as $_product): ?>
<?php if ($i++%3==0): ?>
<tr>
<?php endif ?>
<td>
<p class="product-image">
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(160, 160); ?>" width="160" height="160" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />
</a>
</p>
<h2><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></h2>
<?php echo $this->getPriceHtml($_product, true) ?>
<?php if($_product->isSaleable()): ?>
<button class="form-button" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart') ?></span></button>
<?php else: ?>
<?php endif; ?>
<div class="clear"></div>
</td>
<?php if ($i%3==0 && $i!=$_collectionSize): ?>
</tr>
<?php endif ?>
<?php endforeach ?>
<?php for($i;$i%3!=0;$i++): ?>
<td class="empty-product"> </td>
<?php endfor ?>
<?php if ($i%3==0): ?>
</tr>
<?php endif ?>
</table>
<script type="text/javascript">decorateTable('product-list-table')</script>
</div>
<?php endif; ?>
<?php endif; ?>