wonderland Posted February 17, 2012 Share Posted February 17, 2012 Hello, I did look through wiki and almost found everything I need , except one small thing. I'm using this code in invoicepdf.tpl if ($clientsdetails["customfields1"]) { $pdf->Cell(0,6,$clientsdetails["customfields1"],0,1,'L'); } Which surely enough displays fieldvalue of customfield1 But I would like to display fieldname : fieldvalue How could I do this ? 0 Quote Link to comment Share on other sites More sharing options...
wonderland Posted February 21, 2012 Author Share Posted February 21, 2012 Anyone ? This can't be that hard. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted February 21, 2012 Share Posted February 21, 2012 (edited) This question has been asked many times, to most this is difficult... Maybe a forum mod can can move this post to "Tips and Tricks" Place this code at the top (under the <?php) of the invoicepdf.tpl $result22a = mysql_query("SELECT `tblcustomfields`.`fieldname` , `tblcustomfieldsvalues`.`value` FROM tblcustomfields, tblcustomfieldsvalues WHERE `tblcustomfields`.`id` = `tblcustomfieldsvalues`.`fieldid` AND `tblcustomfields`.`type` = 'client' AND `tblcustomfieldsvalues`.`relid` = {$clientsdetails['userid']}"); while ($data22a = mysql_fetch_assoc($result22a)){ $clientsdetails["customfields"]["{$data22a["fieldname"]}"]["fieldname"] = $data22a["fieldname"]; $clientsdetails["customfields"]["{$data22a["fieldname"]}"]["value"] = $data22a["value"]; } As an example the array will be added to the clientsdetails array like this Array ( [userid] => 1 [id] => 1 [firstname] => Test [lastname] => Tester [companyname] => [email] => REMOVED [address1] => REMOVED [address2] => [city] => REMOVED [state] => Queensland [postcode] => 4280 [country] => Australia [countryname] => Australia [phonenumber] => 0123456789 [notes] => You have unpaid invoices... pay now to avoid suspension of your account [password] => REMOVED [currency] => 1 [defaultgateway] => banktransfer [cctype] => [cclastfour] => [securityqid] => 0 [securityqans] => [groupid] => 0 [status] => Active [credit] => 0.00 [taxexempt] => [latefeeoveride] => [overideduenotices] => [separateinvoices] => [disableautocc] => [language] => english [lastlogin] => Date: 21/01/2012 15:05<br>IP Address: xxx.xxx.xxx.xxx<br>Host: xxx.xxx.xxx.xxx [customfields1] => 14123145125 [customfields2] => [billingcid] => 0 [customfields] => Array ( [ABN] => Array ( [fieldname] => ABN [value] => 14123145125 ) [Recieve Marketing Emails] => Array ( [fieldname] => Recieve Marketing Emails [value] => ) ) ) Then use it like this (going from the customfields array output above) if ($clientsdetails["customfields"]["ABN"]) { $pdf->Cell(0,6,$clientsdetails["customfields"]["ABN"]["fieldname"]." : ".$clientsdetails["customfields"]["ABN"]["value"] ,0,1,'L'); } Hope this has helped someone. Edited February 21, 2012 by sparky 0 Quote Link to comment Share on other sites More sharing options...
wonderland Posted February 21, 2012 Author Share Posted February 21, 2012 Thank you very much! I've been searching forums for an answer, but I probably didn't use the right keywords. This does seem a bit difficult, do I need to add array somewhere ? 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted February 21, 2012 Share Posted February 21, 2012 No... the array code there is just an example so that you are able to follow how it works. 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.