Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $_products = $this->getProductCollection();
- $_helper = $this->helper('catalog/output');
- if(Mage::registry('current_category')){
- $_products->addUrlRewrite(Mage::registry('current_category')->getId());
- }
- $limitproduct = $this->getLimitCount();
- $size = $_products->getSize();
- if($limitproduct == "" || $limitproduct > $size){
- $limitproduct = $size;
- }
- $title = $this->getFrontendTitle();
- $desc = $this->getFrontendDescription();
- $wrapclass = $this->getCustomClass();
- $w = $this->getThumbnailWidth();
- $h = $this->getThumbnailHeight();
- $_columnCount = $this->getColumnCount();
- ?>
- <div <?php if($wrapclass):?>class="<?php echo $wrapclass;?>"<?php endif; ?>>
- <?php if($title): ?>
- <div class="widget-title">
- <h2><span><?php echo $title; ?></span></h2>
- </div>
- <?php endif; ?>
- <div class="widget em-widget-featured-products-grid">
- <?php if ($limitproduct): ?>
- <div class="widget-products">
- <?php $i=0; foreach ($_products->getItems() as $_product): ?>
- <?php if ($_columnCount > 0 && $i%$_columnCount==0 || $_columnCount <= 0 && $i == 0): ?>
- <ul class="products-grid">
- <?php endif ?>
- <li class="item<?php echo $_columnCount > 0 && $i%$_columnCount==0 || $_columnCount <= 0 && $i == 0 ?' first':''; ?><?php echo $_columnCount > 0 && ($i+1)%$_columnCount==0 || $i+1 == $limitproduct ?' last':''; ?>"
- style="<?php echo $this->getItemWidth() ? 'width:'.$this->getItemWidth().'px;' : '' ?> <?php echo $this->getItemHeight() ? 'height:'.$this->getItemHeight().'px;' : '' ?> <?php echo $this->getItemSpacing() ? 'margin-right:'.$this->getItemSpacing().'px;margin-bottom:'.$this->getItemSpacing().'px;' : '' ?>">
- <?php if ($this->ShowLabel()=='true'):?>
- <!--show label product - label extension is required-->
- <?php Mage::helper('productlabels')->display($_product);?>
- <?php endif;?>
- <?php if ($this->ShowThumb()=='true'): ?>
- <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($w,$h) ?>" width="<?php echo $w; ?>" height="<?php echo $h ;?>" alt="<?php echo $this->stripTags($_product->getName(), null, true) ?>" /></a>
- <?php endif; ?>
- <div class="product-shop">
- <div class="f-fix">
- <!--product name-->
- <?php if ($this->ShowProductName()=='true'):?>
- <h3 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_product, $_product->getName() , 'name') ?></a></h3>
- <?php endif;?>
- <p class="sku"><?php echo $_product->getSKU()?></p>
- <!--product description-->
- <?php if ($this->ShowDesc()=='true'):
- $desc_product = $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description');
- if(strlen($desc_product)>80) { //dem ki tu chuoi $str, 80 la chieu dai muon quy dinh
- $strCutTitle = substr($desc_product, 0, 80); //cat 80 ki tu dau
- $desc_product = substr($strCutTitle, 0, strrpos($strCutTitle, ' '));
- }
- ?>
- <p class="desc"><?php echo $desc_product; ?></p>
- <?php endif ;?>
- <!--product reviews-->
- <?php if ($this->ShowReview()=='true'):?>
- <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
- <?php endif ; ?>
- <!--product add to cart-->
- <?php if ($this->ShowAddtoCart()=='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; ?>
- <?php endif; ?>
- <!--product price-->
- <?php if ($this->ShowPrice()=='true'):?>
- <?php echo $this->getPriceHtml($_product, true, '-widget-new-list') ?>
- <?php endif;?>
- <!--product add to compare-wishlist-->
- <?php if($this->ShowAddto()=='true'):?>
- <ul class="add-to-links">
- <?php if ($this->helper('wishlist')->isAllow()) : ?>
- <li><a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
- <?php endif; ?>
- <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
- <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
- <?php endif; ?>
- </ul>
- <?php endif; ?>
- </div>
- </div>
- </li>
- <?php if ( $_columnCount > 0 && ($i+1)%$_columnCount==0 || $i+1==$limitproduct ): ?>
- </ul>
- <?php endif; ?>
- <?php $i++;?>
- <?php if ($i >= $limitproduct) break; ?>
- <?php endforeach; ?>
- </div>
- <?php else:?>
- <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
- <?php endif; ?>
- <?php if($desc):?>
- <div class="desc"><?php echo $desc; ?></div>
- <?php endif ?>
- </div>
- </div>
- <script type="text/javascript">
- decorateGeneric($$('ul.products-grid'),['last','first','odd','even']);
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement