0
A
回答
0
让我们来看看一步一步:
模板(应用程序/设计/ adminhtml /默认/缺省的/模板/仪表板/ index.phtml),第98行
<div class="dashboard-container">
<?php echo $this->getChildHtml('store_switcher') ?>
<table cellspacing="25" width="100%">
<tr>
<td>
<!-- Start including the sales blocks -->
<?php echo $this->getChildHtml('sales') ?>
<!-- End including -->
<div class="entry-edit">
<div class="entry-edit-head"><h4><?php echo $this->__('Last 5 Orders') ?></h4></div>
<fieldset class="np"><?php echo $this->getChildHtml('lastOrders'); ?></fieldset>
</div>
<div class="entry-edit">
<div class="entry-edit-head"><h4><?php echo $this->__('Last 5 Search Terms') ?></h4></div>
<fieldset class="np"><?php echo $this->getChildHtml('lastSearches'); ?></fieldset>
</div>
<div class="entry-edit">
<div class="entry-edit-head"><h4><?php echo $this->__('Top 5 Search Terms') ?></h4></div>
<fieldset class="np"><?php echo $this->getChildHtml('topSearches'); ?></fieldset>
</div>
</td>
您可以看到包含$this->getChildHtml('sales')
。这是负责这两个块终生销售和平均销售从您的屏幕截图。
此模板来自块Mage_Adminhtml_Block_Dashboard
,其中您可以找到_prepareLayout()
方法。
Block类Mage_Adminhtml_Block_Dashboard(应用程序/代码/核心/法师/ Adminhtml /座/ Dashboard.php)
protected function _prepareLayout()
{
...
$this->setChild('sales',
$this->getLayout()->createBlock('adminhtml/dashboard_sales')
);
...
}
正如你所看到的,它集块 '销售' 与块类Mage_Adminhtml_Block_Dashboard_Sales
。
Block类Mage_Adminhtml_Block_Dashboard_Sales(应用程序/代码/核心/法师/ Adminhtml /座/仪表板/ Sales.php)
现在,它变得有趣! :)
检查_prepareLayout
方法...
protected function _prepareLayout()
{
if (!Mage::helper('core')->isModuleEnabled('Mage_Reports')) {
return $this;
}
$isFilter = $this->getRequest()->getParam('store') || $this->getRequest()->getParam('website') || $this->getRequest()->getParam('group');
$collection = Mage::getResourceModel('reports/order_collection')
->calculateSales($isFilter);
if ($this->getRequest()->getParam('store')) {
$collection->addFieldToFilter('store_id', $this->getRequest()->getParam('store'));
} else if ($this->getRequest()->getParam('website')){
$storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
$collection->addFieldToFilter('store_id', array('in' => $storeIds));
} else if ($this->getRequest()->getParam('group')){
$storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
$collection->addFieldToFilter('store_id', array('in' => $storeIds));
}
$collection->load();
$sales = $collection->getFirstItem();
// HERE YOU GO!
$this->addTotal($this->__('Lifetime Sales'), $sales->getLifetime());
$this->addTotal($this->__('Average Orders'), $sales->getAverage());
}
什么你(希望)见:
- 这两个块只有
Mage_Reports
显示已启用 - 的块基本上在这里硬编码
- 如果你想在重写
_prepareLayout
用自己的方法 3.
相关问题
- 1. Magento仪表板在登录到管理面板后显示仪表板页面,图像和内容不完整
- 2. 如何在菜单项管理面板中添加一些内容Magento
- 3. 如何在CSS样式的HTML列表中添加到WordPress,管理仪表板
- 4. 如何将内容添加到正确的结构块在magento
- 5. Magento的动态块添加内容
- 6. Magento模块更改仪表板图
- 7. 管理Magento页脚内容
- 8. 向Joomla管理仪表板添加一个“大图标”
- 9. 覆盖django管理仪表板并在其上添加逻辑
- 10. 如何在magento管理面板中添加菜单?
- 11. 升级magento最新版本从1.1.3通过管理仪表板
- 12. Magento管理员表单搜索/重置过滤器重定向到仪表板
- 13. 奏鸣曲管理员:如何从仪表板删除“添加新的”按钮?
- 14. 如何在magento的右侧栏中添加动态内容块
- 15. Magento:添加到管理菜单
- 16. 添加注销链接到WordPress管理仪表板左侧边栏菜单
- 17. 如何将用户列表添加到django管理面板
- 18. 如何将图表添加到Kibana 4中的仪表板?
- 19. 将内容添加到除admin之外的liferay用户的仪表板
- 20. Magento,如何在其他块内添加块NAME =“头”块
- 21. 如何为自动更新仪表板添加Deepsee仪表板小部件?
- 22. 如何在magento管理端添加新产品添加页面?
- 23. 如何在rails上显示无表模型管理仪表板
- 24. 如何覆盖Magento管理面板?
- 25. 如何将新项目添加到CruiseControl.NET网络仪表板
- 26. 如何在Serenity管理仪表板中添加新图表(任何图表,高图或D3图表)
- 27. 如何在仪表板模板中添加禁止的警报?
- 28. Magento为管理面板中的电话号码添加验证
- 29. 在管理面板中添加一些HTML magento
- 30. 在magento管理面板中添加一个新的字体