roz Posted May 6, 2014 Share Posted May 6, 2014 hi all! anyone here how to display product features in Invoice and in Delivery Slip PDFs? thanks in advance Link to comment Share on other sites More sharing options...
roz Posted May 9, 2014 Author Share Posted May 9, 2014 up Link to comment Share on other sites More sharing options...
tuk66 Posted May 9, 2014 Share Posted May 9, 2014 Product features should be combined and stored in the order. Or I'm wrong or you want it otherwise. How exactly? Link to comment Share on other sites More sharing options...
roz Posted May 12, 2014 Author Share Posted May 12, 2014 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. 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" Link to comment Share on other sites More sharing options...
tuk66 Posted May 12, 2014 Share Posted May 12, 2014 I mean that attributes are normally joined and saved together with the product name. In my example iPod has a color attribute. Link to comment Share on other sites More sharing options...
roz Posted May 12, 2014 Author Share Posted May 12, 2014 (edited) 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.. i'm using Features. not Attributes. will there be any difference? you mean Features can't appear on Invoice? Edited May 12, 2014 by roz (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted May 12, 2014 Share Posted May 12, 2014 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 Link to comment Share on other sites More sharing options...
roz Posted May 14, 2014 Author Share Posted May 14, 2014 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> Link to comment Share on other sites More sharing options...
tuk66 Posted May 14, 2014 Share Posted May 14, 2014 The HOW TO is suited for the M4 PDF Extensions templates, not PrestaShop ones. Link to comment Share on other sites More sharing options...
roz Posted May 14, 2014 Author Share Posted May 14, 2014 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? Link to comment Share on other sites More sharing options...
roz Posted May 15, 2014 Author Share Posted May 15, 2014 no one else doing this or needs this??? Link to comment Share on other sites More sharing options...
majusz Posted June 3, 2014 Share Posted June 3, 2014 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. 4 Link to comment Share on other sites More sharing options...
garyjj127 Posted November 25, 2014 Share Posted November 25, 2014 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! Link to comment Share on other sites More sharing options...
majusz Posted November 26, 2014 Share Posted November 26, 2014 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. 1 Link to comment Share on other sites More sharing options...
garyjj127 Posted November 27, 2014 Share Posted November 27, 2014 OK cool. Thanks for taking the time to reply though! Link to comment Share on other sites More sharing options...
Recommended Posts