本文整理汇总了PHP中Mage_Adminhtml_Block_Dashboard_Grid::_prepareCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Adminhtml_Block_Dashboard_Grid::_prepareCollection方法的具体用法?PHP Mage_Adminhtml_Block_Dashboard_Grid::_prepareCollection怎么用?PHP Mage_Adminhtml_Block_Dashboard_Grid::_prepareCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Adminhtml_Block_Dashboard_Grid
的用法示例。
在下文中一共展示了Mage_Adminhtml_Block_Dashboard_Grid::_prepareCollection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareCollection
protected function _prepareCollection()
{
if (!Mage::helper('core')->isModuleEnabled('Mage_Reports')) {
return $this;
}
$collection = Mage::getResourceModel('reports/order_collection')->addItemCountExpr()->joinCustomerName('customer')->orderByCreatedAt();
if ($this->getParam('store') || $this->getParam('website') || $this->getParam('group')) {
if ($this->getParam('store')) {
$collection->addAttributeToFilter('store_id', $this->getParam('store'));
} else {
if ($this->getParam('website')) {
$storeIds = Mage::app()->getWebsite($this->getParam('website'))->getStoreIds();
$collection->addAttributeToFilter('store_id', array('in' => $storeIds));
} else {
if ($this->getParam('group')) {
$storeIds = Mage::app()->getGroup($this->getParam('group'))->getStoreIds();
$collection->addAttributeToFilter('store_id', array('in' => $storeIds));
}
}
}
$collection->addRevenueToSelect();
} else {
$collection->addRevenueToSelect(true);
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例2: _prepareCollection
protected function _prepareCollection()
{
$collection = Mage::getModel('compta_invoice/invoice')->getCollection()->addFieldToFilter('adjusted', 0)->addFieldToSelect('*');
$collection->getSelect()->joinLeft('compta_customer', 'compta_customer.customer_id = main_table.customer_id');
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例3: _prepareCollection
protected function _prepareCollection()
{
//TODO: add full name logic
$collection = Mage::getResourceModel('reports/order_collection')->addItemCountExpr()->addExpressionAttributeToSelect('customer', "IFNULL(CONCAT({{customer_firstname}},' ',{{customer_lastname}}), '{$this->__('Guest')}')", array('customer_firstname', 'customer_lastname'))->setOrder('created_at');
if ($this->getParam('store') || $this->getParam('website') || $this->getParam('group')) {
if ($this->getParam('store')) {
$collection->addAttributeToFilter('store_id', $this->getParam('store'));
} else {
if ($this->getParam('website')) {
$storeIds = Mage::app()->getWebsite($this->getParam('website'))->getStoreIds();
$collection->addAttributeToFilter('store_id', array('in' => $storeIds));
} else {
if ($this->getParam('group')) {
$storeIds = Mage::app()->getGroup($this->getParam('group'))->getStoreIds();
$collection->addAttributeToFilter('store_id', array('in' => $storeIds));
}
}
}
$collection->addExpressionAttributeToSelect('revenue', '({{base_grand_total}})', array('base_grand_total'));
} else {
$collection->addExpressionAttributeToSelect('revenue', '({{base_grand_total}}*{{base_to_global_rate}})', array('base_grand_total', 'base_to_global_rate'));
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例4: _prepareCollection
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('affiliateplus/account_collection');
if ($storeId = $this->getRequest()->getParam('store')) {
$collection->setStoreId($storeId);
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例5: _prepareCollection
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('affiliateplus/transaction_collection');
$collection->setModel('adminhtml/report_item');
$itemTable = $collection->getTable('sales/order_item');
$collection->getSelect()->join(array('i' => $itemTable), 'main_table.order_id = i.order_id AND FIND_IN_SET(i.product_id, main_table.order_item_ids)', array('name', 'product_id', 'product_type', 'sku', 'base_price', 'num_order_placed' => 'SUM(i.qty_ordered)'))->where('type = 3')->group('product_id')->order('num_order_placed DESC')->order('base_price DESC');
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例6: _prepareCollection
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('affiliateplus/action_collection');
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS)->columns(array('referer' => 'domain', 'clicks' => 'SUM(totals)', 'uniques' => 'SUM(is_unique)'))->group('referer')->order('clicks DESC');
if ($storeId = $this->getRequest()->getParam('store')) {
$collection->addFieldToFilter('store_id', $storeId);
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例7: _prepareCollection
/**
* Loads the necessary live user data
* from the specified Piwik instance.
*
* @return Faett_Piwik_Block_Adminhtml_Dashboard_Tab_Live_User The instance
*/
protected function _prepareCollection()
{
// initialize the Piwik service
$service = Faett_Piwik_Service::create();
// load the live user data
$collection = $service->call('Live.getLastVisits');
// set the data
$this->setCollection($collection);
// call the method of the parent class
return parent::_prepareCollection();
}
示例8: _prepareCollection
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('affiliateplus/account_collection');
$transactionTable = $collection->getTable('affiliateplus/transaction');
$collection->getSelect()->joinLeft(array('ts' => $transactionTable), 'main_table.account_id = ts.account_id AND ts.type = 3', array('amount' => 'SUM(ts.total_amount)', 'num_order_placed' => 'COUNT(ts.transaction_id)'))->where('ts.status = 1')->group('ts.account_id')->order('amount DESC');
if ($storeId = $this->getRequest()->getParam('store')) {
$collection->setStoreId($storeId);
$collection->getSelect()->where("ts.store_id = {$storeId}");
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:12,代码来源:Magestore_Affiliateplusstatistic_Block_Grids_Affiliates.php
示例9: _prepareCollection
protected function _prepareCollection()
{
if ($this->getParam('website')) {
$storeIds = Mage::app()->getWebsite($this->getParam('website'))->getStoreIds();
$storeId = array_pop($storeIds);
} else {
if ($this->getParam('group')) {
$storeIds = Mage::app()->getGroup($this->getParam('group'))->getStoreIds();
$storeId = array_pop($storeIds);
} else {
$storeId = (int) $this->getParam('store');
}
}
$collection = Mage::getResourceModel('sales/report_bestsellers_collection')->setModel('catalog/product')->addStoreFilter($storeId);
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例10: _prepareCollection
protected function _prepareCollection()
{
if ($this->getParam('website')) {
$storeIds = Mage::app()->getWebsite($this->getParam('website'))->getStoreIds();
$storeId = array_pop($storeIds);
} else {
if ($this->getParam('group')) {
$storeIds = Mage::app()->getGroup($this->getParam('group'))->getStoreIds();
$storeId = array_pop($storeIds);
} else {
$storeId = (int) $this->getParam('store');
}
}
$collection = Mage::getResourceModel('reports/product_collection')->addOrderedQty()->addAttributeToSelect(array('name', 'price'))->setStoreId($storeId)->addStoreFilter($storeId)->setOrder('ordered_qty', 'desc');
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例11: _prepareCollection
protected function _prepareCollection()
{
$this->_collection = Mage::getModel('catalogsearch/query')->getResourceCollection();
$this->_collection->setRecentQueryFilter();
if ($this->getRequest()->getParam('store')) {
$this->_collection->addFieldToFilter('store_id', $this->getRequest()->getParam('store'));
} else {
if ($this->getRequest()->getParam('website')) {
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
$this->_collection->addFieldToFilter('store_id', array('in' => $storeIds));
} else {
if ($this->getRequest()->getParam('group')) {
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
$this->_collection->addFieldToFilter('store_id', array('in' => $storeIds));
}
}
}
$this->setCollection($this->_collection);
return parent::_prepareCollection();
}
示例12: _prepareCollection
protected function _prepareCollection()
{
$this->_collection = Mage::getModel('catalogsearch/query')->getResourceCollection();
if ($this->getRequest()->getParam('store')) {
$storeIds = $this->getRequest()->getParam('store');
} else {
if ($this->getRequest()->getParam('website')) {
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
} else {
if ($this->getRequest()->getParam('group')) {
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
} else {
$storeIds = '';
}
}
}
$this->_collection->setPopularQueryFilter($storeIds);
$this->setCollection($this->_collection);
return parent::_prepareCollection();
}
示例13: _prepareCollection
protected function _prepareCollection()
{
if (!Mage::helper('Mage_Core_Helper_Data')->isModuleEnabled('Mage_Sales')) {
return $this;
}
if ($this->getParam('website')) {
$storeIds = Mage::app()->getWebsite($this->getParam('website'))->getStoreIds();
$storeId = array_pop($storeIds);
} else {
if ($this->getParam('group')) {
$storeIds = Mage::app()->getGroup($this->getParam('group'))->getStoreIds();
$storeId = array_pop($storeIds);
} else {
$storeId = (int) $this->getParam('store');
}
}
$collection = Mage::getResourceModel('Mage_Sales_Model_Resource_Report_Bestsellers_Collection')->setModel('Mage_Catalog_Model_Product')->addStoreFilter($storeId);
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例14: _prepareCollection
protected function _prepareCollection()
{
$collection = new Varien_Data_Collection();
$monthsTrad = array('January' => 'Janvier', 'February' => 'Février', 'March' => 'Mars', 'April' => 'Avril', 'May' => 'Mai', 'June' => 'Juin', 'July' => 'Juillet', 'August' => 'Août', 'September' => 'Septembre', 'October' => 'Octobre', 'November' => 'Novembre', 'December' => 'Décembre');
for ($m = 0; $m < 5; $m++) {
$object = new Varien_Object();
$collectionInvoices = Mage::getModel('compta_invoice/invoice')->getCollection()->addFieldToFilter('adjusted', 1)->addFieldToFilter('payment_date', array('like' => date("Y-m", strtotime("-{$m} month")) . "-%"));
$total = 0;
foreach ($collectionInvoices as $invoice) {
$total += $invoice->getAmount();
}
$object->setData('month', $monthsTrad[date("F", strtotime("-{$m} month"))] . ' ' . date("Y", strtotime("-{$m} month")));
$object->setData('amount', $total);
$object->setData('amount_net', Mage::helper('compta_invoice')->toNet($total));
$collection->addItem($object);
unset($object);
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例15: _prepareCollection
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('reports/customer_collection')->addCustomerName();
$storeFilter = 0;
if ($this->getParam('store')) {
$collection->addAttributeToFilter('store_id', $this->getParam('store'));
$storeFilter = 1;
} else {
if ($this->getParam('website')) {
$storeIds = Mage::app()->getWebsite($this->getParam('website'))->getStoreIds();
$collection->addAttributeToFilter('store_id', array('in' => $storeIds));
} else {
if ($this->getParam('group')) {
$storeIds = Mage::app()->getGroup($this->getParam('group'))->getStoreIds();
$collection->addAttributeToFilter('store_id', array('in' => $storeIds));
}
}
}
$collection->addOrdersStatistics($storeFilter)->orderByCustomerRegistration();
$this->setCollection($collection);
return parent::_prepareCollection();
}