ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

Barcode Generator worked in V4 but V5

amheng5 01 May, 2016
I've been using Chronoforms V4 for many years ans have used the Barcode generator without any problems under V4. However with the recent change to Joomla 3.5 and the need to upgrade Chronoforms V5 I can't seem to get the custom code provided to work under V5 to generale the barcode.

The custom field php code that worked great under CCV4 follows:
<?php
if ( !$mainframe->isSite() ) { return; }
/*
 function to generate a random alpha-numeric code
 using a specified pattern
 *
 * @param $pattern string
 * @return string
 */
function generateIdent($pattern='9999999')
{
  $alpha = array("A","B","C","D","E","F","G","H",
    "J","K","L","M","N","P","Q","R","S","T","U","V","W",
    "X","Y","Z");
  $digit = array("1","2","3","4","5","6","7","8","9");
  $return = "";
  $pattern_array = str_split($pattern, 1);
  foreach ( $pattern_array as $v ) {
    if ( is_numeric($v) ) {
      $return .= $digit[array_rand($digit)];
    } elseif ( in_array(strtoupper($v), $alpha) ) {
      $return .= $alpha[array_rand($alpha)];
    } else {
      $return .= " ";
    }
  }
  return $return;
}
?>
<p>Registration ID</p>
<?php
$ident = generateIdent();
echo "<img src='".JURI::base()
."components/com_chronoforms/includes/barcode.php?barcode="
.$ident."&width=320&height=80' />";
?>

You'll notice I would change the red highlighted code to reflect the correct folder directory for CCV5 (chronoforms5}.

I've made sure the barcode.php was added to the cc5 directory. But when I go to view the form, the
first thing I notice is all the formatting is stripped and the remaining Actions such as captcha and submit buttons are removed and no barcode generated.

I've noticed that under CCV5, the custom code field does not include all the fields that are under CCV4 see attached. Field Name and Field ID are missing under CCV5.

Your assistance is appreciated.
Thanks
GreyHead 04 May, 2016
Hi amheng5,

I think that the problem is the second line - later versions of Joomla! use a different check code. This works for me in CFV5 and Joomla! 3.5
<?php
defined('JPATH_PLATFORM') or die; // change this line
/*
 function to generate a random alpha-numeric code
 using a specified pattern
 *
 * @param $pattern string
 * @return string
 */
function generateIdent($pattern='9999999')
{
  $alpha = array("A","B","C","D","E","F","G","H",
    "J","K","L","M","N","P","Q","R","S","T","U","V","W",
    "X","Y","Z");
  $digit = array("1","2","3","4","5","6","7","8","9");
  $return = "";
  $pattern_array = str_split($pattern, 1);
  foreach ( $pattern_array as $v ) {
    if ( is_numeric($v) ) {
      $return .= $digit[array_rand($digit)];
    } elseif ( in_array(strtoupper($v), $alpha) ) {
      $return .= $alpha[array_rand($alpha)];
    } else {
      $return .= " ";
    }
  }
  return $return;
}
?>
<p>Registration ID</p>
<?php
$ident = generateIdent();
echo "<img src='".JURI::base()
."components/com_chronoforms5/extras/barcode/barcode.php?barcode="
.$ident."&width=320&height=80' />";
?>
Note also that I have the barcode,php file in components/com_chronoforms5/extras/barcode/ - you may need to edit that path.

Bob
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com