ajout picto listing

This commit is contained in:
Nolwenn 2016-06-14 12:01:16 +02:00
parent 1dce6f94c5
commit 7e029cc2dc
6 changed files with 40 additions and 4 deletions

View File

@ -162,11 +162,17 @@ class AdvPicto extends Module
public function hookDisplayPictogrammesProduct($params)
{
$id_product = $params['id_product'];
$is_listing = $params['is_listing'];
$pictos = AdvPictoClass::getPictosForProductDetails($id_product);
$this->smarty->assign('pictos', $pictos);
return $this->display(__FILE__, 'product.tpl');
if($is_listing)
{
return $this->display(__FILE__, 'category.tpl');
}
else {
return $this->display(__FILE__, 'product.tpl');
}
}
}

View File

@ -183,9 +183,11 @@ class AdvPictoClass extends ObjectModel
public static function getPictosForProductDetails($id_product = null)
{
$context = Context::getContext();
$id_product = (int) $id_product;
if(!empty($id_product) && is_int($id_product))
{
$query = '
SELECT DISTINCT(advp.`id_advpicto`), `title`
FROM `'._DB_PREFIX_.'advpicto_product` advp

View File

@ -2874,6 +2874,7 @@ main#categorycms { margin-bottom: 30px }
font-family: 'pompiere_regular';
color: #666666;
}
#product .pictos .picto:nth-child(odd) { padding-right: 5px; }
#product .pictos .picto:nth-child(even) { padding-left: 5px; }
#product .pictos .picto div {

View File

@ -503,6 +503,21 @@ header.page-heading.order-process { padding: 25px 0 0 0 }
.product-container .btn {
width: 100%;
}
.product-container .pictos {
margin-bottom: 15px;
}
.product-container .pictos li {
width: auto;
margin-right: 1%;
display: inline-block;
height: 38px;
max-width: 30%;
}
.product-container .pictos li img {
max-height: 100%;
max-width: 100%;
}
.product-container:hover .btn {
background: #6ac5bb none repeat scroll 0 0;
color: #fff;

View File

@ -0,0 +1,11 @@
{if $pictos}
<ul class="pictos">
{foreach from=$pictos item=picto name=picto}
{if $picto.hasImg}
<li>
<img src="{$base_dir}img/picto/{$picto.id_advpicto}.jpg" alt="{$picto.title}" />
</li>
{/if}
{/foreach}
</ul>
{/if}

View File

@ -25,7 +25,8 @@
<a class="product-img" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">
<img class="img-responsive" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}" alt="{$product.name|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="image" />
</a>
{hook h='displayPictogrammesCategory' id_product=$product.id}
{hook h='displayPictogrammesProduct' id_product=$product.id_product is_listing='true'}
</div>
<div class="col-md-7 product-infos">