QR code: fatal error when using PDFSerial - HikaSerial plugin

  • Posts: 19
  • Thank you received: 1
  • Hikashop Business
6 years 5 months ago #282059

-- url of the page with the problem -- : stattgarde.de
-- HikaShop version -- : 3.2.1
-- HikaSerial version -- : 2.0.0
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.6

Hi!
I tried to configurate the PDFSerial. There is no problem to integrate the serialnumber or the customers name. But I do have problems with integrating the QR code. I do use the dynamic text (like I do with the AttachSerial) and set it to "QR Code" into the field below I copied the following:
stattgarde.de/index.php?option=com_hikas...k=consume&hikaserial [serial_data]={serial.serial_data}&hikaserial[format]=html&tmpl=component
When I set the order on "shipped" to create the email with the PNG and PDF I get the following error:
Fatal error: Cannot redeclare class QRcode in /homepages/36/d78750134/htdocs/relaunch_2017/joomla3x/administrator/components/com_hikaserial/inc/tcpdf/include/barcodes/qrcode.php on line 100
What might be the mistake?

When I chance it to "barcode" it works. But I do need an QRcode.....

Regards,
Frank

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 26007
  • Thank you received: 4004
  • MODERATOR
6 years 5 months ago #282061

Hello,

Indeed if you're using "attach serial" and "pdf serial" in the same time ; you will got a conflict between "PHPQRCode" and "TCPDF".
Unfortunately, TCPDF created a class named "QRCode" based on the lib "PHPQRCode" but with a lot of modifications.
Both lib are using the same name for their classes and these classes are not compatible.
So for the moment you should not use both libs in the same time.

And I will see what I can do to avoid that ; since I do not like to modify official libs because it makes the updates a living hell.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 19
  • Thank you received: 1
  • Hikashop Business
6 years 5 months ago #282094

Hi Jerome!

Thanks for your reply! It's a pitty that it will not work propper...
I know that changing official thinks makes updating not that comfortable :-)
Never the less - would it work, if the class QRcode would be renamed? Even if the file has to be changed very time an update has been done.... It might be a silly question for you - but it there might be a "work around" I would prefer that.... :-)))))

Regards,

Frank

Last edit: 6 years 5 months ago by Frank.Oehlen.

Please Log in or Create an account to join the conversation.

  • Posts: 26007
  • Thank you received: 4004
  • MODERATOR
6 years 5 months ago #282103

Hello,

Well, one solution would be to add that line

namespace hikaserial\lib\phpQRCode;
At the very beginning of every file in the "inc/phpqrcode/" folder.

Then in the "inc/qrcode.php" file use
if(!class_exists('hikaserial\lib\phpQRCode\QRencode'))
And
$this->factory = hikaserial\lib\phpQRCode\QRencode::factory($level, $pixelPerPoint, $outerFrame);
To right use the namespace for the checks.

And I think it should avoid your issue.
For what I could see, there is no special usage of external classes in the lib PHPQRCode so, it should not require extra modification to handle the root namespace (but I can't be entirely sure without a lot of tests).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.060 seconds
Powered by Kunena Forum