Marcell Posted August 6, 2020 Share Posted August 6, 2020 (edited) Hey, I was wondering if it's possible to extract some values from the item's description to make a cleaner look for the PDF template via PHP. Talking about $item['description'] actually in more details. Can someone help with this? Edited August 6, 2020 by Marcell 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 6, 2020 Share Posted August 6, 2020 8 minutes ago, Marcell said: I was wondering if it's possible to extract some values from the item's description to make a cleaner look for the PDF template via PHP. by extract/export, you mean remove specific content from the description ? if it's purely in the PDF template only, then it's just a case of working out what you want to remove, and manipulating the description value using various PHP replacement methods... and what method to choose depends on what you want to remove. 0 Quote Link to comment Share on other sites More sharing options...
Marcell Posted August 6, 2020 Author Share Posted August 6, 2020 brian! well not removing, more like getting specific data of it, so let's say I want to know the quantity of the first product on the invoice $qty = $item['description', 'quantity']; $cycle = $item['description', 'cycle']; $cycle = $item['description', 'amount']; So then I could easily just provide to product(s) details, // There are amount for individual products, when the quantity is more than 1. See picture bellow, in case product amount is not valid. 0 Quote Link to comment Share on other sites More sharing options...
Marcell Posted August 6, 2020 Author Share Posted August 6, 2020 Just attached a PDF what I exactly trying to do here. BIT_000065.pdf 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 6, 2020 Share Posted August 6, 2020 3 minutes ago, Marcell said: brian! well not removing, more like getting specific data of it oh ok - I wasn't sure if you were removing or adding... 6 minutes ago, Marcell said: so let's say I want to know the quantity of the first product on the invoice the invoice database tables don't store quantities of products as a separate value - they will just be multiple line items... and they will either be listed individually on the invoice, or if you have "Group Similar Line Items" enabled, they'll be grouped and shown as per your screenshot. 11 minutes ago, Marcell said: Just attached a PDF what I exactly trying to do here. generally speaking to get a qty for a line item, you would do a count of the tblinvoiceitems table (the pdf template will know the invoice id)... and similarly for cycles, amounts, etc, it is often easier to get them direct from the database rather than manipulating, or trying to figure out, from the description string. the added complication for your situation is that you're using the Clean PDF addon - I know there is an overrides template that is not encrypted, but I don't know if you have options to modify the template in the way that this would need. 0 Quote Link to comment Share on other sites More sharing options...
Marcell Posted August 8, 2020 Author Share Posted August 8, 2020 I don't use actually any addon. 0 Quote Link to comment Share on other sites More sharing options...
Wouter0100 Posted August 8, 2020 Share Posted August 8, 2020 On 8/6/2020 at 3:27 PM, Marcell said: Just attached a PDF what I exactly trying to do here. BIT_000065.pdf 89.79 kB · 5 downloads This is an example that you're trying to achieve within WHMCS, isn't it? I guess it'll come down to regex, mostly. For one of my addons I've made a basic regex to be able to extract the cycle dates from the individual invoice lines: /^.*(\(((\d{2})\/(\d{2})\/(\d{4})) - ((\d{2})\/(\d{2})\/(\d{4}))\))$/ Which could be simplified a lot depending on how you want to print the dates. Another regex could be used to get the quantity, I'd say. 1 Quote Link to comment Share on other sites More sharing options...
a10600892 Posted August 14, 2020 Share Posted August 14, 2020 Hi bro i need pdf invoice code 0 Quote Link to comment Share on other sites More sharing options...
Marcell Posted September 3, 2020 Author Share Posted September 3, 2020 What invoice code and why? 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.