function onBeforeOrderCreate(&$order,&$do) { try { if(!@include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){ return false; } $app = JFactory::getApplication(); $class = hikashop_get('class.cart'); $cart = $class->loadFullCart(); foreach ($cart->products as $product) { foreach ($order->cart->products as $k => $order_product) { if(strcmp($order_product->order_product_code, $product->product_code) ==0) { $price=0; if (property_exists($product->prices[0], 'price_value_without_discount')) { $price = $product->prices[0]->price_value_without_discount; } else { $price = $product->prices[0]->price_value; } $order->cart->products[$k]->flo_discount = $product->discount->discount_percent_amount; $order->cart->products[$k]->flo_originalprice = $price; } } } } catch (Exception $e) { $errormsg = 'An error occured with number ' . $e->getCode() . ' and message ' . $e->getMessage() . ''; $this->send_errormail($errormsg); $app = JFactory::getApplication(); $app->enqueueMessage($errormsg ); echo $errormsg; } }