當前位置: 首頁>>代碼示例>>PHP>>正文


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怎麽用?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();
 }
開發者ID:ravi2jdesign,項目名稱:solvingmagento_1.7.0,代碼行數:22,代碼來源:Grid.php

示例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


注:本文中的Mage_Adminhtml_Block_Report_Grid_Abstract::_prepareCollection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。