Advertisement
Guest User

Untitled

a guest
Mar 20th, 2015
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.69 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. $alt_img = $this->getAltImg();
  22. ?>
  23. <div <?php if($wrapclass):?>class="<?php echo $wrapclass;?>"<?php endif; ?>>
  24. <?php if($title): ?>
  25. <div class="widget-title">
  26. <h2><span><?php echo $title; ?></span></h2>
  27. </div>
  28. <?php endif; ?>
  29.  
  30. <?php if($desc):?>
  31. <p><?php echo $desc; ?></p>
  32. <?php endif ?>
  33.  
  34. <?php if ($limitproduct): ?>
  35. <div class="widget em-widget-featured-products-grid">
  36. <div class="widget-products">
  37. <?php $i=0; foreach ($_products as $_product): ?>
  38. <?php if ($_columnCount > 0 && $i%$_columnCount==0 || $_columnCount <= 0 && $i == 0): ?>
  39. <ul class="products-grid">
  40. <?php endif ?>
  41. <li class="<?php if($itemClass = $this->getData('item_class')) echo $itemClass.' '; ?>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':''; ?>"
  42. 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;' : '' ?>">
  43. <div class="product-item">
  44. <?php if ($this->ShowThumb()=='true'): ?>
  45. <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>" class="product-image">
  46. <?php if ($this->ShowLabel()=='true'):?>
  47. <!--show label product - label extension is required-->
  48. <?php Mage::helper('productlabels')->display($_product);?>
  49. <?php endif;?>
  50. <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($w,$h) ?>" width="<?php echo $w; ?>" height="<?php echo $h ;?>"<?php if ($alt_img): ?>
  51. rel="<?php echo $alt_img ?>"
  52. data-alt-src="<?php echo $this->helper('catalog/image')->init($_product, $alt_img)->resize($w,$h) ?>"
  53. <?php endif ?> alt="<?php echo $this->stripTags($_product->getName(), null, true) ?>" />
  54. <span class="bkg-hover"></span>
  55. </a>
  56. <?php else: ?>
  57. <?php if ($this->ShowLabel()=='true'):?>
  58. <!--show label product - label extension is required-->
  59. <?php Mage::helper('productlabels')->display($_product);?>
  60. <?php endif;?>
  61. <?php endif; ?>
  62.  
  63. <div class="product-shop">
  64. <div class="f-fix">
  65. <!--product name-->
  66. <?php if ($this->ShowProductName()=='true'):?>
  67. <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>
  68. <?php endif;?>
  69.  
  70. <!--product reviews-->
  71. <?php if ($this->ShowReview()=='true'):?>
  72. <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
  73. <?php endif ; ?>
  74.  
  75. <!--product description-->
  76. <?php if ($this->ShowDesc()=='true'):
  77. $desc = $this->stripTags($_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description'));
  78. if(strlen($desc)>80) { //dem ki tu chuoi $str, 80 la chieu dai muon quy dinh
  79. $strCutTitle = substr($desc, 0, 80); //cat 80 ki tu dau
  80. $desc = substr($strCutTitle, 0, strrpos($strCutTitle, ' '));
  81. }
  82. ?>
  83. <p class="desc"><?php echo $desc; ?></p>
  84. <?php endif ;?>
  85.  
  86. <?php
  87. $thePrice = Mage::helper('tax')->getPrice($_product, $_product->getFinalPrice());
  88. $newmsrp = $this->helper('core')->currency($_product->getMsrp(),false,false);
  89. $total_saving = $newmsrp - $thePrice;
  90. $_item = $this->getItem();
  91. $_product= Mage::getSingleton('catalog/product')->load($_item->getProductId());
  92. $rrp = $_product->getResource()->getAttribute('rrp')->getFrontend()->getValue($_product);
  93. ?>
  94.  
  95.  
  96. <!--product price-->
  97. <?php if ($this->ShowPrice()=='true'):?>
  98. <?php if (Mage::helper('catalog')->canApplyMsrp($_product)):?>
  99. <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $this->__('Detail') ?></a>
  100. <?php else : ?>
  101.  
  102.  
  103. <?php echo $this->getPriceHtml($_product, true, '-widget-new-list') ?>
  104.  
  105. <?php if( $_product->getTypeId() == 'simple' ): ?>
  106.  
  107. <div class="msrp-price">
  108. <span class="rrp">RRP: </span>
  109. <span class="rrpPrice"> <?php echo Mage::helper('core')->currency($_product->getMsrp(),true,false);?>
  110. </span>
  111. </div>
  112.  
  113.  
  114. <span class="price-label"><?php echo $this->__('You Save:') ?></span>
  115. <span class="savePrice" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
  116. <?php echo '&pound;' . number_format(abs($total_saving),2); ?>
  117. </span>
  118. <?php endif;?>
  119.  
  120. <?php endif;?>
  121. <?php endif;?>
  122.  
  123. <?php if($this->ShowAddtoCart()=='true' || $this->ShowAddto()=='true'):?>
  124. <div class="actions-cart">
  125. <div class="actions">
  126. <!--product add to cart-->
  127. <?php if ($this->ShowAddtoCart()=='true'):?>
  128. <?php if ($_product->isSaleable()): ?>
  129. <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>
  130. <?php else: ?>
  131. <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
  132. <?php endif; ?>
  133. <?php endif; ?>
  134.  
  135. <!--product add to compare-wishlist-->
  136. <?php if($this->ShowAddto()=='true'):?>
  137. <ul class="add-to-links">
  138. <?php if ($this->helper('wishlist')->isAllow()) : ?>
  139. <li><a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="link-wishlist" title="<?php echo $this->__('Add to Wishlist') ?>"><?php echo $this->__('Add to Wishlist') ?></a></li>
  140. <?php endif; ?>
  141. <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
  142. <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare" title="<?php echo $this->__('Add to Compare') ?>"><?php echo $this->__('Add to Compare') ?></a></li>
  143. <?php endif; ?>
  144. </ul>
  145. <?php endif; ?>
  146. </div>
  147. </div>
  148. <?php endif;?>
  149.  
  150. </div>
  151. </div>
  152. </div>
  153. </li>
  154. <?php if ( $_columnCount > 0 && ($i+1)%$_columnCount==0 || $i+1==$limitproduct ): ?>
  155. </ul>
  156. <?php endif; ?>
  157. <?php $i++;?>
  158. <?php if ($i >= $limitproduct) break; ?>
  159. <?php endforeach; ?>
  160. </div>
  161. </div>
  162. <?php else:?>
  163. <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
  164. <?php endif; ?>
  165. </div>
  166. <script type="text/javascript">
  167. decorateGeneric($$('ul.products-grid'),['last','first','odd','even']);
  168. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement