Jump to content
  • 0
roz

Display Features in Invoice

Question

hi all!

 

anyone here how to display product features in Invoice and in Delivery Slip PDFs? :)

 

thanks in advance :)

Share this post


Link to post
Share on other sites

14 answers to this question

Recommended Posts

  • 0

Product features should be combined and stored in the order. Or I'm wrong or you want it otherwise. How exactly?

Share this post


Link to post
Share on other sites
  • 0

Product features should be combined and stored in the order. Or I'm wrong or you want it otherwise. How exactly?

 

hi tuk66!

what do you mean by combined and stored in the order? :)

but what i meant is, see image below. 

vRNkj.jpg

the weight and pack size, i want them to include at the end of the product description in Invoice and Delivery Slip pdf. i want it to show like

 

"TRIPLE-M GIANT SHEET SEAWEED (ORIGINAL) 6Gx10S"

Share this post


Link to post
Share on other sites
  • 0

I mean that attributes are normally joined and saved together with the product name. In my example iPod has a color attribute.

post-92842-0-33862200-1399875017_thumb.jpg

Share this post


Link to post
Share on other sites
  • 0

I mean that attributes are normally joined and saved together with the product name. In my example iPod has a color attribute.

 

hmm.. but it appears to me like this..

DUATd.jpg

i'm using Features. not Attributes. will there be any difference? you mean Features can't appear on Invoice? 

Edited by roz

Share this post


Link to post
Share on other sites
  • 0

I see. Sorry I exchanged attributes for features. You must patch code as well as PDF template to display features.

 

See HOW TO article for M4PDF at http://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/page-6?do=findComment&comment=1668332

 

hey tuk66!

i added the code in the invoice.tpl file and i get this error..

Fatal error: Cannot use object of type Order as array in /var/www/prestaPOL/cache/smarty/compile/0a/91/88/0a91888840fb207b1dfcd292f779d2279e109643.file.invoice.tpl.php on line 272

and this is where i injected the code..

<!-- PRODUCTS -->
				{foreach $order_details as $order_detail}
				{cycle values='#FFF,#DDD' assign=bgcolor}
				{assign var="features" value=Product::getFrontFeaturesStatic($conf.pdf_id_lang, $order[orders].order_detail[detail].product_id)}
				{* {$features|@debug_print_var} *}
				{section name=feature loop=$features}
				    {* use the first or second style *}
				    {$features[feature].value}{if !$smarty.section.feature.last} x {/if}
				    {* {$features[feature].name}: {$features[feature].value}{if !$smarty.section.feature.last}, {/if} *}
				{/section}
				<tr style="line-height:4px;background-color:{$bgcolor};">
					<td style="text-align: left; width: {if !$tax_excluded_display}75%{else}71%{/if}" colspan=2>{$order_detail.product_name}</td>
					<!--<td style="text-align: left; width: {if !$tax_excluded_display}61%{else}71%{/if}">{$order_detail.product_name}{if isset($order_detail.product_reference) && !empty($order_detail.product_reference)} ({l s='SKU:' pdf='true'} {$order_detail.product_reference}){/if}</td>-->
					<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: center; width: 5%">{$order_detail.product_quantity}</td>
					<td style="text-align: right;  width: {if !$tax_excluded_display}10%{else}20%{/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>

Share this post


Link to post
Share on other sites
  • 0

The HOW TO is suited for the M4 PDF Extensions templates, not PrestaShop ones.

 

so.. how can i do it in Prestashop's default invoice? :)

Share this post


Link to post
Share on other sites
  • 0

Needed the same functionality and got it working in PS 1.6 by changing the default Prestashop template (pdf/invoice.tpl). No M4PDF needed!

 

I wanted the feature to display in the default language, so I added this line at the top of the template:

{assign var="defaultlang" value=(int)(Configuration::get('PS_LANG_DEFAULT'))}

Then in the Products section right after

{foreach $order_details as $order_detail}

you can add the code to print the desired feature:

{assign var="features" value=Product::getFrontFeaturesStatic($defaultlang, $order_detail.product_id)}
{foreach $features as $feature}
{if $feature.id_feature == 8}
<div><span>{$feature.name}: {$feature.value}</span></div>
{/if}
{/foreach}

This is just an example which displays the name and value of the feature with ID 8. Of course you'd have to adapt the feature ID and the output to suit your needs. I hope the idea is clear, though.

Share this post


Link to post
Share on other sites
  • 0

Needed the same functionality and got it working in PS 1.6 by changing the default Prestashop template (pdf/invoice.tpl). No M4PDF needed!

 

I wanted the feature to display in the default language, so I added this line at the top of the template:

{assign var="defaultlang" value=(int)(Configuration::get('PS_LANG_DEFAULT'))}

Then in the Products section right after

{foreach $order_details as $order_detail}

you can add the code to print the desired feature:

{assign var="features" value=Product::getFrontFeaturesStatic($defaultlang, $order_detail.product_id)}
{foreach $features as $feature}
{if $feature.id_feature == 8}
<div><span>{$feature.name}: {$feature.value}</span></div>
{/if}
{/foreach}

This is just an example which displays the name and value of the feature with ID 8. Of course you'd have to adapt the feature ID and the output to suit your needs. I hope the idea is clear, though.

Hi

Should this work in PS 1.5? I tried it and nothing is displayed!

Share this post


Link to post
Share on other sites
  • 0

Hi

Should this work in PS 1.5? I tried it and nothing is displayed!

 

Sorry, no idea. I've never used PS 1.5, and I don't know about the differences between 1.5 and 1.6, so I can't tell you.

 

The PS core developers should know, though.

Share this post


Link to post
Share on other sites

×

Important Information

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