koko20212021 Posted April 26, 2021 Share Posted April 26, 2021 Hi I am trying to apply this rule: <td class="total-row text-center">{($total|replace:'€':''|replace:'EUR':'' * 4.9)|string_format:"%.2f"} RON</td> Ex: The thing is that that line is not working if I edit it this way: foreach ($invoiceitems as $item) { $tblhtml .= ' <tr bgcolor="#fff"> <td align="left">' . nl2br($item['description']) . '<br /></td> <td align="center">' . $item['amount'] . '</td> <td align="center">{($total|replace:'€':''|replace:'EUR':'' * 4.9)|string_format:"%.2f"} RON</td> </tr>'; } Any help would be much appreciated for this line, thanks! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 26, 2021 Share Posted April 26, 2021 (edited) it's a price formatter variable, so you should be able to do this... <td align="center">' . (number_format($total->toNumeric() * 4.9,2)) . ' RON</td> the problem with your code is that you're trying to use Smarty rather than PHP.... in that template, don't think Smarty, think PHP (and if necessary TCPDF). Edited April 26, 2021 by brian! 0 Quote Link to comment Share on other sites More sharing options...
koko20212021 Posted April 26, 2021 Author Share Posted April 26, 2021 This made the trick and then replace the line with a $temp $temp = str_replace("€","", $trans['amount']); $temp = str_replace("Eur","", $temp); $temp = $temp*4.9; Maybe it will help others too 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 26, 2021 Share Posted April 26, 2021 you could still do all that in one step because $trans['amount'] will be price formatted too. 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.