QR code in Info view does not render data

Phoca Cart - complex e-commerce extension
User avatar
Nidzo
Phoca Expert
Phoca Expert
Posts: 521
Joined: 07 Nov 2018, 14:55

QR code in Info view does not render data

Post by Nidzo »

Phoca Cart 6.1.0Beta12
Joomla 6.1.0

I set {invoiceqr} shortcode in Payment method Info view description but generated QR code does not render
{b_name_first}
{b_name_last}
{b_address_1}
{b_city}
This is how it looks in Mobile Bank Application:
Image

but in PDF sent by email everything is OK. All data, name, address and city is rendered correct.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49415
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: QR code in Info view does not render data

Post by Jan »

Hi, info view does not have option to transform personal data like the personal variables, you can use only payment info like QR code with variable:

{invoiceqr}

Jan
If you find Phoca extensions useful, please support the project
User avatar
Nidzo
Phoca Expert
Phoca Expert
Posts: 521
Joined: 07 Nov 2018, 14:55

Re: QR code in Info view does not render data

Post by Nidzo »

This is exactly the QR code that is found in the Payment Methods description and is found by default after installing Phoca Cart

The short code {invoiceqr} shown does not generate data properly even when I set it to display in the email.

Image
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49415
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: QR code in Info view does not render data

Post by Jan »

Hi, are you sure, that Phoca PDF including Phoca PDF Phoca Cart plugin is installed and updated?

Jan
If you find Phoca extensions useful, please support the project
User avatar
Nidzo
Phoca Expert
Phoca Expert
Posts: 521
Joined: 07 Nov 2018, 14:55

Re: QR code in Info view does not render data

Post by Nidzo »

100% sure.
Phoca PDF 5.2.1 and latest Phoca PDF Phoca Cart plugin

QR code in PDF is correct.
Problem is with {invoiceqr} generated code.

This is generated code in Info view after confirming order. Try to scan it.

Image

You will get this from QR code scanner
Image

and this from Bank application
Image
User avatar
Nidzo
Phoca Expert
Phoca Expert
Posts: 521
Joined: 07 Nov 2018, 14:55

Re: QR code in Info view does not render data

Post by Nidzo »

With help of AI I managed to find the problem.

The completeTextFormFields() method, which handles billing/shipping address variable replacement, is not called in two places:

administrator/components/com_phocacart/libraries/phocacart/text/text.php → prepareReplaceText() method — affects Info view
administrator/components/com_phocacart/libraries/src/Mail/MailHelper.php → renderOrderBody() method — affects email

In the PDF pipeline, address variables are replaced correctly because completeTextFormFields() is called before QR code generation.
Fixes I have applied:

Fix for text.php — after completeText() call in the QR code section:

Code: Select all

if (isset($bas['b']) && isset($bas['s'])) {
    $pdf_invoice_qr_code_translated = PhocacartText::completeTextFormFields(
        $pdf_invoice_qr_code_translated, $bas['b'], $bas['s']
    );
}
Fix for MailHelper.php — in renderOrderBody():

Code: Select all

$basB = is_array($displayData['bas']['b']) ? $displayData['bas']['b'] : (array)$displayData['bas']['b'];
$basS = is_array($displayData['bas']['s']) ? $displayData['bas']['s'] : (array)$displayData['bas']['s'];
$qrCodeString = \PhocacartText::completeTextFormFields($qrCodeString, $basB, $basS);
User avatar
Nidzo
Phoca Expert
Phoca Expert
Posts: 521
Joined: 07 Nov 2018, 14:55

Re: QR code in Info view does not render data

Post by Nidzo »

Customer data in QR code was mandatory, but when I checked now, the National Bank of Serbia now marked that option as optional. Bank applications now fill those data automaticaly so there is no need for {b_name_first} {b_name_last} {b_address_1} {b_city} short codes anymore.
https://phoca.cz/forum/viewtopic.php?p=187340#p187340
Post Reply