Jump to content

Product attribute in PDF


cikcak

Recommended Posts

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

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

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 by cikcak (see edit history)
Link to comment
Share on other sites

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

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