Logman Posted August 16, 2018 Share Posted August 16, 2018 I have successfully stripped HTML from email templates, cart pages and the invoice template. Still have product description HTML in the invoice PDF. Code looks a bit more complex. Tried |unescape after the item description in invoicepdf.tpl but it just removes the whole description. Any ideas? foreach ($invoiceitems as $item) { $tblhtml .= ' <tr bgcolor="#fff"> <td align="left">' . nl2br($item['description']) . '<br /></td> <td align="center">' . $item['amount'] . '</td> </tr>'; } 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 16, 2018 Share Posted August 16, 2018 1 hour ago, Logman said: I have successfully stripped HTML from email templates, cart pages and the invoice template. Still have product description HTML in the invoice PDF. Code looks a bit more complex. Tried |unescape after the item description in invoicepdf.tpl but it just removes the whole description. Any ideas? |unescape would be for Smarty - in this template, you have to think PHP.... changing nl2br to strip_tags would remove all the HTML from the string - but whether you want to do that i'm unsure... strip_tags(nl2br($item['description']),'<br>') the above would remove all html from the string apart from new lines/break returns - what HTML are you seeing i that string that you want to remove ? 0 Quote Link to comment Share on other sites More sharing options...
Logman Posted August 16, 2018 Author Share Posted August 16, 2018 We have HTML that adds links to more info about add-ons: As long as it doesn't strip the <br> tag should be fine? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 16, 2018 Share Posted August 16, 2018 2 minutes ago, Logman said: As long as it doesn't strip the <br> tag should be fine? it should be fine - add it to the template, and then preview an invoice in the admin area and see if it removes the other HTML. 0 Quote Link to comment Share on other sites More sharing options...
Logman Posted August 16, 2018 Author Share Posted August 16, 2018 52 minutes ago, brian! said: strip_tags(nl2br($item['description']),'<br>') Hi Brian, I get a syntax error with that code. I put: <td align="left">' . strip_tags(nl2br($item['description']),'<br>')</td> 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 16, 2018 Share Posted August 16, 2018 <td align="left">' . strip_tags(nl2br($item['description']),'<br>') . '<br /></td> 0 Quote Link to comment Share on other sites More sharing options...
Logman Posted August 16, 2018 Author Share Posted August 16, 2018 Cheers, but that doesn't strip the HTML unfortunately. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 16, 2018 Share Posted August 16, 2018 14 minutes ago, Logman said: Cheers, but that doesn't strip the HTML unfortunately. try using the following - that should work... <td align="left">' . nl2br(strip_tags((html_entity_decode($item['description'])),'<br>')) . '<br /></td> 0 Quote Link to comment Share on other sites More sharing options...
Logman Posted August 16, 2018 Author Share Posted August 16, 2018 Strips out the links and configurable options but good enough. Thanks again. 🙂 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.