protected function _prepareLayout() { $collection = Mage::getResourceModel('affiliateplusstatistic/sales_collection')->prepareLifeTimeTotal(); if ($storeId = $this->getRequest()->getParam('store')) { $collection->addFieldToFilter('store_id', $storeId); } $chartData = array(); foreach ($collection->load() as $item) { $chartData[] = $item->getTotal(); } if (count($chartData)) { $this->_is_has_data = true; } switch (count($chartData)) { case 1: $chartData[1] = 0; case 2: $chartData[2] = 0; case 3: break; default: $chartData = array_slice($chartData, 0, 3); } $this->addTotal($this->__('Completed'), $chartData[0], true); $this->addTotal($this->__('Pending'), $chartData[1], true); $this->addTotal($this->__('Canceled'), $chartData[2], true); $this->setTableId('transactionsgrid'); parent::_prepareLayout(); }
/** * Prepare the layout. set child blocks * * @return Mage_Core_Block_Abstract|void * @throws Exception */ protected function _prepareLayout() { $this->setChild('sales', $this->getLayout()->createBlock('ddg_automation/adminhtml_dashboard_tabs_analysis_sales')); $this->setChild('abandoned_cart', $this->getLayout()->createBlock('ddg_automation/adminhtml_dashboard_tabs_analysis_abandonedcarts')); $this->setChild('customer', $this->getLayout()->createBlock('ddg_automation/adminhtml_dashboard_tabs_analysis_customer')); $this->setChild('subscriber', $this->getLayout()->createBlock('ddg_automation/adminhtml_dashboard_tabs_analysis_subscriber')); $this->setChild('rfm', $this->getLayout()->createBlock('ddg_automation/adminhtml_dashboard_tabs_analysis_rfm')); parent::_prepareLayout(); }
protected function _prepareLayout() { $collection = Mage::getResourceModel('affiliateplusstatistic/statistic_collection')->prepareLifeTimeTotal(); if ($storeId = $this->getRequest()->getParam('store')) { $collection->addFieldToFilter('store_id', $storeId); } $dataObject = $collection->getFirstItem(); $this->addTotal($this->__('Total Clicks'), $dataObject->getTotalClicks(), true); $this->addTotal($this->__('Unique Clicks'), $dataObject->getTotalUniques(), true); $this->setTableId('trafficsgrid'); parent::_prepareLayout(); }
/** * Prepare the layout. * * @return Mage_Core_Block_Abstract|void * @throws Exception */ protected function _prepareLayout() { $website = 0; if ($store = $this->getRequest()->getParam('store')) { $website = Mage::app()->getStore($store)->getWebsite(); } elseif ($this->getRequest()->getParam('website')) { $website = $this->getRequest()->getParam('website'); } $apiUsername = Mage::helper('ddg')->getApiUsername($website); $apiPassword = Mage::helper('ddg')->getApiPassword($website); $data = Mage::getModel('ddg_automation/apiconnector_client')->setApiUsername($apiUsername)->setApiPassword($apiPassword)->getAccountInfo(); if (isset($data->id)) { $this->prepareGroupArray($data); } $this->_setChild(); parent::_prepareLayout(); }
protected function _prepareLayout() { $reports = $this->_getReportsModel(); $filterStoreId = array(); $filterStoreIds = $filterStoreId; if ($storeId = $this->getRequest()->getParam('store')) { $filterStoreId = array('store_id' => $storeId); $filterStoreIds = array('store_ids' => array('finset' => $storeId)); } $reports->setCollection(Mage::getResourceModel('affiliateplus/transaction_collection'))->setFilters($filterStoreId)->addFilter('status', 1); $reportDataObject = $reports->resetSelectColumns()->addCountColumn('total_transactions', 'transaction_id')->addSumColumn('lifetime_sales_amount', 'total_amount')->addSumColumn('total_commissions', 'commission')->getDataObject(); $this->addTotal($this->__('Lifetime Sales'), $reportDataObject->getLifetimeSalesAmount()); $this->addTotal($this->__('Total Commissions'), $reportDataObject->getTotalCommissions()); $this->addTotal($this->__('Total Transactions'), $reportDataObject->getTotalTransactions(), true); $this->addTotal($this->__('Total Affiliate Accounts'), Mage::getResourceModel('affiliateplus/account_collection')->getSize(), true); $reports->setCollection(Mage::getResourceModel('affiliateplus/payment_collection')->setLoadMethodInfo(false))->setFilters($filterStoreIds)->addFilter('status', 3); $reportDataObject = $reports->resetSelectColumns()->addSumColumn('total_payout', 'amount')->getDataObject(); $this->addTotal($this->__('Total Payouts'), $reportDataObject->getTotalPayout()); $this->setEntryEditHead($this->__('General'))->setTableId('general'); parent::_prepareLayout(); }