Hi,
You have several problems with your code:
1. constructors should be named __construct and not the name of the class to be able to support new versions of PHP.
2. in the onAfterOrderCreate function, you don't have any code.
3. onAfterOrderUpdate misses the "function" text before and the function< loadFullOrder>() line is totally weird.
4. The $order_id in your code comes from nowhere. You need to get it from the $order object.
5. As explained in the documation, the products are available in $order->products and if you look in the order object provided in the documentation, you'll see that the products are in an array, and that each element of the array is an object containing the data of each product.
So to sum it up, the code should be:
<?php
/**
* @package HikaShop for Joomla!
* @version 2.6.3
* @author hikashop.com
* @copyright (C) 2010-2016 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
class plgHikashopDash extends JPlugin {
function __construct (&$subject, $config){
parent::__construct($subject, $config);
protected $autoloadLanguage = true;
}
// Call a trigger, in this example: onBeforeOrderCreate
onAfterOrderCreate(&$order,&$send_email)
{
// Actions to do when my trigger is called
}
onAfterOrderUpdate(&$order,&$send_email)
{
// Actions to do when my trigger is called
if(!@include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){ return false; }
$orderClass = hikashop_get('class.order');
$order = $orderClass->loadFullOrder($order->order_id, true, false);
$do = false;
foreach( $order->products as $product){
if($product->order_product_name == 'my product name') $do = true;
}
if(!$do) return;
if($order->order_status != 'confirmed') return;
\\curl
$cSession = curl_init();
curl_setopt($cSession,CURLOPT_URL," http://realflight.com:8080/realflight/pages/<callbackName>.jsp?email=".$order->customer->user_email. "&ordern=". $order->order_number."&prodid=GO_PILOT");
curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
curl_setopt($cSession,CURLOPT_HEADER, false);
$result=curl_exec($cSession);
curl_close($cSession);
echo $result;
}
}
?>
Please note that this is a user support forum. We can't work on custom development for you. If you can't do it on your own with the hint we give you, you'll have to contact a 3rd party developer to help you with that.