cikcak Posted September 12, 2014 Share Posted September 12, 2014 hello, Im trying to print one product feature in PDF invoice. Im working with invoice.tpl file and in product tab add th - Max weight. In attributes I have feature: Max user weight with values. All of my products has this feature with different values. And its important to see value in PDF. using this: {$order_detail.product_name} i got only product name - and combination name. Also get ref code and etc.. {foreach from=$features item=feature} <tr class="{cycle values="odd,even"}"> {if isset($feature.value)} <td>{$feature.name|escape:'html':'UTF-8'}</td> <td>{$feature.value|escape:'html':'UTF-8'}</td> {/if} </tr> {/foreach} I tryed to use this, but its not working. As I said i dont need all features, I need only 1 - for example: weight Any ideas? Link to comment Share on other sites More sharing options...
cikcak Posted September 12, 2014 Author Share Posted September 12, 2014 I should call in HTMLtemplteinvoice.php: $product = new Product((int)$orderDetail->product_id, (int)$cookie->id_lang); $features = $product->getFrontFeatures((int)$cookie->id_lang); $this->smarty->assign.... $features and $product? After this Im trying foreach in invoice.tpl but no results.. Link to comment Share on other sites More sharing options...
cikcak Posted September 15, 2014 Author Share Posted September 15, 2014 Any? I tryed it in OrderDetail.php in HTMLtemplateinvoice.php no chance to get product feature... Link to comment Share on other sites More sharing options...
tuk66 Posted September 16, 2014 Share Posted September 16, 2014 One of the ways to solve http://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/?view=findpost&p=1668332 Link to comment Share on other sites More sharing options...
cikcak Posted September 16, 2014 Author Share Posted September 16, 2014 (edited) One of the ways to solve http://www.prestashop.com/forums/topic/270613-module-m4-pdf-extensions-with-online-editor/?view=findpost&p=1668332 I should use this code in this section ? {foreach $order_details as $order_detail} ({section name=detail loop=$order[orders].order_detail}) {assign var="features" value=Product::getFrontFeaturesStatic($conf.pdf_id_lang, $order[orders].order_detail[detail].product_id)} {section name=feature loop=$features} {if $features[feature].name == 'Fill_in_name_of_feature'} {$features[feature].value|escape:'htmlall':'UTF-8'} {/if} {/section} I got error:( Fatal error: Cannot use object of type Order as array in /public_html/tools/smarty/sysplugins/smarty_internal_templatebase.php(171) : eval()'d code on line 171 Edited September 16, 2014 by cikcak (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted September 16, 2014 Share Posted September 16, 2014 You perhaps used the code in invoice.tpl template instead of M4 PDF Extension's one. Link to comment Share on other sites More sharing options...
cikcak Posted September 16, 2014 Author Share Posted September 16, 2014 You perhaps used the code in invoice.tpl template instead of M4 PDF Extension's one. I know, so you talking about this loop? http://pastebin.com/Q11CgiY9 I tried to insert your code and get error: 1 Fatal error: Cannot use object of type Order as array in public_html/tools/smarty/sysplugins/smarty_internal_templatebase.php(171) : eval()'d code on line 221 Link to comment Share on other sites More sharing options...
tuk66 Posted September 17, 2014 Share Posted September 17, 2014 We are writing about two different approaches. Your code is about PrestaShop's invoice template and mine is about the M4 PDF Extensions' template, which is different. Link to comment Share on other sites More sharing options...
Simone Salerno Posted September 18, 2014 Share Posted September 18, 2014 I don't know it it can help, since I don't know if the attributes you need are already there or you explicitly need to fetch them, but I wrote a topic on adding products attributes to PDF Invoice: have a look here Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now