Advertisement
Guest User

featuredgrid.phtml

a guest
Sep 4th, 2014
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.64 KB | None | 0 0
  1. <?php
  2. $_products = $this->getProductCollection();
  3.  
  4. $_helper = $this->helper('catalog/output');
  5. if(Mage::registry('current_category')){
  6. $_products->addUrlRewrite(Mage::registry('current_category')->getId());
  7. }
  8.  
  9. $limitproduct = $this->getLimitCount();
  10. $size = $_products->getSize();
  11. if($limitproduct == "" || $limitproduct > $size){
  12. $limitproduct = $size;
  13. }
  14.  
  15. $title = $this->getFrontendTitle();
  16. $desc = $this->getFrontendDescription();
  17. $wrapclass = $this->getCustomClass();
  18. $w = $this->getThumbnailWidth();
  19. $h = $this->getThumbnailHeight();
  20. $_columnCount = $this->getColumnCount();
  21. ?>
  22. <div <?php if($wrapclass):?>class="<?php echo $wrapclass;?>"<?php endif; ?>>
  23. <?php if($title): ?>
  24. <div class="widget-title">
  25. <h2><span><?php echo $title; ?></span></h2>
  26. </div>
  27. <?php endif; ?>
  28.  
  29. <div class="widget em-widget-featured-products-grid">
  30. <?php if ($limitproduct): ?>
  31. <div class="widget-products">
  32. <?php $i=0; foreach ($_products->getItems() as $_product): ?>
  33. <?php if ($_columnCount > 0 && $i%$_columnCount==0 || $_columnCount <= 0 && $i == 0): ?>
  34. <ul class="products-grid">
  35. <?php endif ?>
  36. <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':''; ?>"
  37. 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;' : '' ?>">
  38. <?php if ($this->ShowLabel()=='true'):?>
  39. <!--show label product - label extension is required-->
  40. <?php Mage::helper('productlabels')->display($_product);?>
  41. <?php endif;?>
  42.  
  43. <?php if ($this->ShowThumb()=='true'): ?>
  44. <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>
  45. <?php endif; ?>
  46.  
  47. <div class="product-shop">
  48. <div class="f-fix">
  49. <!--product name-->
  50. <?php if ($this->ShowProductName()=='true'):?>
  51. <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>
  52. <?php endif;?>
  53. <p class="sku"><?php echo $_product->getSKU()?></p>
  54. <!--product description-->
  55. <?php if ($this->ShowDesc()=='true'):
  56. $desc_product = $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description');
  57. if(strlen($desc_product)>80) { //dem ki tu chuoi $str, 80 la chieu dai muon quy dinh
  58. $strCutTitle = substr($desc_product, 0, 80); //cat 80 ki tu dau
  59. $desc_product = substr($strCutTitle, 0, strrpos($strCutTitle, ' '));
  60. }
  61. ?>
  62. <p class="desc"><?php echo $desc_product; ?></p>
  63. <?php endif ;?>
  64.  
  65. <!--product reviews-->
  66. <?php if ($this->ShowReview()=='true'):?>
  67. <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
  68. <?php endif ; ?>
  69.  
  70. <!--product add to cart-->
  71. <?php if ($this->ShowAddtoCart()=='true'):?>
  72. <?php if ($_product->isSaleable()): ?>
  73. <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>
  74. <?php else: ?>
  75. <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
  76. <?php endif; ?>
  77. <?php endif; ?>
  78.  
  79. <!--product price-->
  80. <?php if ($this->ShowPrice()=='true'):?>
  81. <?php echo $this->getPriceHtml($_product, true, '-widget-new-list') ?>
  82. <?php endif;?>
  83.  
  84.  
  85. <!--product add to compare-wishlist-->
  86. <?php if($this->ShowAddto()=='true'):?>
  87. <ul class="add-to-links">
  88. <?php if ($this->helper('wishlist')->isAllow()) : ?>
  89. <li><a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
  90. <?php endif; ?>
  91. <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
  92. <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
  93. <?php endif; ?>
  94. </ul>
  95. <?php endif; ?>
  96.  
  97. </div>
  98. </div>
  99. </li>
  100. <?php if ( $_columnCount > 0 && ($i+1)%$_columnCount==0 || $i+1==$limitproduct ): ?>
  101. </ul>
  102. <?php endif; ?>
  103. <?php $i++;?>
  104. <?php if ($i >= $limitproduct) break; ?>
  105. <?php endforeach; ?>
  106. </div>
  107. <?php else:?>
  108. <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
  109. <?php endif; ?>
  110.  
  111. <?php if($desc):?>
  112. <div class="desc"><?php echo $desc; ?></div>
  113. <?php endif ?>
  114. </div>
  115. </div>
  116. <script type="text/javascript">
  117. decorateGeneric($$('ul.products-grid'),['last','first','odd','even']);
  118. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement