Jump to content
jclaude

Avoir les vignettes des produits dans la facture

Recommended Posts

Bonjour,

 

Je suis en prestashop 1.6

 

Est-il possible en mettant la main dans le camboui (si une personne a déjà fait) ou à travers un module d'avoir les vignettes pour chaque produit acheté dans la facture ?

 

Je n'ai rien trouvé de tel dans addons.prestashop.com, le gentil conseiller en tchat m'a invité à solliciter un prestataire pour développer le module. J'ai trouvé qqs posts sur le forum à ce sujet, mais pour un pestashop 1.4.

 

Est-ce que qqun aurait déjà mis cela en place ?

 

Merci

 

Cdt,

JC

Share this post


Link to post
Share on other sites

Bon on va jouer le prestataire gratuit alors :)

Remplacez le contenu de votre fichier pdf/invoice.tpl par ça:

{*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <contact@prestashop.com>
*  @copyright  2007-2014 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
<div style="font-size: 8pt; color: #444">

<table>
	<tr><td> </td></tr>
</table>

<!-- ADDRESSES -->
<table style="width: 100%">
	<tr>
		<td style="width: 17%"></td>
		<td style="width: 83%">
			{if !empty($delivery_address)}
				<table style="width: 100%">
					<tr>
						<td style="width: 50%">
							<span style="font-weight: bold; font-size: 10pt; color: #9E9F9E">{l s='Delivery Address' pdf='true'}</span><br />
							 {$delivery_address}
						</td>
						<td style="width: 50%">
							<span style="font-weight: bold; font-size: 10pt; color: #9E9F9E">{l s='Billing Address' pdf='true'}</span><br />
							 {$invoice_address}
						</td>
					</tr>
				</table>
			{else}
				<table style="width: 100%">
					<tr>

						<td style="width: 50%">
							<span style="font-weight: bold; font-size: 10pt; color: #9E9F9E">{l s='Billing & Delivery Address.' pdf='true'}</span><br />
							 {$invoice_address}
						</td>
						<td style="width: 50%">

						</td>
					</tr>
				</table>
			{/if}
		</td>
	</tr>
</table>
<!-- / ADDRESSES -->

<div style="line-height: 1pt"> </div>

<!-- PRODUCTS TAB -->
<table style="width: 100%">
	<tr>
		<td style="width: 17%; padding-right: 7px; text-align: right; vertical-align: top; font-size: 7pt;">
			<!-- CUSTOMER INFORMATION -->
			<b>{l s='Order Number:' pdf='true'}</b><br />
			{$order->getUniqReference()}<br />
			<br />
			<b>{l s='Order Date:' pdf='true'}</b><br />
			{dateFormat date=$order->date_add full=0}<br />
			<br />
			<b>{l s='Payment Method:' pdf='true'}</b><br />
			<table style="width: 100%;">
			{foreach from=$order_invoice->getOrderPaymentCollection() item=payment}
				<tr>
					<td style="width: 50%">{$payment->payment_method}</td>
					<td style="width: 50%">{displayPrice price=$payment->amount currency=$order->id_currency}</td>
				</tr>
			{foreachelse}
				<tr>
					<td>{l s='No payment' pdf='true'}</td>
				</tr>
			{/foreach}
			</table>
			<br />
			{if isset($carrier)}
			<b>{l s='Carrier:' pdf='true'}</b><br />
			{$carrier->name}<br />
			<br />
			{/if}				
			<!-- / CUSTOMER INFORMATION -->
		</td>
		<td style="width: 83%; text-align: right">
			<table style="width: 100%; font-size: 8pt;">
				<tr style="line-height:4px;">
					<td style="background-color: #4D4D4D; color: #FFF; text-align: right; font-weight: bold; width: 10%; white-space: nowrap;">{l s='Image' pdf='true'}</td>
					<td style="text-align: left; background-color: #4D4D4D; color: #FFF; padding-left: 10px; font-weight: bold; width: {if !$tax_excluded_display}25%{else}35%{/if}">{l s='Product / Reference' pdf='true'}</td>
					<!-- unit price tax excluded is mandatory -->
					{if !$tax_excluded_display}
						<td style="background-color: #4D4D4D; color: #FFF; text-align: right; font-weight: bold; width: 20%">{l s='Unit Price' pdf='true'} <br />{l s='(Tax Excl.)' pdf='true'}</td>
					{/if}
					<td style="background-color: #4D4D4D; color: #FFF; text-align: right; font-weight: bold; width: 10%">
						{l s='Unit Price' pdf='true'}
						{if $tax_excluded_display}
							 {l s='(Tax Excl.)' pdf='true'}
						{else}
							 {l s='(Tax Incl.)' pdf='true'}
						{/if}
					</td>
					<td style="background-color: #4D4D4D; color: #FFF; text-align: right; font-weight: bold; width: 10%; white-space: nowrap;">{l s='Discount' pdf='true'}</td>
					<td style="background-color: #4D4D4D; color: #FFF; text-align: center; font-weight: bold; width: 10%">{l s='Qty' pdf='true'}</td>
					<td style="background-color: #4D4D4D; color: #FFF; text-align: right; font-weight: bold; width: {if !$tax_excluded_display}15%{else}25%{/if}">
						{l s='Total' pdf='true'}
						{if $tax_excluded_display}
							{l s='(Tax Excl.)' pdf='true'}
						{else}
							{l s='(Tax Incl.)' pdf='true'}
						{/if}
					</td>
				</tr>
				<!-- PRODUCTS -->
				{foreach $order_details as $order_detail}
				{cycle values='#FFF,#DDD' assign=bgcolor}
				<tr style="line-height:8px;background-color:{$bgcolor};">
				<td>{if isset($order_detail.image->id_image)}<img src="{$smarty.const._PS_PROD_IMG_DIR_}{Image::getImgFolderStatic($order_detail.image->id_image)}{$order_detail.image->id_image}-cart_default.{$order_detail.image->image_format}" width="30" alt="{$order_detail.product_name|escape:'html':'UTF-8'}" />{/if}</td>
					<td style="line-height:4px; text-align: left; width: {if !$tax_excluded_display}25%{else}35%{/if}">{$order_detail.product_name}{if isset($order_detail.product_reference) && !empty($order_detail.product_reference)} ({l s='Reference:' pdf='true'} {$order_detail.product_reference}){/if}</td>
					<!-- unit price tax excluded is mandatory -->
					{if !$tax_excluded_display}
						<td style="text-align: right; width: 20%; white-space: nowrap;">
						{displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_excl}
						</td>
					{/if}
					<td style="text-align: right; width: 10%; white-space: nowrap;">
					{if $tax_excluded_display}
						{displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_excl}
					{else}
						{displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_incl}
					{/if}
					</td>
					<td style="text-align: right; width: 10%">
					{if (isset($order_detail.reduction_amount) && $order_detail.reduction_amount > 0)}
						-{displayPrice currency=$order->id_currency price=$order_detail.reduction_amount}
					{elseif (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)}
						-{$order_detail.reduction_percent}%
					{else}
					--
					{/if}
					</td>
					<td style="text-align: center; width: 10%">{$order_detail.product_quantity}</td>
					<td style="text-align: right;  width: {if !$tax_excluded_display}15%{else}25%{/if}; white-space: nowrap;">
					{if $tax_excluded_display}
						{displayPrice currency=$order->id_currency price=$order_detail.total_price_tax_excl}
					{else}
						{displayPrice currency=$order->id_currency price=$order_detail.total_price_tax_incl}
					{/if}
					</td>
				</tr>
					{foreach $order_detail.customizedDatas as $customizationPerAddress}
						{foreach $customizationPerAddress as $customizationId => $customization}
							<tr style="line-height:6px;background-color:{$bgcolor};">
								<td style="line-height:3px; text-align: left; width: 40%; vertical-align: top" >
										<blockquote>
											{if isset($customization.datas[$smarty.const._CUSTOMIZE_TEXTFIELD_]) && count($customization.datas[$smarty.const._CUSTOMIZE_TEXTFIELD_]) > 0}
												{foreach $customization.datas[$smarty.const._CUSTOMIZE_TEXTFIELD_] as $customization_infos}
													{$customization_infos.name}: {$customization_infos.value}
													{if !$smarty.foreach.custo_foreach.last}<br />
													{else}
													<div style="line-height:0.4pt"> </div>
													{/if}
												{/foreach}
											{/if}

											{if isset($customization.datas[$smarty.const._CUSTOMIZE_FILE_]) && count($customization.datas[$smarty.const._CUSTOMIZE_FILE_]) > 0}
												{count($customization.datas[$smarty.const._CUSTOMIZE_FILE_])} {l s='image(s)' pdf='true'}
											{/if}
										</blockquote>
								</td>
								{if !$tax_excluded_display}
									<td style="text-align: right;"></td>
								{/if}
								<td style="text-align: right; width: 10%"></td>
								<td style="text-align: center; width: 10%; vertical-align: top">({$customization.quantity})</td>
								<td style="width: 15%; text-align: right;"></td>
							</tr>
						{/foreach}
					{/foreach}
				{/foreach}
				<!-- END PRODUCTS -->

				<!-- CART RULES -->
				{assign var="shipping_discount_tax_incl" value="0"}
				{foreach $cart_rules as $cart_rule}
					{cycle values='#FFF,#DDD' assign=bgcolor}
					<tr style="line-height:6px;background-color:{$bgcolor};text-align:left;">
						<td style="line-height:3px;text-align:left;width:60%;vertical-align:top" colspan="{if !$tax_excluded_display}5{else}4{/if}">{$cart_rule.name}</td>
						<td>
							{if $tax_excluded_display}
								- {$cart_rule.value_tax_excl}
							{else}
								- {$cart_rule.value}
							{/if}
						</td>
					</tr>
				{/foreach}
				<!-- END CART RULES -->
			</table>

			<table style="width: 100%">
				{if (($order_invoice->total_paid_tax_incl - $order_invoice->total_paid_tax_excl) > 0)}
				<tr style="line-height:5px;">
					<td style="width: 83%; text-align: right; font-weight: bold">{l s='Product Total (Tax Excl.)' pdf='true'}</td>
					<td style="width: 17%; text-align: right;">{displayPrice currency=$order->id_currency price=$order_invoice->total_products}</td>
				</tr>

				<tr style="line-height:5px;">
					<td style="width: 83%; text-align: right; font-weight: bold">{l s='Product Total (Tax Incl.)' pdf='true'}</td>
					<td style="width: 17%; text-align: right;">{displayPrice currency=$order->id_currency price=$order_invoice->total_products_wt}</td>
				</tr>
				{else}
				<tr style="line-height:5px;">
					<td style="width: 83%; text-align: right; font-weight: bold">{l s='Product Total' pdf='true'}</td>
					<td style="width: 17%; text-align: right;">{displayPrice currency=$order->id_currency price=$order_invoice->total_products}</td>
				</tr>
				{/if}

				{if $order_invoice->total_discount_tax_incl > 0}
				<tr style="line-height:5px;">
					<td style="text-align: right; font-weight: bold">{l s='Total Vouchers' pdf='true'}</td>
					<td style="width: 17%; text-align: right;">-{displayPrice currency=$order->id_currency price=($order_invoice->total_discount_tax_incl)}</td>
				</tr>
				{/if}

				{if $order_invoice->total_wrapping_tax_incl > 0}
				<tr style="line-height:5px;">
					<td style="text-align: right; font-weight: bold">{l s='Wrapping Cost' pdf='true'}</td>
					<td style="width: 17%; text-align: right;">
					{if $tax_excluded_display}
						{displayPrice currency=$order->id_currency price=$order_invoice->total_wrapping_tax_excl}
					{else}
						{displayPrice currency=$order->id_currency price=$order_invoice->total_wrapping_tax_incl}
					{/if}
					</td>
				</tr>
				{/if}

				{if $order_invoice->total_shipping_tax_incl > 0}
				<tr style="line-height:5px;">
					<td style="text-align: right; font-weight: bold">{l s='Shipping Cost' pdf='true'}</td>
					<td style="width: 17%; text-align: right;">
						{if $tax_excluded_display}
							{displayPrice currency=$order->id_currency price=$order_invoice->total_shipping_tax_excl}
							{else}
							{displayPrice currency=$order->id_currency price=$order_invoice->total_shipping_tax_incl}
						{/if}
					</td>
				</tr>
				{/if}

				{if ($order_invoice->total_paid_tax_incl - $order_invoice->total_paid_tax_excl) > 0}
				<tr style="line-height:5px;">
					<td style="text-align: right; font-weight: bold">{l s='Total Tax' pdf='true'}</td>
					<td style="width: 17%; text-align: right;">{displayPrice currency=$order->id_currency price=($order_invoice->total_paid_tax_incl - $order_invoice->total_paid_tax_excl)}</td>
				</tr>
				{/if}

				<tr style="line-height:5px;">
					<td style="text-align: right; font-weight: bold">{l s='Total' pdf='true'}</td>
					<td style="width: 17%; text-align: right;">{displayPrice currency=$order->id_currency price=$order_invoice->total_paid_tax_incl}</td>
				</tr>

			</table>

		</td>
	</tr>
</table>
<!-- / PRODUCTS TAB -->

<div style="line-height: 1pt"> </div>

{$tax_tab}

{if isset($order_invoice->note) && $order_invoice->note}
<div style="line-height: 1pt"> </div>
<table style="width: 100%">
	<tr>
		<td style="width: 17%"></td>
		<td style="width: 83%">{$order_invoice->note|nl2br}</td>
	</tr>
</table>
{/if}

{if isset($HOOK_DISPLAY_PDF)}
<div style="line-height: 1pt"> </div>
<table style="width: 100%">
	<tr>
		<td style="width: 17%"></td>
		<td style="width: 83%">{$HOOK_DISPLAY_PDF}</td>
	</tr>
</table>
{/if}

</div>

Share this post


Link to post
Share on other sites

Bonjour,

 

à confirmer eolia, mais je crois que l'on peut surcharger les tpl du répertoire pdf en intégrant celui-ci dans son template.

Ainsi on conserve la modification lors des updates.

Share this post


Link to post
Share on other sites

Bonjour,

 

à confirmer eolia, mais je crois que l'on peut surcharger les tpl du répertoire pdf en intégrant celui-ci dans son template.

Ainsi on conserve la modification lors des updates.

Oui tu as raison, pour bien faire:

1°) Créer un répertoire pdf à la racine de votre thème

2°) Créer un fichier invoice.tpl, y coller le contenu ci-dessus et le placer dans le répertoire pdf de votre thème

  • Like 1

Share this post


Link to post
Share on other sites

Oui tu as raison, pour bien faire:

1°) Créer un répertoire pdf à la racine de votre thème

2°) Créer un fichier invoice.tpl, y coller le contenu ci-dessus et le placer dans le répertoire pdf de votre thème

C'est parfait, c'est exactement cela que je cherchais. Merci beaucoup !

Share this post


Link to post
Share on other sites

Bsr,

Je viens d'installer la surcharge sur une presta 1.609 et rien ne se passe, avez vous une idée du pourquoi du comment de la chose??y a t-il une réinitialisation d'un réglage quelconque dans le BO???

Merci par avance

Share this post


Link to post
Share on other sites

Bsr,

Je viens d'installer la surcharge sur une presta 1.609 et rien ne se passe, avez vous une idée du pourquoi du comment de la chose??y a t-il une réinitialisation d'un réglage quelconque dans le BO???

Merci par avance

Videz vos caches (navigateur et Presta)

Share this post


Link to post
Share on other sites

supprime le fichier cache/class_index.php

il va se regénérer automatiquement avec les override normalement.

Pense aussi à supprimer le cache.

Share this post


