Jump to content

Add Product Description to Invoices Created


Recommended Posts

How can we add the product description to the recurring invoices that get created? I see the follow in invoicepdf.tpl...

 

 

$tblhtml = '<table width="100%" bgcolor="#ccc" cellspacing="1" cellpadding="2" border="0">

<tr height="30" bgcolor="#efefef" style="font-weight:bold;text-align:center;">

<td width="80%">'.$_LANG['invoicesdescription'].'</td>

<td width="20%">'.$_LANG['quotelinetotal'].'</td>

</tr>';

foreach ($invoiceitems AS $item) {

$tblhtml .= '

<tr bgcolor="#fff">

<td align="left">'.nl2br($item['description']).'<br /></td>

<td align="center">'.$item['amount'].'</td>

</tr>';

}

 

So.....

 

<td align="left">'.nl2br($item['description']).'<br />STUFF HERE GOES WHERE I WANT IT</td> BUT...

 

...what would I put there to make it populate with the product description?

Link to comment
Share on other sites

the product description isn't passed or available to the invoice, so there is no existing variable available to use.

 

off the top of my head, there are at least four ways to do it... i'll go through them in ascending order, i.e the worst idea first! :)

 

1. you could hard-code them in the template itself - if you only have one or two products, then that would be the simplest solution... you'd just need to identify the product (probably from the description itself using PHP) and then show the appropriate product description text.

 

2. if you need the product description to be in the client's own language, then you could use Language Overrides and instead of using hard-coded text, you would reference the appropriate language override entry instead.

 

3. you could pull the product description from the database via PHP - using variables present in the invoicepdf template, you should be to able to correctly pull the appropriate product description and add it to the output...

 

similarly to 2), if you have the option enabled, you might alternatively pull the Easy Translation description value from the database instead.

 

the potential downside to 1,2 and 3 is that when viewing the pdf invoice online, it is generated on the fly - so the information being used is the current information (either in the template or the database)... in the pdf invoice sent to the client, this doesn't matter as it will be correct at the time of order - but if a client tries to view an old invoice and you're using one of the above methods, it might not necessarily be accurate (e.g i you 've updated the product description)... though you could get around this by removing the pdf download button from the client invoice page!

 

4. you could use an action hook to modify the invoice item description to include the product description - as this would change the field, there should be no need for any further template modifications and will add the correct information at the time of ordering, so should be accurate when looked at as an old invoice.

 

if you wanted to go with the fourth option, then you would likely need to post in Marketplace and pay a developer to write the hook for you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated