Adding a FAX field, or other simple field, to QR Code Generator Plugin

By Codee - January 30, 2012

I'm finally utilizing the QR Code Plugin and I have 3 clients who are really hot to trot for using it. My first sample page worked very well but I have a question. I'm using the "contact" sample...I tried to add a field for a FAX number on the QRCodeGenerator.php page. Even though I mimicked the "phone" entries on that page, the page broke. Is there an easy way to add fields that are in the database or is it a major operation to do that with this plugin?

Re: [equinox69] Adding a FAX field, or other simple field, to QR Code Generator Plugin

By (Deleted User) - January 30, 2012

Hi Equinox69,

The QR generator for contact details uses the MECARD standard which only defines one phone number. It can have more than one phone number added but it doesn't store the difference between numbers (ie work and fax would both come up as 'tel') and so the software reading the QR code would (hopefully!) ask to define which number goes where.

If you want to add an extra field then you can edit the plugin code directly to capture and then output the extra field (just rename the plugin 'QRCodeGeneratorCustom' so that it doesn't get overwritten if you upgrade).

Hope this helps,

Tom

Re: [equinox69] Adding a FAX field, or other simple field, to QR Code Generator Plugin

By (Deleted User) - January 30, 2012

Hi equinox69,

My guess is that you have this line (49 in the r1.00):

elseif ($type == 'contact') { $data = 'MECARD:N:' . $options['lastName'] . "," . $options['firstName'] . ";ADR:" . $options['address'] . ";TEL:" . $options['phone'] . ";FAX:" . $options['fax'] . ";EMAIL:" . $options['email'] . ";;"; }

With the variable "FAX:" set to the fax number.

I forgot to mention that when calling the MECARD api, all telephone numbers are listed as TEL, so this version:

elseif ($type == 'contact') { $data = 'MECARD:N:' . $options['lastName'] . "," . $options['firstName'] . ";ADR:" . $options['address'] . ";TEL:" . $options['phone'] . ";TEL:" . $options['fax'] . ";EMAIL:" . $options['email'] . ";;"; }

should work

You'll also need to update the error checking on line 89:

'contact' => array('type', 'size', 'margin', 'mode', 'lastName', 'firstName', 'address', 'phone','fax', 'email'),

Hope this helps,

Tom

Re: [Tom P] Adding a FAX field, or other simple field, to QR Code Generator Plugin

By Codee - January 30, 2012

Yep! That's exactly what I did...and Yep, I set the field to 'FAX' instead of 'TEL' just like you said...and added the field to error checking, but of course it recognize the fax field type as you said...hence it broke. Okay, I understand MUCH better, now, Tom. I'll give it a whir with the second TEL number...but like you said, I "hope the reading software will query" between the two numbers. Thanks for you help!