本文整理汇总了PHP中Mage_Adminhtml_Block_Report_Grid_Abstract::_prepareCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Adminhtml_Block_Report_Grid_Abstract::_prepareCollection方法的具体用法?PHP Mage_Adminhtml_Block_Report_Grid_Abstract::_prepareCollection怎么用?PHP Mage_Adminhtml_Block_Report_Grid_Abstract::_prepareCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Adminhtml_Block_Report_Grid_Abstract
的用法示例。
在下文中一共展示了Mage_Adminhtml_Block_Report_Grid_Abstract::_prepareCollection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareCollection
/**
* Preparing collection
* Filter canceled statuses for orders in taxes
*
*@return Mage_Adminhtml_Block_Report_Sales_Tax_Grid
*/
protected function _prepareCollection()
{
$filterData = $this->getFilterData();
if (!$filterData->hasData('order_statuses')) {
$orderConfig = Mage::getModel('sales/order_config');
$statusValues = array();
$canceledStatuses = $orderConfig->getStateStatuses(Mage_Sales_Model_Order::STATE_CANCELED);
foreach ($orderConfig->getStatuses() as $code => $label) {
if (!isset($canceledStatuses[$code])) {
$statusValues[] = $code;
}
}
$filterData->setOrderStatuses($statusValues);
}
return parent::_prepareCollection();
}
示例2: _prepareCollection
protected function _prepareCollection()
{
$filterData = $this->getFilterData();
if ($filterData->getData('from') == null || $filterData->getData('to') == null) {
$this->setCountTotals(false);
$this->setCountSubTotals(false);
return parent::_prepareCollection();
}
$storeIds = $this->_getStoreIds();
$orderStatuses = $filterData->getData('order_statuses');
if (is_array($orderStatuses)) {
if (count($orderStatuses) == 1 && strpos($orderStatuses[0], ',') !== false) {
$filterData->setData('order_statuses', explode(',', $orderStatuses[0]));
}
}
$vendorIds = $this->_getVendorIds();
//print_r($vendorIds);
$resourceCollection = Mage::getResourceModel($this->getResourceCollectionName())->setPeriod($filterData->getData('period_type'))->setDateRange($filterData->getData('from', null), $filterData->getData('to', null))->addStoreFilter($storeIds)->addVendorFilter($vendorIds)->addOrderStatusFilter($filterData->getData('order_statuses'))->setAggregatedColumns($this->_getAggregatedColumns());
if ($this->_isExport) {
$this->setCollection($resourceCollection);
return $this;
}
if ($filterData->getData('show_empty_rows', false)) {
Mage::helper('reports')->prepareIntervalsCollection($this->getCollection(), $filterData->getData('from', null), $filterData->getData('to', null), $filterData->getData('period_type'));
}
if ($this->getCountSubTotals()) {
$this->getSubTotals();
}
if ($this->getCountTotals()) {
$totalsCollection = Mage::getResourceModel($this->getResourceCollectionName())->setPeriod($filterData->getData('period_type'))->setDateRange($filterData->getData('from', null), $filterData->getData('to', null))->addStoreFilter($storeIds)->addVendorFilter($vendorIds)->addOrderStatusFilter($filterData->getData('order_statuses'))->setAggregatedColumns($this->_getAggregatedColumns())->isTotals(true);
foreach ($totalsCollection as $item) {
$this->setTotals($item);
break;
}
}
$this->getCollection()->setColumnGroupBy($this->_columnGroupBy);
$this->getCollection()->setResourceCollection($resourceCollection);
//$grandParent = $this->getGrandParent();
return $this;
}
开发者ID:shashankkanungo,项目名称:magento,代码行数:40,代码来源:SM_Vendors_Block_Adminhtml_Reports_VendorOrders_Grid.php