-- HikaShop version -- : 6.6.0
-- Joomla version -- : 6.1.3
-- PHP version -- : 8.5.9
Hello,
After updating the PDF Invoice plugin from 4.x to 5.0.0 with the Joomla extension installer, downloading an invoice from the backend fails with this error:
Class "HikashopInvoiceMarkup" not found
Environment:
- Joomla 6.1.3
- PHP 8.5.9
- HikaShop 6.6.0
- PDF Invoice plugin 5.0.0
Cause:
_loadPdfEngine() in attachinvoice.php includes invoicemarkup.php and invoicerenderer.php from the plugin folder. Both files are in the downloaded zip, but the <files> section of attachinvoice.xml only lists attachinvoice.php, facturx.php and the "attachinvoice" and "vendor" folders. Because of that, Joomla does not copy the two files to plugins/hikashop/attachinvoice/, and the classes cannot be loaded.
Fix:
Adding these two lines to the <files> section of attachinvoice.xml should solve it:
<filename>invoicemarkup.php</filename>
<filename>invoicerenderer.php</filename>
Workaround: uploading the two files manually into plugins/hikashop/attachinvoice/ works. After that, invoices are generated correctly.
This looks like the same kind of issue as the facturx.php file missing from the XML, which was fixed in 4.0.1.
Suggestion:
While testing, I noticed that the generated PDF embeds the complete font file. With a CJK font, each invoice is about 3 MB, and this file is attached to every order email. Passing subsetfont: true when the document is created in HikashopInvoiceRenderer::newDocument() embeds only the characters that are used. In my test, the same Japanese invoice went from about 3 MB to about 81 KB, with no visible difference. I only tested it without Factur-X (PDF/A-3). It may be worth making this the default, or an option.
Thank you for the plugin and for looking into this.