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