I have just finished implementing barcodes into this plugin, using the existing TCPDF library already included. This new functionality will save out a barcode png that can be called with the [BARCODE] tag. It currently uses barcode 39 but can easily be changed within the code below.
two files need to be edited to implement this functionality.
components/com_eventbooking/helper/registration.php
I have added this to line 3905
Code:
/**
* Generate BARCODE for a ticket number
*
* @param string $ticketNumber
*/
public static function generateTicketNumberBarcode($ticketNumber)
{
$filename = $ticketNumber . 'barcode.png';
if (!file_exists(JPATH_ROOT . '/media/com_eventbooking/qrcodes/' . $filename))
{
require_once JPATH_ROOT . "/components/com_eventbooking/tcpdf/tcpdf_barcodes_1d.php";
// set the barcode content and type
$barcodeobj = new TCPDFBarcode($ticketNumber, 'C39');
// output the barcode as PNG image
imagepng($barcodeobj->getBarcodePNG(2, 30, array(0,0,0)));
$img = ob_get_clean();
file_put_contents(JPATH_ROOT . '/media/com_eventbooking/qrcodes/' . $filename, $img);
}
}
components/com_eventbooking/helper/ticket.php
I have added this to line 335
Code:
if (strpos($ticketLayout, '[BARCODE]') !== false)
{
EventbookingHelperRegistration::generateTicketNumberBarcode($replaces['ticket_number']);
$imgTag = '<img src="media/com_eventbooking/qrcodes/' . $replaces['ticket_number'] . 'barcode.png" border="0" alt="BARCODE" />';
$ticketLayout = str_ireplace("[BARCODE]", $imgTag, $ticketLayout);
}