Jump to content

product-list tpl


Recommended Posts

Salut a tous,


 


en ce moment, je travaille sur une boutique pour un de mes client et je coince sur un codage tpl.


 


J'aimerais afficher sur product-list.tpl l'unité des prix ( exemple : kg, gr, m2, m3 )


 


J'ai tenté diverses configurations mais j'arrive a rien :


Voici le code que j'aimerais avoir : 



<div class="right-block">
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="content_price">
{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
<span itemprop="price" class="price product-price{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0} product-price-new{/if}">
{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
</span>
{if !empty($product->unity) && $product->unit_price_ratio > +0.000001}
{math equation="pprice / punit_price" pprice=$productPrice punit_price=$product->unit_price_ratio assign=unit_price}
<p class="unit-price" style="text-align: center; color: rgb(17, 17, 17);">{l s='Prix Unitaire : '}
<span id="unit_price_display">{convertPrice price=$unit_price}</span>
{l s='per'} {$product->unity|escape:'html':'UTF-8'}
</p>
{hook h="displayProductPriceBlock" product=$product type="unit_price"}
{/if}
</br>
</span>
{hook h="displayProductPriceBlock" id_product=$product.id_product type="old_price"}
{if $product.specific_prices.reduction_type == 'percentage'}
<a style="color:red;font-size: 17px">{l s='Au lieu de : '}</a><span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
{/if}
<meta itemprop="priceCurrency" content="{$currency->iso_code}" />
{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
{hook h="displayProductPriceBlock" product=$product type="old_price"}
<a style="color:red;font-size: 17px;">{l s='Au lieu de : '}</a><span class="old-price product-price">
{displayWtPrice p=$product.price_without_reduction}
</span>
{/if}
{hook h="displayProductPriceBlock" product=$product type="price"}
{hook h="displayProductPriceBlock" product=$product type="unit_price"}
{/if} 

J'espere que vous comprenez ce que je veut avoir, c'est a dire , quand on insere le prix unitaire en BA, l'unité s'affiche juste apres le prix dans product-list. tpl


 


Voici 2 images pour mieux comprendre.


 


VERSION PS : 1.6.1.9


URL : tinguely-gastronomie.ch


post-920267-0-82286000-1481756304_thumb.jpg

post-920267-0-56616800-1481756305_thumb.jpg

Link to comment
Share on other sites

Salut One Man,

 

voila la solution a ton problème -> product-list.tpl 

<div class="right-block">
                        {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                        <div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="content_price">
                            {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
                                <span itemprop="price" class="price product-price{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0} product-price-new{/if}">
                                    {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</br>
                                    {if $product.unit_price_ratio > 0}{math equation="pprice / punit_price"  pprice=$product.price  punit_price=$product.unit_price_ratio assign=unit_price}
                                    <span class="unit_price" style="font-size: 12px;">{convertPrice price=$unit_price} / {$product.unity|escape:'html':'UTF-8'}</span>{/if}
                                </span>

Voila, comme on dit, a force de chercher, bidouiller, on fini par trouver...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...