Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Need 4 product at grid insteade of 3. 
 
return
Jr. Member
 
Total Posts:  25
Joined:  2010-03-22
 

<?php
/**
 * Product list template
 *
 * @see Mage_Catalog_Block_Product_List
 */
?>
<?php $_productCollection
=$this->getLoadedProductCollection() ?>
<?php 
if(!$_productCollection->count()): ?>
<div class="note-msg">
    
<?php echo $this->__('There are no products matching the selection.'?>
</div>
<?php else: ?>

<?php 
echo $this->getToolbarHtml() ?>
<?php 
// List mode ?>
<?php if($this->getMode()!='grid'): ?>
<?php $_iterator 
0?>
<div class="listing-type-list catalog-listing">
<?php foreach ($_productCollection as $_product): ?>
    
<div class="listing-item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
        
<?php // Product Image ?>
        
<div class="product-image">
            <
a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getSmallImageLabel()) ?>">
                <
img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" />
            </
a>
        </
div>

        
<?php // Product description ?>
        
<div class="product-shop">
            <
h5><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName())?></a></h5>           <?php echo $this->getPriceHtml($_producttrue?>
            <?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: ?>
            
<div class="out-of-stock"><?php echo $this->__('Out of stock'?></div>
            
<?php endif; ?>
            
<div class="clear"></div>
            <
div class="description">
                
<?php echo nl2br($_product->getShortDescription()) ?>
                
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><small><?php echo $this->__('Learn More'?></small></a>
            </
div>
            <
class="add-to">
                
<?php if ($this->helper('wishlist')->isAllow()) : ?>
                
<a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-cart"><?php echo $this->__('Add to Wishlist'?></a>
                
<?php endif; ?>
                <?php 
if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
                
<span class="pipe">|</span>
                <
a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare'?></a>
                
<?php endif; ?>
            
</p>
        </
div>
    </
div>
<?php endforeach; ?>
</div>

<?php else: ?>

<?php 
// Grid Mode ?>
<div class="listing-type-grid catalog-listing">
<?php $_collectionSize $_productCollection->count() ?>
    <?php $_columnCount 
$this->getColumnCount(); ?>
    <?php $i
=0; foreach ($_productCollection as $_product): ?>
        <?php 
if($i++%$_columnCount==0): ?>
        
<ol class="grid-row">
        
<?php endif; ?>
            
<li class="item">
                <
class="product-image">
                    <
a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>">
                        <
img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" />
                    </
a>
                </
p>
                <
h5><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></h5>
                             
<?php echo $this->getPriceHtml($_producttrue?>
                <?php 
if($_product->isSaleable()): ?>
                    
<button type="button" class="form-button" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart'?></span></button>
                
<?php else: ?>
                
<div class="out-of-stock"><?php echo $this->__('Out of stock'?></div>
                
<?php endif; ?>
                
<class="add-to">
                    
<?php if ($this->helper('wishlist')->isAllow()) : ?>
                    
<a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-cart"><?php echo $this->__('Add to Wishlist'?></a>
                    
<?php endif; ?>
                     
</p>
            </
li>
        
<?php if($i%$_columnCount==|| $i==$_collectionSize): ?>
        
</ol>
        
<?php endif; ?>
    <?php 
endforeach ?>
    
<script type="text/javascript">decorateGeneric($$('.grid-row'), ['last''odd''even']);</script>
</div>
<?php endif; ?>
<?php 
echo $this->getToolbarHtml() ?>
<?php 
endif; ?>

Need 4 product at grid insteade of 3. this is file: list.php in the directory app/design/frontend/default/default/template/catalog/product/

 
Magento Community Magento Community
Magento Community
Magento Community
 
return
Jr. Member
 
Total Posts:  25
Joined:  2010-03-22
 

HELP ME PLEASE!

 
Magento Community Magento Community
Magento Community
Magento Community
 
return
Jr. Member
 
Total Posts:  25
Joined:  2010-03-22
 

you can show the problem here:
http://www.gadgets4u.co.il/shop/computers.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
return
Jr. Member
 
Total Posts:  25
Joined:  2010-03-22
 

uppp

 
Magento Community Magento Community
Magento Community
Magento Community
 
seudo
Guru
 
Avatar
Total Posts:  344
Joined:  2008-04-21
 

If I understand you correctly you want to show 3 columns instead of 4?

See this post: http://www.magentocommerce.com/boards/viewthread/44315/#t145322

Also, looks like you are using a customized theme. You may have to adjust some CSS if the above does not work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
nathus
Sr. Member
 
Total Posts:  93
Joined:  2008-12-13
Twin Cities, MN
 

The code you posted worked fine for me.

On your site, what I am seeing is that each time through the loop when it gets to the 4th Item it starts the new <ol> before closing the previous one so the ordered lists are nesting.

What your code is looking like is


<ol class="grid-row odd">
<li class="item">...</li>
<li class="item">...</li>
<li class="item">...</li>
<li class="item">...</li>
<ol class="grid-row even">
<li class="item">...</li>
<li class="item">...</li>
<li class="item">...</li>
<li class="item">...</li>
</ol>
</ol>

and when I put it in my store I got the following, which is what I think is correct.


<ol class="grid-row odd">
<li class="item">...</li>
<li class="item">...</li>
<li class="item">...</li>
<li class="item">...</li>
</ol>
<ol class="grid-row even">
<li class="item">...</li>
<li class="item">...</li>
<li class="item">...</li>
<li class="item">...</li>
</ol>

Are you sure the code you posted above is what is being used?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top