Advertisement
Guest User

lsit

a guest
May 26th, 2015
736
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.48 KB | None | 0 0
  1. <?php
  2. /**
  3. * Magento
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Academic Free License (AFL 3.0)
  8. * that is bundled with this package in the file LICENSE_AFL.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/afl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@magentocommerce.com so we can send you a copy immediately.
  14. *
  15. * DISCLAIMER
  16. *
  17. * Do not edit or add to this file if you wish to upgrade Magento to newer
  18. * versions in the future. If you wish to customize Magento for your
  19. * needs please refer to http://www.magentocommerce.com for more information.
  20. *
  21. * @category design
  22. * @package base_default
  23. * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
  24. * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
  25. */
  26. ?>
  27. <?php
  28. /**
  29. * Product list template
  30. *
  31. * @see Mage_Catalog_Block_Product_List
  32. */
  33. ?>
  34. <?php
  35. $_productCollection=$this->getLoadedProductCollection();
  36. $_helper = $this->helper('catalog/output');
  37.  
  38. $setting = Mage::helper('em0113settings');
  39. ?>
  40. <?php if(!$_productCollection->count()): ?>
  41. <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
  42. <?php else: ?>
  43. <div class="category-products">
  44. <?php echo $this->getToolbarHtml() ?>
  45. <?php // List mode ?>
  46. <?php if($this->getMode()!='grid'): ?>
  47. <?php $_iterator = 0; ?>
  48. <ol class="products-list" id="products-list">
  49. <?php foreach ($_productCollection as $_product): ?>
  50. <?php $stockItem = $_product->getStockItem(); ?>
  51. <?php if (!$stockItem->getIsInStock()): ?>
  52. <span class="out-of-stock"><span>Sold Out</span></span>
  53. <?php endif; ?>
  54.  
  55. <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
  56.  
  57. <!--show label product - label extension is required-->
  58. <?php // Product Image ?>
  59. <?php if ($setting->getProductsList_ShowThumbnail()): ?>
  60. <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
  61. <?php if ($setting->getProductsList_ShowLabel()):?>
  62. <!--show label product - label extension is required-->
  63. <?php Mage::helper('productlabels')->display($_product);?>
  64. <?php endif;?>
  65. <?php if ($alt_img = $setting->getProductsList_AltImg()): ?>
  66. <img class="bottom" src="<?php echo $this->helper('catalog/image')->init($_product, $alt_img)->resize($setting->getProductsList_Width(240), $setting->getProductsList_Height()); ?>" width="<?php echo $setting->getProductsList_Width(240) ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, $alt_img), null, true) ?>" />
  67. <?php endif ?>
  68. <img <?php if ($alt_img = $setting->getProductsList_AltImg()): ?>class="top"<?php endif ?> src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($setting->getProductsList_Width(240), $setting->getProductsList_Height()); ?>" width="<?php echo $setting->getProductsList_Width(240) ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
  69. </a>
  70. <?php endif ?>
  71. <?php // Product description ?>
  72. <div class="product-shop">
  73. <div class="f-fix">
  74. <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
  75. <!--product name-->
  76. <?php if ($setting->getProductsList_ShowProductName()):?>
  77. <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
  78. <?php endif ?>
  79. <!--product sku-->
  80. <?php if ($setting->getProductsList_ShowSku()):?>
  81. <p class="sku"><?php echo $_product->getSKU()?></p>
  82. <?php endif ?>
  83.  
  84. <!--show reviews-->
  85. <?php if ($setting->getProductsList_ShowReviews()):?>
  86. <?php if($_product->getRatingSummary()): ?>
  87. <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
  88. <?php endif; ?>
  89. <?php endif; ?>
  90.  
  91. <?php if ($setting->getProductsList_ShowSaleables()):?>
  92. <?php if($_product->isSaleable()): ?>
  93. <p class="availability in-stock"><span><?php echo $this->__('In stock') ?></span></p>
  94. <?php else: ?>
  95. <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
  96. <?php endif; ?>
  97. <?php endif; ?>
  98.  
  99. <!--product description-->
  100. <?php if ($setting->getProductsList_ShowDesc()): ?>
  101. <div class="desc std">
  102. <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
  103. <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
  104. </div>
  105. <?php endif; ?>
  106. <!--product price-->
  107.  
  108. <?php if ($setting->getProductsList_ShowPrice()): ?>
  109. <?php echo $this->getPriceHtml($_product, true) ?>
  110. <?php endif; ?>
  111.  
  112. <!--show button add to cart-->
  113. <?php if ($setting->getProductsList_ShowAddtocart()): ?>
  114. <?php if($_product->isSaleable()): ?>
  115. <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>
  116. <?php else: ?>
  117. <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
  118. <?php endif; ?>
  119. <?php endif; ?>
  120.  
  121.  
  122. <!--show button add to compare-wishlist-->
  123. <?php if ($setting->getProductsList_ShowAddto()): ?>
  124. <ul class="add-to-links">
  125. <?php if ($this->helper('wishlist')->isAllow()) : ?>
  126. <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist" title="<?php echo $this->__('Add to Wishlist') ?>"><?php echo $this->__('Add to Wishlist') ?></a></li>
  127. <?php endif; ?>
  128. <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
  129. <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>
  130. <?php endif; ?>
  131. </ul>
  132. <?php endif; ?>
  133. </div>
  134. </div>
  135. </li>
  136. <?php endforeach; ?>
  137. </ol>
  138. <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
  139.  
  140. <?php else: ?>
  141.  
  142. <?php // Grid Mode ?>
  143.  
  144. <?php $_collectionSize = $_productCollection->count() ?>
  145. <?php if ($_collectionSize > 0): ?>
  146. <ul class="products-grid">
  147. <?php $i=0; foreach ($_productCollection as $_product): ?>
  148. <li class="item-products item box" style = "width :<?php echo $setting->getProductsGrid_Width(225)?>px; <?php if($setting->getProductsGrid_Gutter()): ?> margin-right: <?php echo $setting->getProductsGrid_Gutter() ?>px<?php endif; ?>">
  149. <?php if ($setting->getProductsGrid_ShowThumbnail()): ?>
  150. <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
  151. <?php if ($setting->getProductsGrid_ShowLabel()):?>
  152. <!--show label product - label extension is required-->
  153. <?php Mage::helper('productlabels')->display($_product);?>
  154. <?php endif;?>
  155. <?php if ($alt_img = $setting->getProductsGrid_AltImg()): ?>
  156. <img class="bottom" src="<?php echo $this->helper('catalog/image')->init($_product, $alt_img)->resize($setting->getProductsGrid_Width(225), $setting->getProductsGrid_Height()); ?>" width="<?php echo $setting->getProductsGrid_Width(225) ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, $alt_img), null, true) ?>" />
  157. <?php endif ?>
  158. <img <?php if ($alt_img = $setting->getProductsGrid_AltImg()): ?>class="top"<?php endif ?> src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($setting->getProductsGrid_Width(225), $setting->getProductsGrid_Height()); ?>" width="<?php echo $setting->getProductsGrid_Width(225) ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
  159. </a>
  160. <?php endif; ?>
  161.  
  162. <!--product name-->
  163. <?php if ($setting->getProductsGrid_ShowProductName()):?>
  164. <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
  165. <?php endif; ?>
  166.  
  167. <!--product sku-->
  168. <?php if ($setting->getProductsGrid_ShowSku()):?>
  169. <p class="sku"><?php echo $_product->getSKU()?></p>
  170. <?php endif; ?>
  171.  
  172. <!--show reviews-->
  173. <?php if ($setting->getProductsGrid_ShowReviews()):?>
  174. <?php if($_product->getRatingSummary()): ?>
  175. <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
  176. <?php endif; ?>
  177. <?php endif; ?>
  178.  
  179. <!--product price-->
  180. <?php if ($setting->getProductsGrid_ShowPrice()): ?>
  181. <?php echo $this->getPriceHtml($_product, true) ?>
  182. <?php endif; ?>
  183.  
  184. <?php if ($setting->getProductsGrid_ShowSaleables()):?>
  185. <?php if($_product->isSaleable()): ?>
  186. <p class="availability in-stock"><span><?php echo $this->__('In stock') ?></span></p>
  187. <?php else: ?>
  188. <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
  189. <?php endif; ?>
  190. <?php endif; ?>
  191.  
  192. <div class="rating-actions">
  193. <div class="actions">
  194. <!--product description-->
  195. <?php if ($setting->getProductsGrid_ShowDesc()): ?>
  196. <div class="desc std">
  197. <?php
  198. $shortdes = $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description');
  199. if(strlen($shortdes)>100) { //dem ki tu chuoi $str, 10o la chieu dai muon quy dinh
  200. $strCutTitle = substr($shortdes, 0, 100); //cat 100 ki tu dau
  201. $shortdes = substr($strCutTitle, 0, strrpos($strCutTitle, ' '));
  202. }
  203. echo $shortdes;
  204. ?>
  205. </div>
  206. <?php endif; ?>
  207.  
  208. <?php if ($setting->getProductsGrid_ShowAddtocart()): ?>
  209. <?php if($_product->isSaleable()): ?>
  210. <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>
  211. <?php else: ?>
  212. <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
  213. <?php endif; ?>
  214. <?php endif; ?>
  215.  
  216. <!--show button add to compare-wishlist-->
  217. <?php if ($setting->getProductsGrid_ShowAddto()): ?>
  218. <ul class="add-to-links">
  219. <?php if ($this->helper('wishlist')->isAllow()) : ?>
  220. <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" title="<?php echo $this->__('Add to Wishlist') ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
  221. <?php endif; ?>
  222. <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
  223. <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>
  224. <?php endif; ?>
  225. </ul>
  226. <?php endif; ?>
  227. </div>
  228. </div>
  229. </li>
  230. <?php endforeach ?>
  231. </ul>
  232. <?php endif; ?>
  233. <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
  234. <?php endif; ?>
  235.  
  236. <div class="toolbar-bottom">
  237. <?php echo $this->getToolbarHtml() ?>
  238. </div>
  239. </div>
  240. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement