コード例 #1
0
 public function __construct()
 {
     $collection = Mage::getResourceModel('affiliateplusstatistic/sales_collection')->prepareLifeTimeTotal();
     $statusArr = array(1, 2, 3);
     if ($storeId = $this->getRequest()->getParam('store')) {
         $collection->addFieldToFilter('store_id', $storeId);
     }
     $chartData = array();
     foreach ($collection->load() as $item) {
         if (in_array($item->getStatus(), $statusArr)) {
             $chartData[$item->getStatus()] = $item->getTotal();
         }
     }
     foreach ($statusArr as $status) {
         if (!isset($chartData[$status])) {
             $chartData[$status] = 0;
         }
     }
     ksort($chartData);
     if (count($chartData)) {
         $this->_is_has_data = true;
     }
     $buffer = implode(',', $chartData);
     $this->_google_chart_params = array('cht' => 'p3', 'chdl' => $this->__('Completed (%d)', $chartData[1]) . '|' . $this->__('Pending (%d)', $chartData[2]) . '|' . $this->__('Canceled (%d)', $chartData[3]), 'chd' => "t:{$buffer}", 'chdlp' => 'b', 'chco' => '0000dd|00dd00|dd0000');
     $this->setHtmlId('left_transactions');
     parent::__construct();
 }
コード例 #2
0
ファイル: Transactions.php プロジェクト: rajarshc/Rooja
 public function __construct()
 {
     $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 0:
             $chartData[] = 0;
         case 1:
             $chartData[] = 0;
         case 2:
             $chartData[] = 0;
         case 3:
             break;
         default:
             $chartData = array_slice($chartData, 0, 3);
     }
     $buffer = implode(',', $chartData);
     $this->_google_chart_params = array('cht' => 'p3', 'chdl' => $this->__('Completed (%d)', $chartData[0]) . '|' . $this->__('Pending (%d)', $chartData[1]) . '|' . $this->__('Canceled (%d)', $chartData[2]), 'chd' => "t:{$buffer}", 'chdlp' => 'b', 'chco' => '0000dd|00dd00|dd0000');
     $this->setHtmlId('left_transactions');
     parent::__construct();
 }
コード例 #3
0
 public function __construct()
 {
     $collection = Mage::getResourceSingleton('affiliateplusstatistic/statistic_collection')->prepareLifeTimeTotal();
     if ($storeId = $this->getRequest()->getParam('store')) {
         $collection->addFieldToFilter('store_id', $storeId);
     }
     $dataObject = $collection->getFirstItem();
     $total = $dataObject->getTotalClicks();
     $uniques = $dataObject->getTotalUniques();
     if ($total && $uniques) {
         $this->_is_has_data = true;
     }
     $this->_google_chart_params = array('cht' => 'p3', 'chdl' => $this->__('Total Clicks (%d)', $total) . '|' . $this->__('Unique Clicks (%d)', $uniques), 'chd' => "t:{$total},{$uniques}", 'chdlp' => 'b', 'chco' => 'dd0000|0000dd');
     $this->setHtmlId('left_traffics');
     parent::__construct();
 }