Advertisement
Guest User

product-list.tpl

a guest
Jun 3rd, 2018
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.30 KB | None | 0 0
  1. {*
  2. * 2007-2015 PrestaShop
  3. *
  4. * NOTICE OF LICENSE
  5. *
  6. * This source file is subject to the Academic Free License (AFL 3.0)
  7. * that is bundled with this package in the file LICENSE.txt.
  8. * It is also available through the world-wide-web at this URL:
  9. * http://opensource.org/licenses/afl-3.0.php
  10. * If you did not receive a copy of the license and are unable to
  11. * obtain it through the world-wide-web, please send an email
  12. * to license@prestashop.com so we can send you a copy immediately.
  13. *
  14. * DISCLAIMER
  15. *
  16. * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
  17. * versions in the future. If you wish to customize PrestaShop for your
  18. * needs please refer to http://www.prestashop.com for more information.
  19. *
  20. *  @author PrestaShop SA <contact@prestashop.com>
  21. *  @copyright  2007-2015 PrestaShop SA
  22. *  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  23. *  International Registered Trademark & Property of PrestaShop SA
  24. *}
  25. {if isset($products) && $products}
  26.     {*define number of products per line in other page for desktop*}
  27.     {if $page_name !='index' && $page_name !='product'}
  28.         {assign var='nbItemsPerLineMobile' value=2}
  29.     {else}
  30.         {assign var='nbItemsPerLineMobile' value=2}
  31.     {/if}
  32.     {if !isset($nbItemsPerLine)}
  33.         {assign var='nbItemsPerLine' value=4}
  34.     {/if}
  35.     {if !isset($nbItemsPerLineTablet)}
  36.         {assign var='nbItemsPerLineTablet' value=3}
  37.     {/if}
  38.     {if !isset($col_md)}
  39.         {assign var='col_md' value='col-md-3'}
  40.     {/if}
  41.     {if !isset($col_sm)}
  42.         {assign var='col_sm' value='col-sm-4'}
  43.     {/if}
  44.      
  45.     {*define numbers of product per line in other page for tablet*}
  46.     {assign var='nbLi' value=$products|@count}
  47.     {math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
  48.     {math equation="nbLi/nbItemsPerLineTablet" nbLi=$nbLi nbItemsPerLineTablet=$nbItemsPerLineTablet assign=nbLinesTablet}
  49.  
  50.     <!-- Products list -->
  51.     <ul{if isset($id) && $id} id="{$id}" {/if} class="product_list grid row{if isset($class) && $class} {$class}{/if}{if isset($active) && $active == 1} active{/if} not-animated" data-animate="fadeInLeft" data-delay="200">
  52.     {foreach from=$products item=product name=products}
  53.         {math equation="(total%perLine)" total=$smarty.foreach.products.total perLine=$nbItemsPerLine assign=totModulo}
  54.         {math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineTablet assign=totModuloTablet}
  55.         {math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineMobile assign=totModuloMobile}
  56.         {if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if}
  57.         {if $totModuloTablet == 0}{assign var='totModuloTablet' value=$nbItemsPerLineTablet}{/if}
  58.         {if $totModuloMobile == 0}{assign var='totModuloMobile' value=$nbItemsPerLineMobile}{/if}
  59.         <li class="ajax_block_product{if $page_name == 'index' || $page_name == 'product'} col-xs-12 col-sm-4 col-md-3{else} col-xs-12 {$col_sm} {$col_md}{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLine == 0} last-in-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLine == 1} first-in-line{/if}{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModulo)} last-line{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 0} last-item-of-tablet-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 1} first-item-of-tablet-line{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 0} last-item-of-mobile-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 1} first-item-of-mobile-line{/if}{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModuloMobile)} last-mobile-line{/if}">
  60.             <div class="product-container" itemscope itemtype="http://schema.org/Product">
  61.                 <div class="left-block">
  62.                     <div class="product-image-container">
  63.                     <div style="position: absolute;z-index: 1;color: black;"><p>{$product.reference}</p></div>
  64.                         <a class="product_img_link" href="{$product.link|escape:'html':'UTF-8'}" title="" itemprop="url">
  65.                             <img style="z-index: 0; class="replace-2x img-responsive" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'medium_default')|escape:'html':'UTF-8'}" alt="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" title="" {if isset($mediumSize)} width="{$mediumSize.width}" height="{$mediumSize.height}"{/if} itemprop="image" />
  66.                             <span class="bg_hover"></span>
  67.                         </a>
  68.                         {if isset($quick_view) && $quick_view}
  69.                             <a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}">
  70.                                 <span>{l s='Quick view'}</span>
  71.                             </a>
  72.                         {/if}
  73.                         {if isset($product.new) && $product.new == 1}
  74.                             <span class="new-box">
  75.                                 <span class="new-label">{l s='New'}</span>
  76.                             </span>
  77.                         {/if}
  78.                         {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
  79.                             <span class="sale-box">
  80.                                 <span class="sale-label">{l s='Sale!'}</span>
  81.                             </span>
  82.                         {/if}
  83.                        
  84.                     </div>
  85.                     {hook h="displayProductDeliveryTime" product=$product}
  86.                     {hook h="displayProductPriceBlock" product=$product type="weight"}
  87.                     <div class="button-container">
  88.                         {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
  89.                             {if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > 0)}
  90.                                 {if isset($static_token)}
  91.                                     <a class="ajax_add_to_cart_button cs_buttoncart" href="{$link->getPageLink('cart',false, NULL, "add=1&amp;id_product={$product.id_product|intval}&amp;token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">
  92.                                         <span>{l s='Add to cart'}</span>
  93.                                     </a>
  94.                                 {else}
  95.                                     <a class="ajax_add_to_cart_button cs_buttoncart" href="{$link->getPageLink('cart',false, NULL, 'add=1&amp;id_product={$product.id_product|intval}', false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">
  96.                                         <span>{l s='Add to cart'}</span>
  97.                                     </a>
  98.                                 {/if}                      
  99.                             {else}
  100.                                 <a class="cs_buttoncart disabled" href="javascript:void(0)" title="{l s='Out of stock'}">
  101.                                     <span>{l s='Out of stock'}</span>
  102.                                 </a>
  103.                             {/if}
  104.                         {/if}
  105.                        
  106.                         {if $page_name != 'index'}
  107.                             <div class="functional-buttons">
  108.                                 {hook h='displayProductListFunctionalButtons' product=$product}
  109.                                 {if isset($comparator_max_item) && $comparator_max_item}
  110.                                     <div class="compare">
  111.                                         <a class="add_to_compare" href="{$product.link|escape:'html':'UTF-8'}" data-id-product="{$product.id_product}" title="{l s='Add to Compare'}">{l s='Add to Compare'}</a>
  112.                                     </div>
  113.                                 {/if}
  114.                             </div>
  115.                         {/if}
  116.                     </div>
  117.                 </div>
  118.                 <div class="right-block">
  119.                     <h5 itemprop="name">
  120.                         {if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}
  121.                         <a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url" >
  122.                             {$product.name|truncate:45:'...'|escape:'html':'UTF-8'}
  123.                         </a>
  124.                     </h5>
  125.                     {hook h='displayProductListReviews' product=$product}
  126.                     <p class="product-desc" itemprop="description">
  127.                         {$product.description_short|strip_tags:'UTF-8'|truncate:50:'...'}
  128.                     </p>
  129.                     {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
  130.                     <div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="content_price">
  131.                         {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
  132.                             {if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction}
  133.                                 {hook h="displayProductPriceBlock" product=$product type="old_price"}
  134.                                 <span class="old-price product-price">
  135.                                     {displayWtPrice p=$product.price_without_reduction}
  136.                                 </span>
  137.                                 {hook h="displayProductPriceBlock" id_product=$product.id_product type="old_price"}
  138.                                 {if $product.specific_prices.reduction_type == 'percentage'}
  139.                                     <span class="price-percent-reduction"><span>-{$product.specific_prices.reduction * 100}%</span></span>
  140.                                 {/if}
  141.                             {/if}
  142.                                
  143.                             <span itemprop="price" class="price product-price">
  144.                                 {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
  145.                             </span>
  146.                             <meta itemprop="priceCurrency" content="{$currency->iso_code}" />
  147.                             {hook h="displayProductPriceBlock" product=$product type="price"}
  148.                             {hook h="displayProductPriceBlock" product=$product type="unit_price"}
  149.                         {/if}
  150.                     </div>
  151.                     {/if}
  152.                     <div class="product-flags">
  153.                         {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
  154.                             {if isset($product.online_only) && $product.online_only}
  155.                                 <span class="online_only">{l s='Online only'}</span>
  156.                             {/if}
  157.                         {/if}
  158.                         {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
  159.                             {elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
  160.                                 <span class="discount">{l s='Reduced price!'}</span>
  161.                             {/if}
  162.                     </div>
  163.                 </div>
  164.                
  165.             </div><!-- .product-container> -->
  166.         </li>
  167.     {/foreach}
  168.     </ul>
  169. {addJsDefL name=min_item}{l s='Please select at least one product' js=1}{/addJsDefL}
  170. {addJsDefL name=max_item}{l s='You cannot add more than %d product(s) to the product comparison' sprintf=$comparator_max_item js=1}{/addJsDefL}
  171. {addJsDef comparator_max_item=$comparator_max_item}
  172. {addJsDef comparedProductsIds=$compared_products}
  173. {/if}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement