Skip to main content

Customise the Tax Invoice while using the HikaShop - generate PDF invoice plugin

More
3 years 1 month ago #354560 by bmm01
-- Joomla version -- : 4.3.3
-- PHP version -- : 4.7.5

We had some customisations to the Tax Invoice in Joomla 3 and I want to bring these over to Joomla 4.

In the Joomla 4 site, I have edited the order / invoice.php file. The modifications show up on the Display / Views screen however the changes do not show up in the invoice (either on the Orders / Tax Invoice page) or in the invoice sent to the customer (we have the HikaShop - generate PDF invoice plugin).

When I disable the Plugin, the changes to the invoice are shown.

Is there somewhere else I need to edit the view to make the customised Invoice work with the Plugin? We want to attach the PDF of the invoice to the Order Confirmation email.

Plugin version is 2.0.1

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

More
3 years 1 month ago #354562 by nicolas
Hi,

The plugin has its own file for the invoice. It's the file plugins/hikashop/attachinvoice/attachinvoice/invoice.php (or another file in that folder, since you can now select the layout you want to use in the settings of the plugin).
Copy this file to media/com_hikashop/plugins/invoice.php and you'll have an override file you can modify.

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

More
3 years 1 month ago #354595 by bmm01
Thanks very much Nicolas.
I have followed your instructions and I can modify the media/com_hikashop/plugins/invoice.php file and it works (by adding a ECHO 'TEST';).
However, I have now copied across the modified file invoice.php from administrator/templates/atum/html/com_hikashop/order
It works for the Shipping Invoice, however when I use it for the Tax Invoice, I get the following error:

An error has occurred.

0 Call to a member function get() on null

Call stack
# Function Location
1 () JROOT/media/com_hikashop/plugins/invoice.php:126
2 require() JROOT/plugins/hikashop/attachinvoice/attachinvoice.php:101
3 plgHikashopAttachinvoice->_getPDFInvoice() JROOT/plugins/hikashop/attachinvoice/attachinvoice.php:237
4 plgHikashopAttachinvoice->onHikashopBeforeDisplayView() JROOT/libraries/src/Plugin/CMSPlugin.php:284
5 Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}() JROOT/libraries/vendor/joomla/event/src/Dispatcher.php:486
6 Joomla\Event\Dispatcher->dispatch() JROOT/libraries/src/Application/EventAware.php:111
7 Joomla\CMS\Application\WebApplication->triggerEvent() JROOT/administrator/components/com_hikashop/helpers/helper.php:2701
8 hikashopView->display() JROOT/administrator/components/com_hikashop/views/order/view.html.php:30
9 OrderViewOrder->display() JROOT/libraries/src/MVC/Controller/BaseController.php:645
10 Joomla\CMS\MVC\Controller\BaseController->display() JROOT/administrator/components/com_hikashop/helpers/helper.php:2463
11 hikashopController->display() JROOT/administrator/components/com_hikashop/controllers/order.php:305
12 OrderController->invoice() JROOT/libraries/src/MVC/Controller/BaseController.php:678
13 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/administrator/components/com_hikashop/helpers/helper.php:2441
14 hikashopController->execute() JROOT/administrator/components/com_hikashop/hikashop.php:73
15 require_once() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
16 Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
17 Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361
18 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:143
19 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:186
20 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:293
21 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:61
22 require_once() JROOT/administrator/index.php:32

Please advise how I can debug / fix this error. Apologies I am not a programmer and whoever coded the modifications has retired unfortunately. I'm getting myself quite confused - I have attached the invoice.php file that seems to work when the Attach Invoice plugin is Disabled.

Thanks very much

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

More
3 years 1 month ago #354598 by nicolas
Hi,

You can't just copy / paste the whole code of administrator/templates/atum/html/com_hikashop/order/invoice.php to media/com_hikashop/plugins/invoice.php
The code in each file is not compatible and doesn't rely on the same variables.
The modification will have to be done by a developer in media/com_hikashop/plugins/invoice.php which should be based on the code from plugins/hikashop/attachinvoice/attachinvoice/invoice.php and not the code from administrator/templates/atum/html/com_hikashop/order/invoice.php
The following user(s) said Thank You: bmm01

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

Time to create page: 0.146 seconds
Powered by Kunena Forum