Skip to content

Instantly share code, notes, and snippets.

@spinolacastro
Created June 9, 2014 13:05
Show Gist options
  • Select an option

  • Save spinolacastro/ece764c09b904357a1bf to your computer and use it in GitHub Desktop.

Select an option

Save spinolacastro/ece764c09b904357a1bf to your computer and use it in GitHub Desktop.
<?php
/**
* Product list template
*
* @see Mage_Catalog_Block_Product_List
*/
?>
<div class="new-products">
<?php $_productCollection=$this->getProductCollection() ?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<?php $_collectionSize = $_productCollection->count() ?>
<?php
$sliderFor = 5;
$productCount = $_collectionSize;
?>
<?php if ($productCount >= $sliderFor): ?>
<div class="customNavigation">
<a class="btn prev">&nbsp;</a>
<a class="btn next">&nbsp;</a>
</div>
<?php endif; ?>
<ul class="<?php if ($productCount >= $sliderFor){?>product-carousel<?php }else{?>products-grid<?php }?>" id="<?php if ($productCount >= $sliderFor){?>newproduct-carousel<?php }else{?>newproduct-grid<?php }?>">
<?php $i=0; foreach ($_productCollection as $_product): $i++;?>
<li class="item <?php if ($productCount >= $sliderFor){?>slider-item<?php }else{?>product-items<?php }?>">
<div class="product-block">
<div class="product-block-inner">
<?php if($this->helper('framework')->isNewProduct($_product)):?>
<div class="new-label"><?php echo $this->__('New') ?></div>
<?php endif; ?>
<?php if($this->helper('framework')->isSpecialProduct($_product)):?>
<div class="sale-label"><?php echo $this->__('Sale') ?></div>
<?php endif; ?>
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(195,250); ?>" width="195" height="250" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
<h2 class="product-name" ><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_product->getName()) ?>"><?php echo $this->escapeHtml($_product->getName())?></a></h2>
<div class="wishlist_compare_content">
<ul class="add-to-links">
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist" title="Add to Wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
<?php endif; ?>
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
<li><a href="<?php echo $_compareUrl ?>" class="link-compare" title="Add to Compare"><?php echo $this->__('Add to Compare') ?></a></li>
<?php endif; ?>
</ul>
</div>
<?php if($_product->getRatingSummary()): ?>
<div class="description grid_rating">
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
</div>
<?php endif; ?>
<div class="actions">
<?php echo $this->getPriceHtml($_product, true) ?>
<?php if($_product->isSaleable()): ?>
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
<?php else: ?>
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
<?php endif; ?>
</div>
</div><!-- End div class product-block-->
</div><!-- End div class product-block-inner -->
</li>
<?php endforeach ?>
</ul>
<span style="display: none; visibility: hidden;" class="newproduct_default_width"></span>
<?php endif; ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment