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: [Tom P] Adding a FAX field, or other simple field, to QR Code Generator Plugin

By Codee - January 30, 2012

Hi Tom, thanks for replying. I opened QRCodeGenerator.php and searched through the fields for the contact info and found 'phone' and 'address', etc. Everywhere those fields were on the plugin I appropriately added a new field, called "FAX", then double and triple-checked to ensure commas, etc. were all done correctly. Uploaded the page and it crashed the plugin. Quickly removed the fields I added and it was back to normal. I'm reading from you that a field can be added, BUT that the contact details is following a standard. If I'm adding a field that's not part of that standard, won't it crash on any field I add?

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!