Location: PHPKode > projects > HikaShop > back/extensions/plg_hikashop_history/history.php
<?php
/**
 * @package		HikaShop for Joomla!
 * @version		1.4.3
 * @author		hikashop.com
 * @copyright	(C) 2010 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 plgHikashopHistory extends JPlugin
{
	function plgHikashopHistory(&$subject, $config){
		parent::__construct($subject, $config);
		if(!isset($this->params)){
			$plugin =& JPluginHelper::getPlugin('hikashop', 'history');
			jimport('joomla.html.parameter');
			$this->params = new JParameter( $plugin->params );
		}
    }
    function onAfterOrderCreate(&$order,&$send_email){
		return $this->onAfterOrderUpdate($order,$send_email);
    }
    function onAfterOrderUpdate(&$order,&$send_email){
    	if(!empty($order->order_id)){
			$history = null;
			$history->history_order_id = $order->order_id;
			$history->history_created = time();
			$history->history_ip = hikashop::getIP();
			if(empty($order->order_status)){
				$class = hikashop::get('class.order');
				$old = $class->get($order->order_id);
				$order->order_status = $old->order_status;
			}
			$history->history_new_status = $order->order_status;
			if(!empty($order->history)){
				$history->history_reason = @$order->history->history_reason;
				$history->history_notified = @$order->history->history_notified;
				$history->history_amount = @$order->history->history_amount;
				$history->history_package_id = @$order->history->history_package_id;
				$history->history_payment_id = @$order->history->history_payment_id;
				$history->history_payment_method = @$order->history->history_payment_method;
				$history->history_data = @$order->history->history_data;
				$history->history_type =  @$order->history->history_type;
			}
			$historyClass = hikashop::get('class.history');
			$historyClass->save($history);
    	}
		return true;
    }
    function onAfterOrderDelete($elements){
    	if(!is_array($elements)){
			$elements = array($elements);
		}
		$database =& JFactory::getDBO();
		foreach($elements as $key => $val){
			$elements[$key] = $database->Quote($val);
		}
		$query='DELETE FROM '.hikashop::table('history').' WHERE history_order_id IN ('.implode(',',$elements).')';
		$database->setQuery($query);
		$database->query();
		return true;
    }
}
Return current item: HikaShop