Jump to content

[Résolu] Afficher les prix HT et TTC sur l'email de confirmation de commande


Recommended Posts

oui , dans le fichier order_conf.html j'ai la variable {products}, cette variable affiche toute les informations du produit

je veux modifier le contenu de cette variable

 

et merci Mr6

Link to comment
Share on other sites

Bonjour à tous,

 

j'ai réussi d'ajouter le prix TTC et HT sur l’émail de confirmation de commande

dans le fichier classes/PaymentModule.php

 

if (!$customization_quantity || (int)$product['cart_quantity'] > $customization_quantity)
						$products_list .=
						'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
					   	 <td style="padding: 0.6em 0.4em;width: 15%;">'.$product['reference'].'</td>
							<td style="padding: 0.6em 0.4em;width: 35%;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').'</strong></td>
							<td style="padding: 0.6em 0.4em; width: 20%;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price, $this->context->currency, false).' HT <br />
							'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt, $this->context->currency, false).' TTC</td>
							<td style="padding: 0.6em 0.4em; width: 10%;">'.((int)$product['cart_quantity'] - $customization_quantity).'</td>
							<td style="padding: 0.6em 0.4em; width: 20%;">'.Tools::displayPrice(((int)$product['cart_quantity'] - $customization_quantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price), $this->context->currency, false).' HT <br />
							'.Tools::displayPrice(((int)$product['cart_quantity'] - $customization_quantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt), $this->context->currency, false).' TTC</td>
						</tr>';

 

dans le fichier /mails/order_conf.html

<table style="width: 100%; font-family: Verdana,sans-serif; font-size: 11px; color: #374953;"><!-- Title -->
<tbody>
<tr style="background-color: #b9babe; text-align: center;">
<th style="width: 15%; padding: 0.6em 0;">Référence</th>
<th style="width: 35%; padding: 0.6em 0;">Produit</th><th style="width: 20%; padding: 0.6em 0;">Prix unitaire</th><th style="width: 10%; padding: 0.6em 0;">Quantité</th><th style="width: 20%; padding: 0.6em 0;">Prix total</th></tr>
<tr>
<td colspan="5">{products} </td>
</tr>
<tr>
<td colspan="5">{discounts}</td>
</tr>
<tr style="text-align: right;">
<td> </td>
<td style="background-color: #b9babe; padding: 0.6em 0.4em;" colspan="2">Total produits</td>
<td style="background-color: #b9babe; padding: 0.6em 0.4em;">{total_productsht} HT<br />{total_products} TTC</td>
</tr>
</tbody>
</table>

 

et le résultat dans l'image ci-dessous

post-295981-0-03168700-1370513580_thumb.png

Edited by radhia005 (see edit history)
Link to comment
Share on other sites

Bon j'ai trouvé !

 

ca se passe dans le fichier PayementModule.php

 

Sur la fonction suivante :

if ($id_order_state != Configuration::get('PS_OS_ERROR') && $id_order_state != Configuration::get('PS_OS_CANCELED') && $this->context->customer->id)

 

