// data-id-product instead of using rel tag
This commit is contained in:
1 parent
68edf085d4
commit
ad6ed3dcf1
6 files changed
+401
-345
No files matched your search
@@ -22,104 +22,119 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if isset($products)}
|
||||
{*define numbers of product per line in other page for desktop*}
|
||||
{if $page_name !='index' && $page_name !='product'}
|
||||
{assign var='nbItemsPerLine' value=3}
|
||||
{assign var='nbItemsPerLineTablet' value=2}
|
||||
{assign var='nbItemsPerLineMobile' value=3}
|
||||
{else}
|
||||
{assign var='nbItemsPerLine' value=4}
|
||||
{assign var='nbItemsPerLineTablet' value=3}
|
||||
{assign var='nbItemsPerLineMobile' value=2}
|
||||
{/if}
|
||||
{*define numbers of product per line in other page for tablet*}
|
||||
{assign var='nbLi' value=$products|@count}
|
||||
{math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
|
||||
{math equation="nbLi/nbItemsPerLineTablet" nbLi=$nbLi nbItemsPerLineTablet=$nbItemsPerLineTablet assign=nbLinesTablet}
|
||||
{assign var='nbItemsPerLineTablet' value=2}
|
||||
{assign var='nbItemsPerLineMobile' value=3}
|
||||
{else}
|
||||
{assign var='nbItemsPerLine' value=4}
|
||||
{assign var='nbItemsPerLineTablet' value=3}
|
||||
{assign var='nbItemsPerLineMobile' value=2}
|
||||
{/if}
|
||||
{*define numbers of product per line in other page for tablet*}
|
||||
{assign var='nbLi' value=$products|@count}
|
||||
{math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
|
||||
{math equation="nbLi/nbItemsPerLineTablet" nbLi=$nbLi nbItemsPerLineTablet=$nbItemsPerLineTablet assign=nbLinesTablet}
|
||||
<!-- Products list -->
|
||||
<ul class="product_list grid row {if isset($class) && $class} {$class}{/if}">
|
||||
{foreach from=$products item=product name=products}
|
||||
{math equation="(total%perLine)" total=$smarty.foreach.products.total perLine=$nbItemsPerLine assign=totModulo}
|
||||
{math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineTablet assign=totModuloTablet}
|
||||
{math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineMobile assign=totModuloMobile}
|
||||
{if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if}
|
||||
{if $totModuloTablet == 0}{assign var='totModuloTablet' value=$nbItemsPerLineTablet}{/if}
|
||||
{if $totModuloMobile == 0}{assign var='totModuloMobile' value=$nbItemsPerLineMobile}{/if}
|
||||
{math equation="(total%perLine)" total=$smarty.foreach.products.total perLine=$nbItemsPerLine assign=totModulo}
|
||||
{math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineTablet assign=totModuloTablet}
|
||||
{math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineMobile assign=totModuloMobile}
|
||||
{if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if}
|
||||
{if $totModuloTablet == 0}{assign var='totModuloTablet' value=$nbItemsPerLineTablet}{/if}
|
||||
{if $totModuloMobile == 0}{assign var='totModuloMobile' value=$nbItemsPerLineMobile}{/if}
|
||||
<li class="ajax_block_product {if $page_name == 'index' || $page_name == 'product'}col-xs-12 col-sm-4 col-md-3{/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}">
|
||||
<div class="product-container">
|
||||
<div class="left-block">
|
||||
<div class="product-image-container">
|
||||
<a href="{$product.link|escape:'html':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'html':'UTF-8'}">
|
||||
<img itemprop="image" class="replace-2x img-responsive" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" 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} />
|
||||
</a>
|
||||
{if isset($quick_view) && $quick_view}<a href="#" rel="{$product.link|escape:'html':'UTF-8'}" class="quick-view"><span>Quick view</span></a>{/if}
|
||||
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
|
||||
<div class="content_price">
|
||||
{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
|
||||
<span class="price product-price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>
|
||||
{if isset($product.specific_prices) && $product.specific_prices}
|
||||
<span class="old-price product-price">{displayWtPrice p=$product.price_without_reduction}</span>
|
||||
{if isset($product.specific_prices.reduction) && $product.specific_prices.reduction && $product.specific_prices.reduction_type == 'percentage'}<span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($product.new) && $product.new == 1}<span class="new-box"><span class="new-label">{l s='New'}</span></span>{/if}
|
||||
{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="sale-box"><span class="sale-label">{l s='Sale!'}</span></span>{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-block">
|
||||
<h5>{if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}<a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}">{$product.name|truncate:45:'...'|escape:'html':'UTF-8'}</a></h5>
|
||||
{hook h='displayProductListReviews' product=$product}
|
||||
<p class="product-desc">{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}</p>
|
||||
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
|
||||
<div class="content_price">
|
||||
{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
|
||||
<span class="price product-price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>
|
||||
{if isset($product.specific_prices) && $product.specific_prices}
|
||||
<span class="old-price product-price">{displayWtPrice p=$product.price_without_reduction}</span>
|
||||
{if isset($product.specific_prices.reduction) && $product.specific_prices.reduction && $product.specific_prices.reduction_type == 'percentage'}<span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="button-container">
|
||||
{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}
|
||||
{if ($product.allow_oosp || $product.quantity > 0)}
|
||||
{if isset($static_token)}
|
||||
<a class="button ajax_add_to_cart_button btn btn-default" rel="ajax_id_product_{$product.id_product|intval} nofollow" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html'}" title="{l s='Add to cart'}"><span>{l s='Add to cart'}</span></a>
|
||||
{else}
|
||||
<a class="button ajax_add_to_cart_button btn btn-default" rel="ajax_id_product_{$product.id_product|intval} nofollow" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}", false)|escape:'html'}" title="{l s='Add to cart'}"><span>{l s='Add to cart'}</span></a>
|
||||
{/if}
|
||||
{else}
|
||||
<span class="button ajax_add_to_cart_button btn btn-default disabled"><span>{l s='Add to cart'}</span></span>
|
||||
{/if}
|
||||
{/if}
|
||||
<a class="button lnk_view btn btn-default" href="{$product.link|escape:'html':'UTF-8'}" title="{l s='View'}"><span>{l s='More'}</span></a>
|
||||
</div>
|
||||
|
||||
{if isset($product.color_list)}<div class="color-list-container">{$product.color_list} </div>{/if}
|
||||
<div class="product-flags">
|
||||
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
|
||||
{if isset($product.online_only) && $product.online_only}<span class="online_only">{l s='Online only'}</span>{/if}
|
||||
{/if}
|
||||
{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
|
||||
{elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="discount">{l s='Reduced price!'}</span>{/if}
|
||||
</div>
|
||||
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
|
||||
{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}<span class="available-now">{l s='In Stock'}</span>{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}<span class="available-dif">{l s='Product available with different options'}</span>{else}<span class="out-of-stock">{l s='Out of stock'}</span>{/if}</span>{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="functional-buttons clearfix">
|
||||
<div class="product-container">
|
||||
<div class="left-block">
|
||||
<div class="product-image-container">
|
||||
<a href="{$product.link|escape:'html':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'html':'UTF-8'}">
|
||||
<img itemprop="image" class="replace-2x img-responsive" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html'}" 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} />
|
||||
</a>
|
||||
{if isset($quick_view) && $quick_view}<a href="#" rel="{$product.link|escape:'html':'UTF-8'}" class="quick-view"><span>Quick view</span></a>{/if}
|
||||
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
|
||||
<div class="content_price">
|
||||
{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
|
||||
<span class="price product-price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>
|
||||
{if isset($product.specific_prices) && $product.specific_prices}
|
||||
<span class="old-price product-price">{displayWtPrice p=$product.price_without_reduction}</span>
|
||||
{if isset($product.specific_prices.reduction) && $product.specific_prices.reduction && $product.specific_prices.reduction_type == 'percentage'}<span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($product.new) && $product.new == 1}<span class="new-box"><span class="new-label">{l s='New'}</span></span>{/if}
|
||||
{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="sale-box"><span class="sale-label">{l s='Sale!'}</span></span>{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-block">
|
||||
<h5>{if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}<a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}">{$product.name|truncate:45:'...'|escape:'html':'UTF-8'}</a></h5>
|
||||
{hook h='displayProductListReviews' product=$product}
|
||||
<p class="product-desc">{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}</p>
|
||||
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
|
||||
<div class="content_price">
|
||||
{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
|
||||
<span class="price product-price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>
|
||||
{if isset($product.specific_prices) && $product.specific_prices}
|
||||
<span class="old-price product-price">{displayWtPrice p=$product.price_without_reduction}</span>
|
||||
{if isset($product.specific_prices.reduction) && $product.specific_prices.reduction && $product.specific_prices.reduction_type == 'percentage'}<span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="button-container">
|
||||
{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}
|
||||
{if ($product.allow_oosp || $product.quantity > 0)}
|
||||
{if isset($static_token)}
|
||||
<a
|
||||
class="button ajax_add_to_cart_button btn btn-default"
|
||||
rel="nofollow"
|
||||
data-id-product="{$product.id_product|intval}"
|
||||
href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html'}"
|
||||
title="{l s='Add to cart'}">
|
||||
<span>{l s='Add to cart'}</span>
|
||||
</a>
|
||||
{else}
|
||||
<a
|
||||
class="button ajax_add_to_cart_button btn btn-default"
|
||||
rel="nofollow"
|
||||
data-id-product="{$product.id_product|intval}"
|
||||
href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}", false)|escape:'html'}"
|
||||
title="{l s='Add to cart'}">
|
||||
<span>{l s='Add to cart'}</span>
|
||||
</a>
|
||||
{/if}
|
||||
{else}
|
||||
<span class="button ajax_add_to_cart_button btn btn-default disabled"><span>{l s='Add to cart'}</span></span>
|
||||
{/if}
|
||||
{/if}
|
||||
<a class="button lnk_view btn btn-default" href="{$product.link|escape:'html':'UTF-8'}" title="{l s='View'}"><span>{l s='More'}</span></a>
|
||||
</div>
|
||||
|
||||
{if isset($product.color_list)}<div class="color-list-container">{$product.color_list} </div>{/if}
|
||||
<div class="product-flags">
|
||||
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
|
||||
{if isset($product.online_only) && $product.online_only}<span class="online_only">{l s='Online only'}</span>{/if}
|
||||
{/if}
|
||||
{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
|
||||
{elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="discount">{l s='Reduced price!'}</span>{/if}
|
||||
</div>
|
||||
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
|
||||
{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}<span class="available-now">{l s='In Stock'}</span>{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}<span class="available-dif">{l s='Product available with different options'}</span>{else}<span class="out-of-stock">{l s='Out of stock'}</span>{/if}</span>{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="functional-buttons clearfix">
|
||||
{hook h='displayProductListFunctionalButtons' product=$product}
|
||||
{if isset($comparator_max_item) && $comparator_max_item}
|
||||
<div class="compare">
|
||||
<a href="#" rel="{$product.id_product}" class="addToCompare" onClick="addToCompare('{$product.id_product|intval}'); return false;">{l s='Add to Compare'}</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{if isset($comparator_max_item) && $comparator_max_item}
|
||||
<div class="compare">
|
||||
<a href="#" rel="{$product.id_product}" class="addToCompare" onClick="addToCompare('{$product.id_product|intval}'); return false;">{l s='Add to Compare'}</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div><!-- .product-container> -->
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
@@ -129,10 +144,10 @@
|
||||
var comparator_max_item = {$comparator_max_item};
|
||||
var comparedProductsIds = [];
|
||||
{foreach from=$compared_products key=k item=product}comparedProductsIds.push({$product});{/foreach}
|
||||
$('document').ready(function(){
|
||||
blockHover();
|
||||
});
|
||||
</script>
|
||||
$('document').ready(function(){
|
||||
blockHover();
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
<script type="text/javascript">
|
||||
function blockHover(status) {
|
||||
@@ -149,6 +164,7 @@
|
||||
)});
|
||||
}
|
||||
</script>
|
||||
|
||||
{if $page_name !='index' && $page_name !='product'} <!--// excluding page for Grid/List-->
|
||||
<script type="text/javascript"><!--
|
||||
function display(view) {
|
||||
@@ -243,6 +259,6 @@
|
||||
} else {
|
||||
display('grid');
|
||||
}
|
||||
//--></script>
|
||||
//--></script>
|
||||
{/if}
|
||||
{/if}
|
||||
Reference in new issue
Block a user