Link to post
Share on other sites

supprime le fichier cache/class_index.php

il va se regénérer automatiquement avec les override normalement.

Euh... Ca c'est pour les overrides de classes (fichiers .php) , pas pour les templates (fichiers .tpl)

 

Pour tout ce qui concerne l'affichage et/ou l'utilisation de templates c'est le cache qu'il faut vider

Edited by Eolia (see edit history)

Share this post


Link to post
Share on other sites

Bsr,

Désolé pour le retard mais j’étais très occupé.

Je ne comprend pas j'ai vidé les caches et je n'ai toujours aucune vignette sur les facture, je pense avoir fait ce qui est préconisé.

Edited by machpro (see edit history)

Share this post


Link to post
Share on other sites

Si vous avez copié les fichiers au bon endroit cela doit fonctionner.

 

PS: je ne fais aucun support pour la 1.6.0.9, cette version est trop bugguée

Share this post


Link to post
Share on other sites

Merci Eolia pour ton astuce mais cela n'est valable que pour le pdf de la facture. Hors je souhaite faire de même dans la vue : Historique et détails de mes commandes coté FO.

Share this post


Link to post
Share on other sites

Alors ce n'est pas plus compliqué, il suffit de rajouter ligne 302 de order-detail.tpl la référence image:

...
								{else}<img src="{$link->getImageLink($product.product_name, $product.image->id, 'cart_default')|escape:'html'}" alt="{$product.product_name|escape:htmlall:'UTF-8'}" />
									{$product.product_name|escape:'html':'UTF-8'}
								{/if}
