Esempio n. 1
0
 public static function getOrder($oid)
 {
     self::onExecuteBefore(array(&$oid));
     if (!empty($oid)) {
         $db = JFactory::getDBO();
         $query = $db->getQuery(true);
         $query->select('
                 o.id,
                 o.cost,
                 o.discounts,
                 o.user_id,
                 o.region_id,
                 o.shipping_id,
                 o.shipping_coords,
                 o.customer_fields,
                 o.address_fields, 
                 o.payment_id,
                 o.note,
                 o.status_id,
                 o.date_add,
                 os.title AS status_name
             ')->from('#__ksenmart_orders AS o')->leftjoin('#__ksenmart_order_statuses AS os ON o.status_id=os.id')->where('o.id=' . $db->escape($oid));
         $db->setQuery($query);
         $order = $db->loadObject();
         self::setUserInfoField2Order($order);
         $query = $db->getQuery(true);
         $query->select('*')->from('#__ksenmart_order_items')->where('order_id=' . $oid);
         $db->setQuery($query);
         $order->items = $db->loadObjectList();
         $order->costs = array('cost' => KSMPrice::getPriceInDefaultCurrency($order->cost), 'cost_val' => KSMPrice::showPriceWithTransform($order->cost), 'discount_cost' => 0, 'discount_cost_val' => KSMPrice::showPriceWithTransform(0), 'shipping_cost' => 0, 'shipping_cost_val' => KSMPrice::showPriceWithTransform(0), 'total_cost' => KSMPrice::getPriceInDefaultCurrency($order->cost), 'total_cost_val' => KSMPrice::showPriceWithTransform($order->cost));
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('onAfterGetOrder', array(&$order));
         self::onExecuteAfter(array(&$order));
         return $order;
     }
     return new stdClass();
 }