verticalcomputers Posted May 12, 2016 Share Posted May 12, 2016 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? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 13, 2016 Share Posted May 13, 2016 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. 0 Quote Link to comment Share on other sites More sharing options...
verticalcomputers Posted May 13, 2016 Author Share Posted May 13, 2016 Great thanks! I will go with option 4. Gonna post in the marketplace now. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.