- Posts: 71
- Thank you received: 0
Plugin not triggered
I've created a plugin to transfer the order details to a an online invoice system. I've packaged the plugin in a zip and installed it through the extension manager. I've also checked if the plugin is activated. SO all should be well, but it's not ...
The function onAfterOrderConfirm doesn't seem to get triggered. What am I doing wrong or forgetting?
Thanks for any clue that will make this plugin work! I've attached the php and xml files.
Michel
Please log in or register to see it.
Please Log in or Create an account to join the conversation.
The onAfterOrderConfirm function is triggered on the end step of the checkout after the customer clicked on the finish button and confirmed that he wanted to checkout so that payment plugins can redirect the customer to the payment gateway.
So it's normal that it isn't triggered when an order is confirmed.
What you want to use is the onAfterOrderUpdate trigger which is called each time an order is changed and check on the order_status attribute.
Please Log in or Create an account to join the conversation.
Thanks for the reply. I don't want to create an invoice each time the order is udated, only when the order is finalized by the customer. I want the order data to be sent to my invoicing service after the customer clicks the finish button. From what I understand that would be the onAfterOrderConfirm function.
But that is not the problem I'm having. The problem is, that no function in my plugin is ever triggered. For testing purposes I had implemented the onAfterOrderUpdate but this also never got called. So there must be some basic problem in the installation or the code. I'd appreciate it if you could have a look where the problem lies.
Thanks,
Michel
Please Log in or Create an account to join the conversation.
The issue is with your class name. you use the class name plgHikashopSmallInvoice while your plugin name is: plgHikaShopSmallInvoice
If you look at a plugin of HikaShop, for example the validate_free_order plugin (it's his name as entered in the xml file), the class name is: plgHikashopValidate_free_order
So either you rename your plugin to smallInvoice, or you change the class name to: plgHikashopPlgHikashopSmallInvoice and the the plugin will be triggered.
Please Log in or Create an account to join the conversation.
Ok, so I've configured everything as follows:
filenames in zip file:
smallinvoice.php and smallinvoice.xml
class name:
class plgHikashopSmallinvoice extends JPlugin
in the xml file:
<files>
<filename plugin="smallinvoice">smallinvoice.php</filename>
</files>
But it's not triggered...
Thanks,
Michel
Please Log in or Create an account to join the conversation.
That code seems to be correct, but the function you use "dumpMessage()" is not a valid function.
Do you have enable the debug mode in Joomla and set the error reporting to "maximum" ?
Thanks to try to display a system message thanks to the code:
Please Log in or Create an account to join the conversation.
dumpMessage() is from the J!Dump plugin that I have installed to try to track what's going on, but it seems as if none of the functions in the plugin ever get called. I have added a call to function onAfterCartUpdate to test this and placed the enqueueMessage code above in it, but this also never gets called. I'm really getting desperate
Thanks for helping me out!
Please Log in or Create an account to join the conversation.
I've added a contructor to see if it gets called:
...but here also: no reaction. It seems as if the plugin is not loaded....
Please Log in or Create an account to join the conversation.
If you see the debug, it means that the file of the plugin is called but that the class name is not correct.
If you don't see the debug, it means that the plugin is not enabled, not with the correct name in the xml, or something like that.
Please Log in or Create an account to join the conversation.
However onAfterOrderConfirm never gets called. All my functionality is in the onAfterOrderConfirm, since I need all the order data after the customer has confirmed his purchase.
Please Log in or Create an account to join the conversation.
I'm one step further now: i've put the code in the onAfterOrderUpdate and check for the status of the order like this:
Is this the correct way to do it? Our goods are delivered without advance payment. We put an invoice with the goods, so there is no payment effectuated (I have activated the bank payment plugin).
What I'm wondering is why in the API description it is mentioned that the onAfterOrderConfirm function is called when the order is created at the end of the checkout. This does not seem to be the case, at least in my plugin this method is never called. Or ist this only valid inside a hikashoppayment plugin?
Thanks,
Michel
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
Using the onAfterOrderUpdate function will probably do the job and as Nicolas said :Is this the correct way to do it? Our goods are delivered without advance payment. We put an invoice with the goods, so there is no payment effectuated (I have activated the bank payment plugin).
The onAfterOrderConfirm function is triggered on the end step of the checkout after the customer clicked on the finish button and confirmed that he wanted to checkout so that payment plugins can redirect the customer to the payment gateway.
So it's normal that it isn't triggered when an order is confirmed.
What you want to use is the onAfterOrderUpdate trigger which is called each time an order is changed and check on the order_status attribute.
Please Log in or Create an account to join the conversation.