Jump to content

Affichage prix HT et TTC


Recommended Posts

J'utilise la dernière version de predtashop

 

Sur la page d'information d'un produit je veux que le client voit et le prix hors taxe et le prix toutes charges comprises.

 

Pour le moment j'ai encore le thème de base de prestashop (est ce que ça changera quelque chose si par la suite je change de theme)

 

Qu'est ce que BO et FO ?

 

Merci de votre aide

Link to comment
Share on other sites

Ah, ben voilà :)

 

Donc la modification est à faire dans le product.tpl de votre thème. Vous devez avoir un bloc comme

                                                                        {if $priceDisplay >= 0 && $priceDisplay <= 2}
										<span id="our_price_display" class="price" itemprop="price" content="{$productPrice}">{convertPrice price=$productPrice|floatval}</span>
										{if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) || !isset($display_tax_label))}
											{if $priceDisplay == 1} {l s='tax excl.'}{else} {l s='tax incl.'}{/if}
										{/if}
										<meta itemprop="priceCurrency" content="{$currency->iso_code}" />
										{hook h="displayProductPriceBlock" product=$product type="price"}
									{/if}

A remplacer par:

									{if $priceDisplay >= 0 && $priceDisplay <= 2}
										<span id="our_price_ht" class="price"">{$productPrice|floatval}{$currency->sign}</span> {l s='tax excl.'}
										<span id="our_price_display" class="price" itemprop="price" content="{$productPrice}">{convertPrice price=$productPrice|floatval}</span> {l s='tax incl.'}
										<meta itemprop="priceCurrency" content="{$currency->iso_code}" />
										{hook h="displayProductPriceBlock" product=$product type="price"}
									{/if}
Link to comment
Share on other sites

Essayez-ça^^

{if $priceDisplay >= 0 && $priceDisplay <= 2}
	<p id="our_price_ht" class="price"">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> {l s='tax excl.'}</p>
	<span id="our_price_display" class="price" itemprop="price" content="{$productPrice}">{convertPrice price=$productPrice|floatval}</span> {l s='tax incl.'}
	<meta itemprop="priceCurrency" content="{$currency->iso_code}" />
	{hook h="displayProductPriceBlock" product=$product type="price"}
{/if}
Link to comment
Share on other sites

Ok, vous remplacez toute la div concernant les prices par ceci:

<div>
	<p class="our_price_display" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
		{if $product->quantity > 0}<link itemprop="availability" href="http://schema.org/InStock"/>{/if}
		{if $priceDisplay >= 0}
			<span id="pretaxe_price">
				<span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span>
				{l s='tax excl.'}
			</span><br />
			<meta itemprop="price" content="{$productPrice}">
			<span id="our_price_display">{convertPrice price=$productPrice}</span> {l s='tax incl.'}
			<meta itemprop="priceCurrency" content="{$currency->iso_code}" />
		{/if}
	</p>
	<p id="old_price"{if (!$product->specificPrice || !$product->specificPrice.reduction) && $group_reduction == 0} class="hidden"{/if}>
		{if $priceDisplay >= 0 && $priceDisplay <= 2}
			<span id="old_price_display">{if $productPriceWithoutReduction > $productPrice}{convertPrice price=$productPriceWithoutReduction}{/if}</span>
			<!-- {if $tax_enabled && $display_tax_label == 1}{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}{/if} -->
		{/if}
	</p>
</div> 

Et vous obtiendrez ceci: http://shop.devcustom.net/fr/robes-ete/7-robe-mousseline-imprimee.html

 

Ensuite je vous laisse jouer avec le css pour l'arranger à votre sauce

  • Like 1
Link to comment
Share on other sites

Pas possible, sauf si ce produit n'a pas de taxes :P

 public function getPrice($tax = true, $id_product_attribute = null, $decimals = 6,
        $divisor = null, $only_reduc = false, $usereduc = true, $quantity = 1)

Le 1er paramètre étant à false dans mon code, c'est forcément le prix HT

Link to comment
Share on other sites

Il ne calcule plus tout seul le prix TTC dans le back office, ca me laisse une case vide

Euh... vous avez un autre problème là.

Le calcul des prix en BO, c'est du javascript. Mes modifs sont dans le tpl de la page produit en Front Office, donc rien à voir.

 

Mais effectivement, si vous avez un souci en BO, ceci explique que les prix soient les mêmes en HT et TTC

Link to comment
Share on other sites

Je peux difficilement vous aider plus, je ne connais pas votre configuration.

De plus vous me dites que les prix ne se calculent plus en BO et vous m'envoyez un screen avec les 2 prix.

 

J'ai appliqué ma modification sur ma boutique de démo sans toucher à autre chose et cela fonctionne comme vous pouvez le constater sur le lien fourni.

 

Vous devez avoir d'autres éléments ou modules qui interfèrent...

Link to comment
Share on other sites

Quand tu visionnes ton prix tu es loggé en tant que client? en tant qu'invité?

J'ai les 2 tarifs HT et TTC sur la boutique que je suis entrain de créer avec à peu pret le même "code" qu'eolia t'a donné et ça fonctionne sans soucis

 

Pour ma part un client pro verra le prix HT en premier puis le TTC en plus petit dessous

Un client particulier ou un visiteur verra le TTC puis le HT en plus petit dessous.

Link to comment
Share on other sites


<!-- prices -->

<div>

<p class="our_price_display" itemprop="offers" itemscope itemtype="https://schema.org/Offer">{strip}

{if $product->quantity > 0}<link itemprop="availability" href="https://schema.org/InStock"/>{/if}

{if $priceDisplay >= 0 && $priceDisplay <= 2}

<span id="our_price_display" class="price" itemprop="price" content="{$productPrice}">{convertPrice price=$productPrice|floatval}</span>

{if $tax_enabled && ((isset($display_tax_label) && $display_tax_label == 1) || !isset($display_tax_label))}

{if $priceDisplay == 1} {l s='tax excl.'}{else} {l s='tax incl.'}{/if}

{/if}

<br />

{if $priceDisplay != 1}

{convertPrice price=$product->getPrice(false, $smarty.const.NULL)} {l s='tax excl.'}

{/if}

{if $priceDisplay == 1}

{convertPrice price=$product->getPrice(true, $smarty.const.NULL)} {l s='tax incl.'}

{/if}

<meta itemprop="priceCurrency" content="{$currency->iso_code}" />

{hook h="displayProductPriceBlock" product=$product type="price"}

{/if}

{/strip}</p>

Edited by Streize (see edit history)
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...