-- HikaShop version -- : 3.0.1
-- Joomla version -- : 3.6.5
-- PHP version -- : 7.0.10
I'm trying to write a plugin to perform additional tasks after PayPal payment is recieved. For instance assign points in Jomsocial.
I took the original points plugin and started modifing it. Trying to use the two events:
public function onAfterOrderCreate(&$order, &$send_email) {
$app = JFactory::getApplication();
if($app->isAdmin())
{
return true;
}
if(!isset($order->order_status))
{
return true;
}
if(!empty($order->order_type) && $order->order_type != 'sale')
{
return true;
}
$this->awardDonationRewards($order);
unset($this->fullOrder);
return true;
}
This event works and the '$this->awardDonationRewards($order)' gets pharsed before I get javascript redirected to PayPal.
public function onAfterOrderUpdate(&$order, &$send_email) {
echo 'success';
jexit();
}
Doesn't work as expected. Offcourse this is test code. Ultimately I go to $this->awardDonationRewards($order) again. I had the impression to get a blank page with just one word as result when returning from PayPal. Instead it gives me the full thank you page from the link 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=103&Itemid=580'.
In the administrator I can see the order being changed from 'created' to 'confirmed'.
When I manually edit the order status in the administrator this event gets triggered.
Any ideas how to achieve extra functions after payment and return from PayPal back to my site?