Stephenitsg Posted June 10, 2014 Share Posted June 10, 2014 Since WHM wont add it as a feature, here is the code to do it yourself... Code uses a couple Regex searches to remove the offending lines and leave your invoices squeaky clean. viewinvoice.tpl (Replace the Foreach loop) {foreach key=num item=invoiceitem from=$invoiceitems} {php} $text = preg_replace("/\:\s0\sx\s/","+",$this->_tpl_vars['invoiceitem']['description']); $text = preg_replace("/.*\+/","+",$text); $text = preg_replace("/\+.*/","",$text); $this->_tpl_vars['invoiceitem']['description'] = $text; {/php} <tr bgcolor=#ffffff><td id="invoiceitemsrow" style="border:1px solid #cccccc;border-bottom:0px;">{$invoiceitem.description}{if $invoiceitem.taxed eq "true"} *{/if}</td><td align="center" id="invoiceitemsrow" style="border:1px solid #cccccc;border-bottom:0px;border-left:0px;">{$invoiceitem.amount}</td></tr> {/foreach} invoicePDF.tpl (Replace the Foreach loop) foreach ($invoiceitems AS $item) { //These 3 lines remove 0 Quantity items, and the 4th line set the new string to the running variable $text = preg_replace("/\:\s0\sx\s/","+",$item['description']); $text = preg_replace("/.*\+/","+",$text); $text = preg_replace("/\+.*(\n?)/","",$text); $item['description'] = $text; $rowcount = $pdf->getNumLines($item['description'], 140); $pdf->MultiCell(140,$rowcount * 5,$item['description'],1,'L',0,0); $pdf->MultiCell(40,$rowcount * 5,$item['amount'],1,'C',0,0); $pdf->Ln(); } Removes 0 quantity configurable addon lines from invoices so your customers don't think they are being billed for stuff they didn't sign up for. Enjoy, -Stephen 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Ryan Posted June 12, 2014 Share Posted June 12, 2014 Hello Stephenitsg, Thanks for providing this workaround. I moved your thread to the User Contributions subforum as it seemed to be more appropriate. Also, if you would like to see this added to WHMCS and you haven't already submitted a feature request, please do so using the link in my signature. As always folks, any user submitted work around is appreciated but it has not been tested and therefore is not supported by WHMCS. Please use at your discretion. --Thanks 0 Quote Link to comment Share on other sites More sharing options...
Stephenitsg Posted June 12, 2014 Author Share Posted June 12, 2014 Hey Ryan, Thanks for the feedback. I have requested it here: https://requests.whmcs.com/responses/remove-addons-displayed-on-invoice-when-not-purchased Just thought I would post for others to use. Thanks, Stephen 0 Quote Link to comment Share on other sites More sharing options...
Phil Ciccone Posted April 4, 2019 Share Posted April 4, 2019 For the latest version of WHMCS, I have re-written some of the code in viewinvoice.tpl to still keep working in 7.6.x+. I hope this continues to help people who hate the 0 x configurable items on the invoices. {foreach from=$invoiceitems item=item} {$text = preg_replace("/\:\s0\sx\s/","+",$item.description)} {$text = preg_replace("/.*\+/","+",$text)} {$text = preg_replace("/\+.*/","",$text)} {$item.description = $text} <tr> <td>{$text}{if $item.taxed eq "true"} *{/if}</td> <td class="text-center">{$item.amount}</td> </tr> {/foreach} Phil Ciccone 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.