示例#1
0
 function display($tpl = null)
 {
     if (!class_exists('VmImage')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
     }
     VmConfig::loadJLang('com_virtuemart_orders', TRUE);
     $model = VmModel::getModel('virtuemart');
     $nbrCustomers = $model->getTotalCustomers();
     $this->assignRef('nbrCustomers', $nbrCustomers);
     $nbrActiveProducts = $model->getTotalActiveProducts();
     $this->assignRef('nbrActiveProducts', $nbrActiveProducts);
     $nbrInActiveProducts = $model->getTotalInActiveProducts();
     $this->assignRef('nbrInActiveProducts', $nbrInActiveProducts);
     $nbrFeaturedProducts = $model->getTotalFeaturedProducts();
     $this->assignRef('nbrFeaturedProducts', $nbrFeaturedProducts);
     $ordersByStatus = $model->getTotalOrdersByStatus();
     $this->assignRef('ordersByStatus', $ordersByStatus);
     $recentOrders = $model->getRecentOrders();
     if (!class_exists('CurrencyDisplay')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     /* Apply currency This must be done per order since it's vendor specific */
     $_currencies = array();
     // Save the currency data during this loop for performance reasons
     foreach ($recentOrders as $virtuemart_order_id => $order) {
         //This is really interesting for multi-X, but I avoid to support it now already, lets stay it in the code
         if (!array_key_exists('v' . $order->virtuemart_vendor_id, $_currencies)) {
             $_currencies['v' . $order->virtuemart_vendor_id] = CurrencyDisplay::getInstance('', $order->virtuemart_vendor_id);
         }
         $order->order_total = $_currencies['v' . $order->virtuemart_vendor_id]->priceDisplay($order->order_total);
     }
     $this->assignRef('recentOrders', $recentOrders);
     $recentCustomers = $model->getRecentCustomers();
     $this->assignRef('recentCustomers', $recentCustomers);
     if (!class_exists('ShopFunctions')) {
         require JPATH_VM_ADMINISTRATOR . '/helpers/shopfunctions.php';
     }
     $extensionsFeed = ShopFunctions::getExtensionsRssFeed();
     $this->assignRef('extensionsFeed', $extensionsFeed);
     $virtuemartFeed = ShopFunctions::getVirtueMartRssFeed();
     $this->assignRef('virtuemartFeed', $virtuemartFeed);
     // Options button.
     // if ( !JVM_VERSION===1) {
     // if (JFactory::getUser()->authorise('core.admin', 'com_virtuemart')) {
     // JToolBarHelper::preferences('com_virtuemart');
     // }
     // }
     parent::display($tpl);
 }