Public Member Functions | |
setDateRange ($from, $to) | |
setStoreIds ($storeIds) | |
getSelectCountSql () |
Definition at line 35 of file Collection.php.
getSelectCountSql | ( | ) |
Get SQL for get record count
Reimplemented from Varien_Data_Collection_Db.
Definition at line 88 of file Collection.php.
00089 { 00090 $countSelect = clone $this->getSelect(); 00091 $countSelect->reset(Zend_Db_Select::ORDER); 00092 $countSelect->reset(Zend_Db_Select::LIMIT_COUNT); 00093 $countSelect->reset(Zend_Db_Select::LIMIT_OFFSET); 00094 $countSelect->reset(Zend_Db_Select::COLUMNS); 00095 $countSelect->reset(Zend_Db_Select::GROUP); 00096 $countSelect->reset(Zend_Db_Select::HAVING); 00097 $countSelect->from("", "count(*)"); 00098 $sql = $countSelect->__toString(); 00099 return $sql; 00100 }
setDateRange | ( | $ | from, | |
$ | to | |||
) |
Definition at line 38 of file Collection.php.
00039 { 00040 $this->_reset() 00041 ->addAttributeToSelect('*') 00042 ->addAttributeToFilter('created_at', array('from' => $from, 'to' => $to)) 00043 ->addExpressionAttributeToSelect('orders', 'COUNT({{total_refunded}})', array('total_refunded')); 00044 00045 $this->getSelect() 00046 ->where('base_total_refunded>0') 00047 ->group('("*")') 00048 ->having('orders > 0'); 00049 00050 return $this; 00051 }
setStoreIds | ( | $ | storeIds | ) |
Definition at line 53 of file Collection.php.
00054 { 00055 $vals = array_values($storeIds); 00056 if (count($storeIds) >= 1 && $vals[0] != '') { 00057 $this->addAttributeToFilter('store_id', array('in' => (array)$storeIds)) 00058 ->addExpressionAttributeToSelect( 00059 'refunded', 00060 'SUM({{base_total_refunded}})', 00061 array('base_total_refunded')) 00062 ->addExpressionAttributeToSelect( 00063 'online_refunded', 00064 'SUM({{base_total_online_refunded}})', 00065 array('base_total_online_refunded')) 00066 ->addExpressionAttributeToSelect( 00067 'offline_refunded', 00068 'SUM({{base_total_offline_refunded}})', 00069 array('base_total_offline_refunded')); 00070 } else { 00071 $this->addExpressionAttributeToSelect( 00072 'refunded', 00073 'SUM({{base_total_refunded}}*{{base_to_global_rate}})', 00074 array('base_total_refunded', 'base_to_global_rate')) 00075 ->addExpressionAttributeToSelect( 00076 'online_refunded', 00077 'SUM({{base_total_online_refunded}}*{{base_to_global_rate}})', 00078 array('base_total_online_refunded', 'base_to_global_rate')) 00079 ->addExpressionAttributeToSelect( 00080 'offline_refunded', 00081 'SUM({{base_total_offline_refunded}}*{{base_to_global_rate}})', 00082 array('base_total_offline_refunded', 'base_to_global_rate')); 00083 } 00084 00085 return $this; 00086 }