<?php
/**
* @package HikaShop for Joomla!
* @version 2.1.3
* @author hikashop.com
* @copyright (C) 2010-2013 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 plgHikashopInterspire extends JPlugin
{
function plgHikashopInterspire(&$subject, $config){
parent::__construct($subject, $config);
if(!isset($this->params)){
$plugin = JPluginHelper::getPlugin('hikashop', 'history');
if(version_compare(JVERSION,'2.5','<')){
jimport('joomla.html.parameter');
$this->params = new JParameter($plugin->params);
} else {
$this->params = new JRegistry($plugin->params);
}
}
}
function onAfterOrderCreate(&$order,&$send_email){
return $this->onAfterOrderUpdate($order,$send_email);
}
function onAfterOrderUpdate(&$order,&$send_email){
if(!empty($order->order_id)){
if($order->order_status == 'confirmed'){
$userClass = hikashop_get('class.user');
$user = $userClass->get($order->order_user_id);
$name = $user->username;
$mail = $user->email;
// Testing
$results = print_r($userClass, true);
// Test e-mail
$to = 'mailservice@****.nl';
$subject = 'A user has been added to the FollowUp list';
$headers = 'From: info@****.nl' . "\r\n" .
'Reply-To: info@****.nl' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$message .= "Results Array: $results \r\n" ;
$message .= "Name: $name \r\n" ;
$message .= "Email: $mail" ;
mail($to, $subject, $message, $headers);
}
}
return true;
}
}