PageRenderTime 27ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/themes/default-bootstrap/product-list.tpl

https://gitlab.com/ptisky/API_prestashop
Smarty Template | 222 lines | 195 code | 1 blank | 26 comment | 95 complexity | 3364cfb09fd35e41afddfe4a8cfd97f8 MD5 | raw file
  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='nbItemsPerLine' value=3}
  29. {assign var='nbItemsPerLineTablet' value=2}
  30. {assign var='nbItemsPerLineMobile' value=3}
  31. {else}
  32. {assign var='nbItemsPerLine' value=4}
  33. {assign var='nbItemsPerLineTablet' value=3}
  34. {assign var='nbItemsPerLineMobile' value=2}
  35. {/if}
  36. {*define numbers of product per line in other page for tablet*}
  37. {assign var='nbLi' value=$products|@count}
  38. {math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
  39. {math equation="nbLi/nbItemsPerLineTablet" nbLi=$nbLi nbItemsPerLineTablet=$nbItemsPerLineTablet assign=nbLinesTablet}
  40. <!-- Products list -->
  41. <ul{if isset($id) && $id} id="{$id}"{/if} class="product_list grid row{if isset($class) && $class} {$class}{/if}">
  42. {foreach from=$products item=product name=products}
  43. {math equation="(total%perLine)" total=$smarty.foreach.products.total perLine=$nbItemsPerLine assign=totModulo}
  44. {math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineTablet assign=totModuloTablet}
  45. {math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineMobile assign=totModuloMobile}
  46. {if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if}
  47. {if $totModuloTablet == 0}{assign var='totModuloTablet' value=$nbItemsPerLineTablet}{/if}
  48. {if $totModuloMobile == 0}{assign var='totModuloMobile' value=$nbItemsPerLineMobile}{/if}
  49. <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-6 col-md-4{/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}">
  50. <div class="product-container" itemscope itemtype="https://schema.org/Product">
  51. <div class="left-block">
  52. <div class="product-image-container">
  53. <a class="product_img_link" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">
  54. <img class="replace-2x img-responsive" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_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 !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} itemprop="image" />
  55. </a>
  56. {if isset($quick_view) && $quick_view}
  57. <div class="quick-view-wrapper-mobile">
  58. <a class="quick-view-mobile" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}">
  59. <i class="icon-eye-open"></i>
  60. </a>
  61. </div>
  62. <a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}">
  63. <span>{l s='Quick view'}</span>
  64. </a>
  65. {/if}
  66. {if (!$PS_CATALOG_MODE && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
  67. <div class="content_price" itemprop="offers" itemscope itemtype="https://schema.org/Offer">
  68. {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
  69. <span itemprop="price" class="price product-price">
  70. {hook h="displayProductPriceBlock" product=$product type="before_price"}
  71. {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
  72. </span>
  73. <meta itemprop="priceCurrency" content="{$currency->iso_code}" />
  74. {if $product.price_without_reduction > 0 && isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
  75. {hook h="displayProductPriceBlock" product=$product type="old_price"}
  76. <span class="old-price product-price">
  77. {displayWtPrice p=$product.price_without_reduction}
  78. </span>
  79. {if $product.specific_prices.reduction_type == 'percentage'}
  80. <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
  81. {/if}
  82. {/if}
  83. {if $PS_STOCK_MANAGEMENT && isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
  84. <span class="unvisible">
  85. {if ($product.allow_oosp || $product.quantity > 0)}
  86. <link itemprop="availability" href="https://schema.org/InStock" />{if $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='In Stock'}{/if}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}
  87. {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
  88. <link itemprop="availability" href="https://schema.org/LimitedAvailability" />{l s='Product available with different options'}
  89. {else}
  90. <link itemprop="availability" href="https://schema.org/OutOfStock" />{l s='Out of stock'}
  91. {/if}
  92. </span>
  93. {/if}
  94. {hook h="displayProductPriceBlock" product=$product type="price"}
  95. {hook h="displayProductPriceBlock" product=$product type="unit_price"}
  96. {/if}
  97. </div>
  98. {/if}
  99. {if isset($product.new) && $product.new == 1}
  100. <a class="new-box" href="{$product.link|escape:'html':'UTF-8'}">
  101. <span class="new-label">{l s='New'}</span>
  102. </a>
  103. {/if}
  104. {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
  105. <a class="sale-box" href="{$product.link|escape:'html':'UTF-8'}">
  106. <span class="sale-label">{l s='Sale!'}</span>
  107. </a>
  108. {/if}
  109. </div>
  110. {if isset($product.is_virtual) && !$product.is_virtual}{hook h="displayProductDeliveryTime" product=$product}{/if}
  111. {hook h="displayProductPriceBlock" product=$product type="weight"}
  112. </div>
  113. <div class="right-block">
  114. <h5 itemprop="name">
  115. {if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}
  116. <a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url" >
  117. {$product.name|truncate:45:'...'|escape:'html':'UTF-8'}
  118. </a>
  119. </h5>
  120. {capture name='displayProductListReviews'}{hook h='displayProductListReviews' product=$product}{/capture}
  121. {if $smarty.capture.displayProductListReviews}
  122. <div class="hook-reviews">
  123. {hook h='displayProductListReviews' product=$product}
  124. </div>
  125. {/if}
  126. <p class="product-desc" itemprop="description">
  127. {$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}
  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 class="content_price">
  131. {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
  132. {hook h="displayProductPriceBlock" product=$product type='before_price'}
  133. <span class="price product-price">
  134. {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
  135. </span>
  136. {if $product.price_without_reduction > 0 && isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
  137. {hook h="displayProductPriceBlock" product=$product type="old_price"}
  138. <span class="old-price product-price">
  139. {displayWtPrice p=$product.price_without_reduction}
  140. </span>
  141. {hook h="displayProductPriceBlock" id_product=$product.id_product type="old_price"}
  142. {if $product.specific_prices.reduction_type == 'percentage'}
  143. <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
  144. {/if}
  145. {/if}
  146. {hook h="displayProductPriceBlock" product=$product type="price"}
  147. {hook h="displayProductPriceBlock" product=$product type="unit_price"}
  148. {hook h="displayProductPriceBlock" product=$product type='after_price'}
  149. {/if}
  150. </div>
  151. {/if}
  152. <div class="button-container">
  153. {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.customizable != 2 && !$PS_CATALOG_MODE}
  154. {if (!isset($product.customization_required) || !$product.customization_required) && ($product.allow_oosp || $product.quantity > 0)}
  155. {capture}add=1&amp;id_product={$product.id_product|intval}{if isset($product.id_product_attribute) && $product.id_product_attribute}&amp;ipa={$product.id_product_attribute|intval}{/if}{if isset($static_token)}&amp;token={$static_token}{/if}{/capture}
  156. <a class="button ajax_add_to_cart_button btn btn-default" href="{$link->getPageLink('cart', true, NULL, $smarty.capture.default, false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product-attribute="{$product.id_product_attribute|intval}" data-id-product="{$product.id_product|intval}" data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity >= 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}">
  157. <span>{l s='Add to cart'}</span>
  158. </a>
  159. {else}
  160. <span class="button ajax_add_to_cart_button btn btn-default disabled">
  161. <span>{l s='Add to cart'}</span>
  162. </span>
  163. {/if}
  164. {/if}
  165. <a class="button lnk_view btn btn-default" href="{$product.link|escape:'html':'UTF-8'}" title="{l s='View'}">
  166. <span>{if (isset($product.customization_required) && $product.customization_required)}{l s='Customize'}{else}{l s='More'}{/if}</span>
  167. </a>
  168. </div>
  169. {if isset($product.color_list)}
  170. <div class="color-list-container">{$product.color_list}</div>
  171. {/if}
  172. <div class="product-flags">
  173. {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
  174. {if isset($product.online_only) && $product.online_only}
  175. <span class="online_only">{l s='Online only'}</span>
  176. {/if}
  177. {/if}
  178. {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
  179. {elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
  180. <span class="discount">{l s='Reduced price!'}</span>
  181. {/if}
  182. </div>
  183. {if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
  184. {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
  185. <span class="availability">
  186. {if ($product.allow_oosp || $product.quantity > 0)}
  187. <span class="{if $product.quantity <= 0 && isset($product.allow_oosp) && !$product.allow_oosp} label-danger{elseif $product.quantity <= 0} label-warning{else} label-success{/if}">
  188. {if $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='In Stock'}{/if}{else}{l s='Out of stock'}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}
  189. </span>
  190. {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
  191. <span class="label-warning">
  192. {l s='Product available with different options'}
  193. </span>
  194. {else}
  195. <span class="label-danger">
  196. {l s='Out of stock'}
  197. </span>
  198. {/if}
  199. </span>
  200. {/if}
  201. {/if}
  202. </div>
  203. {if $page_name != 'index'}
  204. <div class="functional-buttons clearfix">
  205. {hook h='displayProductListFunctionalButtons' product=$product}
  206. {if isset($comparator_max_item) && $comparator_max_item}
  207. <div class="compare">
  208. <a class="add_to_compare" href="{$product.link|escape:'html':'UTF-8'}" data-id-product="{$product.id_product}">{l s='Add to Compare'}</a>
  209. </div>
  210. {/if}
  211. </div>
  212. {/if}
  213. </div><!-- .product-container> -->
  214. </li>
  215. {/foreach}
  216. </ul>
  217. {addJsDefL name=min_item}{l s='Please select at least one product' js=1}{/addJsDefL}
  218. {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}
  219. {addJsDef comparator_max_item=$comparator_max_item}
  220. {addJsDef comparedProductsIds=$compared_products}
  221. {/if}