本文整理汇总了PHP中Mage_Sales_Model_Resource_Report_Collection_Abstract类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Resource_Report_Collection_Abstract类的具体用法?PHP Mage_Sales_Model_Resource_Report_Collection_Abstract怎么用?PHP Mage_Sales_Model_Resource_Report_Collection_Abstract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Sales_Model_Resource_Report_Collection_Abstract类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _applyCustomFilter
/**
* Apply collection custom filter
*
* @return Mage_Sales_Model_Resource_Report_Collection_Abstract
*/
protected function _applyCustomFilter()
{
$this->_applyRulesFilter();
return parent::_applyCustomFilter();
}
示例2: __construct
/**
* Initialize custom resource model
*
*/
public function __construct()
{
parent::_construct();
$this->setModel('adminhtml/report_item');
$this->_resource = Mage::getResourceModel('sales/report')->init($this->_aggregationTable);
$this->setConnection($this->getResource()->getReadConnection());
}
示例3: __construct
/**
* Initialize custom resource model
*
*/
public function __construct()
{
parent::_construct();
$this->setModel('Mage_Adminhtml_Model_Report_Item');
$this->_resource = Mage::getResourceModel('Mage_Sales_Model_Resource_Report')->init('sales_refunded_aggregated_order');
$this->setConnection($this->getResource()->getReadConnection());
}
示例4: _beforeLoad
/**
* Redeclare parent method for applying filters after parent method
* but before adding unions and calculating totals
*
* @return Mage_Sales_Model_Resource_Report_Bestsellers_Collection
*/
protected function _beforeLoad()
{
parent::_beforeLoad();
$this->_applyStoresFilter();
if ($this->_period) {
//
$selectUnions = array();
// apply date boundaries (before calling $this->_applyDateRangeFilter())
$dtFormat = Varien_Date::DATE_INTERNAL_FORMAT;
$periodFrom = !is_null($this->_from) ? new Zend_Date($this->_from, $dtFormat) : null;
$periodTo = !is_null($this->_to) ? new Zend_Date($this->_to, $dtFormat) : null;
if ('year' == $this->_period) {
if ($periodFrom) {
// not the first day of the year
if ($periodFrom->toValue(Zend_Date::MONTH) != 1 || $periodFrom->toValue(Zend_Date::DAY) != 1) {
$dtFrom = $periodFrom->getDate();
// last day of the year
$dtTo = $periodFrom->getDate()->setMonth(12)->setDay(31);
if (!$periodTo || $dtTo->isEarlier($periodTo)) {
$selectUnions[] = $this->_makeBoundarySelect($dtFrom->toString($dtFormat), $dtTo->toString($dtFormat));
// first day of the next year
$this->_from = $periodFrom->getDate()->addYear(1)->setMonth(1)->setDay(1)->toString($dtFormat);
}
}
}
if ($periodTo) {
// not the last day of the year
if ($periodTo->toValue(Zend_Date::MONTH) != 12 || $periodTo->toValue(Zend_Date::DAY) != 31) {
$dtFrom = $periodTo->getDate()->setMonth(1)->setDay(1);
// first day of the year
$dtTo = $periodTo->getDate();
if (!$periodFrom || $dtFrom->isLater($periodFrom)) {
$selectUnions[] = $this->_makeBoundarySelect($dtFrom->toString($dtFormat), $dtTo->toString($dtFormat));
// last day of the previous year
$this->_to = $periodTo->getDate()->subYear(1)->setMonth(12)->setDay(31)->toString($dtFormat);
}
}
}
if ($periodFrom && $periodTo) {
// the same year
if ($periodFrom->toValue(Zend_Date::YEAR) == $periodTo->toValue(Zend_Date::YEAR)) {
$dtFrom = $periodFrom->getDate();
$dtTo = $periodTo->getDate();
$selectUnions[] = $this->_makeBoundarySelect($dtFrom->toString($dtFormat), $dtTo->toString($dtFormat));
$this->getSelect()->where('1<>1');
}
}
} else {
if ('month' == $this->_period) {
if ($periodFrom) {
// not the first day of the month
if ($periodFrom->toValue(Zend_Date::DAY) != 1) {
$dtFrom = $periodFrom->getDate();
// last day of the month
$dtTo = $periodFrom->getDate()->addMonth(1)->setDay(1)->subDay(1);
if (!$periodTo || $dtTo->isEarlier($periodTo)) {
$selectUnions[] = $this->_makeBoundarySelect($dtFrom->toString($dtFormat), $dtTo->toString($dtFormat));
// first day of the next month
$this->_from = $periodFrom->getDate()->addMonth(1)->setDay(1)->toString($dtFormat);
}
}
}
if ($periodTo) {
// not the last day of the month
if ($periodTo->toValue(Zend_Date::DAY) != $periodTo->toValue(Zend_Date::MONTH_DAYS)) {
$dtFrom = $periodTo->getDate()->setDay(1);
// first day of the month
$dtTo = $periodTo->getDate();
if (!$periodFrom || $dtFrom->isLater($periodFrom)) {
$selectUnions[] = $this->_makeBoundarySelect($dtFrom->toString($dtFormat), $dtTo->toString($dtFormat));
// last day of the previous month
$this->_to = $periodTo->getDate()->setDay(1)->subDay(1)->toString($dtFormat);
}
}
}
if ($periodFrom && $periodTo) {
// the same month
if ($periodFrom->toValue(Zend_Date::YEAR) == $periodTo->toValue(Zend_Date::YEAR) && $periodFrom->toValue(Zend_Date::MONTH) == $periodTo->toValue(Zend_Date::MONTH)) {
$dtFrom = $periodFrom->getDate();
$dtTo = $periodTo->getDate();
$selectUnions[] = $this->_makeBoundarySelect($dtFrom->toString($dtFormat), $dtTo->toString($dtFormat));
$this->getSelect()->where('1<>1');
}
}
}
}
$this->_applyDateRangeFilter();
// add unions to select
if ($selectUnions) {
$unionParts = array();
$cloneSelect = clone $this->getSelect();
$helper = Mage::getResourceHelper('core');
$unionParts[] = '(' . $cloneSelect . ')';
foreach ($selectUnions as $union) {
//.........这里部分代码省略.........
示例5: load
/**
* Load
*
* @param boolean $printQuery
* @param boolean $logQuery
* @return Mage_Tax_Model_Resource_Report_Updatedat_Collection
*/
public function load($printQuery = false, $logQuery = false)
{
if ($this->isLoaded()) {
return $this;
}
$this->_initSelect();
$this->setApplyFilters(false);
return parent::load($printQuery, $logQuery);
}