Moi je suis ligne 566 (mais j'ai pu décaler certaines choses)

 

A la fin, en dessous de total_wrapping, j'ai ajouté la ligne '{total_products_ht}'...

'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $this->context->currency, false),
  '{total_products_ht}' => Tools::displayPrice($order->total_products, $this->context->currency, false),

 

Voila !!

Link to comment
Share on other sites

les prix sont en HT ?

moi j'ai mis dans la ligne 603

  '{total_productsht}' => Tools::displayPrice($order->total_paid_tax_excl - $order->total_shipping_tax_excl - $order->total_wrapping_tax_excl + $order->total_discounts_tax_excl, $this->context->currency, false),

Edited by radhia005 (see edit history)
Link to comment
Share on other sites

Heu non, mais je viens de m’apercevoir que ça ne fonctionne pas dans l’environnement de prod. J'ai mal du contrôler, je regarde la semaine prochaine seulement !!

 

J'ai une autre demande : je voudrais afficher le message du client !!

 

Est-ce que c'est possible ? (mailalerte le fait) Mais je ne vois vraiment pas comment l'ajouter !!

Link to comment
Share on other sites

  • 3 weeks later...

sur la version 1.5.4.0

dans le fichier classes/PaymentModule.php ligne (382)

if (!$customization_quantity || (int)$product['cart_quantity'] > $customization_quantity)
													$products_list .=
													'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
													 <td style="padding: 0.6em 0.4em;width: 15%;">'.$product['reference'].'</td>
															<td style="padding: 0.6em 0.4em;width: 35%;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').'</strong></td>
															<td style="padding: 0.6em 0.4em; width: 20%;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price, $this->context->currency, false).' HT <br />
															'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt, $this->context->currency, false).' TTC</td>
															<td style="padding: 0.6em 0.4em; width: 10%;">'.((int)$product['cart_quantity'] - $customization_quantity).'</td>
															<td style="padding: 0.6em 0.4em; width: 20%;">'.Tools::displayPrice(((int)$product['cart_quantity'] - $customization_quantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price), $this->context->currency, false).' HT <br />
															'.Tools::displayPrice(((int)$product['cart_quantity'] - $customization_quantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt), $this->context->currency, false).' TTC</td>
													</tr>';

et dans la ligne (603)

	  '{total_productsht}' => Tools::displayPrice($order->total_paid_tax_excl - $order->total_shipping_tax_excl - $order->total_wrapping_tax_excl + $order->total_discounts_tax_excl, $this->context->currency, false),

et dans le fichier /mails/order_conf.html

<table style="width: 100%; font-family: Verdana,sans-serif; font-size: 11px; color: #374953;"><!-- Title -->
<tbody>
<tr style="background-color: #b9babe; text-align: center;">
<th style="width: 15%; padding: 0.6em 0;">Référence</th>
<th style="width: 35%; padding: 0.6em 0;">Produit</th><th style="width: 20%; padding: 0.6em 0;">Prix unitaire</th><th style="width: 10%; padding: 0.6em 0;">Quantité</th><th style="width: 20%; padding: 0.6em 0;">Prix total</th></tr>
<tr>
<td colspan="5">{products} </td>
</tr>
<tr>
<td colspan="5">{discounts}</td>
</tr>
<tr style="text-align: right;">
<td> </td>
<td style="background-color: #b9babe; padding: 0.6em 0.4em;" colspan="2">Total produits</td>
<td style="background-color: #b9babe; padding: 0.6em 0.4em;">{total_productsht} HT<br />{total_products} TTC</td>
</tr>
</tbody>
</table>

Link to comment
Share on other sites

C'est ca il suffit de copier coller ça ligne 379 :

 

'{total_productsht}' => Tools::displayPrice($order->total_paid_tax_excl - $order->total_shipping_tax_excl - $order->total_wrapping_tax_excl + $order->total_discounts_tax_excl, $this->context->currency, false),

Link to comment
Share on other sites

par contre j'aurais besoin du prix HT et TTC sur chaque produit, aurait tu une idée ?

ça existe sur le mail de confirmation de commande envoyé au client et est stocké dans la balise {product}

Dans Alerte Email la balise est {item} et ne semble stocké que le ttc.

Link to comment
Share on other sites

C'est gentil, je vais essayer de détailler au maximum en attendant.

 

la balise {item} ressort le prix par produit la quantité et le prix total par produit.

 

Celle-ci contient :

 

$items_table .=
   '<tr style="background-color:'.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
 <td style="padding:0.6em 0.4em;">'.$product['product_reference'].'</td>
 <td style="padding:0.6em 0.4em;">
  <strong>'
   .$product['product_name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').(!empty($customization_text) ? '<br />'.$customization_text : '').
  '</strong>
 </td>
 <td style="padding:0.6em 0.4em; text-align:right;">'.Tools::displayPrice($unit_price, $currency, false).'</td>
 <td style="padding:0.6em 0.4em; text-align:center;">'.(int)$product['product_quantity'].'</td>
 <td style="padding:0.6em 0.4em; text-align:right;">'.Tools::displayPrice(($unit_price * $product['product_quantity']), $currency, false).'</td>
   </tr>';

 

 

unit_price correspond au prix affiché récupère la valeur : $unit_price = $product['product_price_wt'];

 

il faudrait donc resortir le prix produit sans taxe mais je ne sais pas comment il s'ecrit

Link to comment
Share on other sites

J'ai fait un nouveau point, les solutions ici fonctionnent très bien !

(Je vous confirme que ma ligne fonctionne. les taxes sont actives)

 

j'ai trouvé ça :

{id_order}' => sprintf('%06d', $order->id),

 

Pour indiquer le numéro de la commande

 

Je cherche à indiquer la remise (promo) d'un produit sur le mailalerte mais je n'y parviens pas !

Si quelqu'un a une idée !!

Link to comment
Share on other sites

Bonjour,

 

Travaillant surtout avec les pro, cette astuce m'est fort utile et bien suivi les infos et cela fonctionne à un détail près, les prix des produits sont affichés HT dans les 2 prix affichés HT et TTC, par contre le total reprend bien le montant HT et TTC (voir visu).

 

SI quelqu'un pouvait m'orienter...

 

Merci à vous

Olivier

Link to comment
Share on other sites

  • 9 months later...

re bonjour,

 

je me retrouve dans le meme cas de figure que tresordargan, c'est a dire que les deux prix affichés sont identique. (prix HT)

 

post-169139-0-13231100-1397223554_thumb.jpg

 

merci pour votre aide

 

Bonjour,

Travaillant surtout avec les pro, cette astuce m'est fort utile et bien suivi les infos et cela fonctionne à un détail près, les prix des produits sont affichés HT dans les 2 prix affichés HT et TTC, par contre le total reprend bien le montant HT et TTC (voir visu).

SI quelqu'un pouvait m'orienter...

Merci à vous
Olivier

 

Link to comment
Share on other sites

Bonjour,

 

je vous fais un petit up car j'ai toujours le meme probleme avec le prix HT qui s'affiche au lieu du prix TTC.

 

merci de votre aide

 bonjour, 

 

vous pouvez mettre votre code pour le vérifier ?

Link to comment
Share on other sites

bonjour,

 

votre code est identique à mon code, mais je n'ai pas trouvé

je vais revoir le code après parce que je suis occupée maintenant,

mais j'ai une question (vous travaillez sur quelle version du prestashop ? )

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 years later...

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...