Advertisement
Guest User

list.phtml

a guest
Jul 21st, 2014
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.49 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) 2013 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.     $setting = Mage::helper('galabrandstoresettings');
  38. ?>
  39. <?php if(!$_productCollection->count()): ?>
  40. <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
  41. <?php else: ?>
  42. <div class="category-products">
  43.     <?php echo $this->getToolbarHtml() ?>
  44.     <?php // List mode ?>
  45.     <?php if($this->getMode()!='grid'): ?>
  46.     <?php $_iterator = 0; ?>
  47.     <ol class="products-list" id="products-list">
  48.     <?php foreach ($_productCollection as $_product): ?>
  49.         <li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>" <?php if($setting->getProductsList_Gutter()): ?>style="margin-bottom: <?php echo $setting->getProductsList_Gutter() ?>px"<?php endif; ?>>
  50.  
  51.             <!-- Show Thumbnail -->
  52.             <?php if ($setting->getProductsList_ShowThumbnail()): ?>
  53.             <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
  54.                 <?php if ($setting->getProductsList_ShowLabel()):?>
  55.                     <!--show label product - label extension is required-->
  56.                     <?php Mage::helper('productlabels')->display($_product);?>
  57.                 <?php endif; ?>
  58.                 <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($setting->getProductsList_Width(285), $setting->getProductsList_Height()); ?>" width="<?php echo $setting->getProductsList_Width(285) ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" <?php if ($alt_img = $setting->getProductsList_AltImg()): ?>
  59.                 rel="<?php echo $alt_img ?>"
  60.                 data-alt-src="<?php echo $this->helper('catalog/image')->init($_product, $alt_img)->resize($setting->getProductsList_Width(285), $setting->getProductsList_Height()); ?>"
  61.                 <?php endif ?>
  62.                 alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
  63.             </a>
  64.             <?php else: ?>
  65.                 <?php if ($setting->getProductsList_ShowLabel()):?>
  66.                     <!--show label product - label extension is required-->
  67.                     <?php Mage::helper('productlabels')->display($_product);?>
  68.                 <?php endif; ?>            
  69.             <?php endif ?>
  70.  
  71.             <?php // Product description ?>
  72.             <div class="product-shop">
  73.                 <div class="f-fix">
  74.                     <?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
  75.  
  76.                     <!--product name-->
  77.                     <?php if ($setting->getProductsList_ShowProductName()):?>
  78.                         <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
  79.                     <?php endif ?>
  80.  
  81.                      <!--product description-->
  82.                     <?php if ($setting->getProductsList_ShowDesc()): ?>
  83.                         <div class="desc std">
  84.                             <?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
  85.                             <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
  86.                         </div>
  87.                     <?php endif ?>
  88.  
  89.                     <!--show reviews-->
  90.                     <?php if ($setting->getProductsList_ShowReviews()):?>
  91.                         <?php if($_product->getRatingSummary()): ?>
  92.                         <?php echo $this->getReviewsSummaryHtml($_product) ?>
  93.                         <?php endif; ?>
  94.                     <?php endif ?>
  95.  
  96.                     <!--product price-->
  97.                     <?php if ($setting->getProductsList_ShowPrice()): ?>
  98.                         <?php echo $this->getPriceHtml($_product, true) ?>
  99.                     <?php endif ?>
  100.  
  101.                     <?php if($_product->isSaleable()): ?>
  102.                         <!--show button add to cart-->
  103.                         <?php if ($setting->getProductsList_ShowAddtocart()): ?>
  104.                             <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>
  105.                         <?php endif ?>
  106.                     <?php else: ?>
  107.                         <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
  108.                     <?php endif; ?>
  109.  
  110.                     <!--show button add to compare-wishlist-->
  111.                     <?php if ($setting->getProductsList_ShowAddto()): ?>
  112.                         <ul class="add-to-links">
  113.                             <?php if ($this->helper('wishlist')->isAllow()) : ?>
  114.                                 <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>
  115.                             <?php endif; ?>
  116.                             <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
  117.                                 <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>
  118.                             <?php endif; ?>
  119.                         </ul>
  120.                     <?php endif ?>
  121.                 </div>
  122.             </div>
  123.         </li>
  124.     <?php endforeach; ?>
  125.     </ol>
  126.     <script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
  127.  
  128.     <?php else: ?>
  129.  
  130.     <?php // Grid Mode ?>
  131.  
  132.     <?php $_collectionSize = $_productCollection->count() ?>
  133.     <?php $_columnCount = $this->getColumnCount(); ?>
  134.     <?php if ($_collectionSize > 0): ?>
  135.     <ul class="products-grid row">
  136.     <?php $i=0; foreach ($_productCollection as $_product): ?>
  137.             <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?> <?php echo $setting->getProductsGrid_Item('span6'); ?>"style="<?php if($setting->getProductsGrid_Width()): ?>width: <?php echo $setting->getProductsGrid_Width() ?>px;<?php endif; ?> <?php if($setting->getProductsGrid_Gutter()): ?>margin-right: <?php echo $setting->getProductsGrid_Gutter() ?>px;<?php endif; ?>"><div class="product-item">
  138.  
  139.                 <div class="product-info">
  140.  
  141.                 <!-- Show Thumbnail -->
  142.                 <?php if ($setting->getProductsGrid_ShowThumbnail()): ?>
  143.  
  144.                     <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
  145.  
  146.                         <?php if ($setting->getProductsGrid_ShowLabel()):?>
  147.                             <!--show label product - label extension is required-->
  148.                             <?php Mage::helper('productlabels')->display($_product);?>
  149.                         <?php endif;?>
  150.                
  151.                     <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($setting->getProductsGrid_Width(285), $setting->getProductsGrid_Height()); ?>" width="<?php echo $setting->getProductsGrid_Width(285) ?>" <?php if ($alt_img = $setting->getProductsGrid_AltImg()): ?>
  152.                 rel="<?php echo $alt_img ?>"
  153.                 data-alt-src="<?php echo $this->helper('catalog/image')->init($_product, $alt_img)->resize($setting->getProductsGrid_Width(285), $setting->getProductsGrid_Height()); ?>"
  154.                 <?php endif ?> alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
  155.                     </a>
  156.                 <?php else: ?>
  157.                     <?php if ($setting->getProductsGrid_ShowLabel()):?>
  158.                         <!--show label product - label extension is required-->
  159.                         <?php Mage::helper('productlabels')->display($_product);?>
  160.                     <?php endif;?>
  161.                 <?php endif; ?>
  162.  
  163.                     <div class="name-desc">
  164.  
  165.                     <!--product name-->
  166.                     <?php if ($setting->getProductsGrid_ShowProductName()):?>
  167.                         <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>
  168.                     <?php endif; ?>
  169.  
  170.                     <!--product description-->
  171.                     <?php if ($setting->getProductsGrid_ShowDesc()): ?>
  172.                         <div class="desc std">                        
  173.                             <?php
  174.                                 $shortdes =  $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description');
  175.                                 if(strlen($shortdes)>50) { //dem ki tu chuoi $str, 10o la chieu dai muon quy dinh
  176.                                     $strCutTitle = substr($shortdes, 0, 50); //cat 100 ki tu dau
  177.                                     $shortdes = substr($strCutTitle, 0, strrpos($strCutTitle, ' '));
  178.                                 }
  179.                                // echo $shortdes;
  180.                             ?>
  181.                         </div>
  182.                     <?php endif; ?>
  183.  
  184.                     </div>
  185.                 </div>
  186.  
  187.                 <!--show reviews-->
  188.                 <?php if ($setting->getProductsGrid_ShowReviews()):?>
  189.                     <?php if($_product->getRatingSummary()): ?>
  190.                     <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
  191.                     <?php endif; ?>
  192.                 <?php endif; ?>
  193.  
  194.                 <!--product price-->
  195.                 <?php if ($setting->getProductsGrid_ShowPrice()): ?>
  196.                     <?php echo $this->getPriceHtml($_product, true) ?>
  197.                 <?php endif; ?>
  198.  
  199.                 <div class="actions">
  200.                     <?php if($_product->isSaleable()): ?>
  201.                         <!--show button add to cart-->
  202.                         <?php if ($setting->getProductsGrid_ShowAddtocart()): ?>
  203.                             <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>
  204.                         <?php endif; ?>
  205.                     <?php else: ?>
  206.                         <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
  207.                     <?php endif; ?>
  208.  
  209.                     <!--show button add to compare-wishlist-->
  210.                     <?php if ($setting->getProductsGrid_ShowAddto()): ?>  
  211.                         <ul class="add-to-links">
  212.                             <?php if ($this->helper('wishlist')->isAllow()) : ?>
  213.                                 <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>
  214.                             <?php endif; ?>
  215.                             <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
  216.                                 <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>
  217.                             <?php endif; ?>
  218.                         </ul>
  219.                     <?php endif; ?>
  220.                 </div>
  221.             </div></li>
  222.         <?php endforeach ?>
  223.         </ul>
  224.     <?php endif; ?>
  225.         <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
  226.     <?php endif; ?>
  227.  
  228.     <div class="toolbar-bottom">
  229.         <?php echo $this->getToolbarHtml() ?>
  230.     </div>
  231. </div>
  232. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement