- Posts: 4
- Thank you received: 0
onAfterOrderUpdate not triggered on paypal confirm
11 years 1 month ago #210522
by dirkey
onAfterOrderUpdate not triggered on paypal confirm was created by dirkey
-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.2.7
-- PHP version -- : 5.3.2
Hello,
We create a plugin which works "perfectly"
. If the order is change to confirmed state, a email with a pdf (invoice) is created and send to the customer. There is only one issue:
If the user pays via paypal the plugin is not invoked. The order is confirmed, but it seems not to trigger the plugin. If I change the state back to open (in the backend) and back to confirmed, the trigger is invoked.
Thanks for help,
Dirk
-- Joomla version -- : 3.2.7
-- PHP version -- : 5.3.2
Hello,
We create a plugin which works "perfectly"
If the user pays via paypal the plugin is not invoked. The order is confirmed, but it seems not to trigger the plugin. If I change the state back to open (in the backend) and back to confirmed, the trigger is invoked.
Thanks for help,
Dirk
Please Log in or Create an account to join the conversation.
11 years 1 month ago #210533
by Jerome
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.
Replied by Jerome on topic onAfterOrderUpdate not triggered on paypal confirm
Hi,
The paypal plugin works like a lot of other payment plugin ; it receives a notification (IPN) to confirm the order.
At this moment the plugin will modify the order and it will trigger the trigger "onAfterOrderUpdate".
Because it's not the user who confirmed his order, you can't see it in your browser ; the confirmation is made during a server-to-server call.
But in any case, the trigger is called !
Regards,
The paypal plugin works like a lot of other payment plugin ; it receives a notification (IPN) to confirm the order.
At this moment the plugin will modify the order and it will trigger the trigger "onAfterOrderUpdate".
Because it's not the user who confirmed his order, you can't see it in your browser ; the confirmation is made during a server-to-server call.
But in any case, the trigger is called !
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.
11 years 1 month ago - 11 years 1 month ago #210926
by dirkey
Replied by dirkey on topic onAfterOrderUpdate not triggered on paypal confirm
Hi Jerome,
but why is the emai not created. My plugin creates a pdf invoice and sends it via email:
Some extract:
As I mention, it works completly fine if I switch the order state in the backend.
Thanks,
Dirk
but why is the emai not created. My plugin creates a pdf invoice and sends it via email:
Some extract:
Code:
class plgHikashopAsado_invoice extends JPlugin {
....
function onAfterOrderUpdate(&$order, &$send_email) {
if ($order->order_status == 'confirmed') {
$mailer = JFactory::getMailer ();
// set sender & recipient
$mailer->setSender ( $order->mail->from_email );
....
// sending the email
$send = $mailer->Send ();
if ($send) {
JFactory::getApplication ()->enqueueMessage ( 'A mail was send.' );
} else {
JFactory::getApplication ()->enqueueMessage ( 'The billing email could not be send.', 'error' );
return false;
}
}
}
As I mention, it works completly fine if I switch the order state in the backend.
Thanks,
Dirk
Last edit: 11 years 1 month ago by dirkey.
Please Log in or Create an account to join the conversation.
11 years 1 month ago #210929
by nicolas
Replied by nicolas on topic onAfterOrderUpdate not triggered on paypal confirm
Hi,
I don't see any reason why it wouldn't work if it works on the backend. We have many plugins which use that method in order to do things when an order is confirmed.
We actually already have a PDF invoice plugin which works like that:
hikashop.com/component/hikashop/product/cid-18.html
You must have an issue somewhere in the code of the plugin with something which can only work in the backend, not the frontend.
For example, if you're using the loadFullOrder function call in order to load the details of the order, this will always work in the backend, but on the frontend, as the user loading the order is not the customer but the PayPal notification server, you need to add additional parameters when calling it in order to disable the check on the current user.
I don't see any reason why it wouldn't work if it works on the backend. We have many plugins which use that method in order to do things when an order is confirmed.
We actually already have a PDF invoice plugin which works like that:
hikashop.com/component/hikashop/product/cid-18.html
You must have an issue somewhere in the code of the plugin with something which can only work in the backend, not the frontend.
For example, if you're using the loadFullOrder function call in order to load the details of the order, this will always work in the backend, but on the frontend, as the user loading the order is not the customer but the PayPal notification server, you need to add additional parameters when calling it in order to disable the check on the current user.
Please Log in or Create an account to join the conversation.
Time to create page: 0.207 seconds