...
  • Like 1

Share this post


Link to post
Share on other sites

Alors voilà ce que cela donne mais rien n'arrive, j'ai tenté de placé le code avant, après... nada au final !

{foreach from=$discounts item=discount}
			<tr class="item">
			{else}<img src="{$link->getImageLink($product.product_name, $product.image->id, 'cart_default')|escape:'html'}" alt="{$product.product_name|escape:htmlall:'UTF-8'}" />
									{$product.product_name|escape:'html':'UTF-8'}
								{/if}
				<td>{$discount.name|escape:'htmlall':'UTF-8'}</td>
				<td>{l s='Voucher'} {$discount.name|escape:'htmlall':'UTF-8'}</td>
				<td><span class="order_qte_span editable">1</span></td>
				<td> </td>
				<td>{if $discount.value != 0.00}-{/if}{convertPriceWithCurrency price=$discount.value currency=$currency}</td>
				{if $return_allowed}
				<td> </td>
				{/if}
			</tr>
		{/foreach}

Share this post


Link to post
Share on other sites

Hum.. vous avez vidé votre cache et recompilé les templates ?

 

Moi j'ai ça:post-241780-0-59273900-1418772296_thumb.png

Share this post


Link to post
Share on other sites

Bonjour,

 

en ajoutant ce code (sur prestashop 1.4) :

$cover = Product::getCover((int)($product['product_id']));
if(is_array($cover)) $product = array_merge($cover, $product);


$limage = _PS_IMG_DIR_.'p/'.(int)($product['product_id']).'-'.(int)($product['id_image']).'-medium.jpg';

if (file_exists(_PS_IMG_DIR_.'p/'.(int)($product['product_id']).'-'.(int)($product['id_image']).'-medium.jpg'))

$this->Image(_PS_IMG_DIR_.'p/'.(int)($product['product_id']).'-'.(int)($product['id_image']).'-medium.jpg', 110,null,20);
else
$this->Image(_PS_IMG_DIR_.'tmp/product_mini_'.(int)($product['product_id']).'.jpg', 110,null,20);

cela fonctionne pour moi, mais QUE pour les produits n'ayant pas différents attributs et déclinaisons.... sinon aucune image ne s'affiche :(

une idée pour résoudre cela ?

Share this post


Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More