【问题标题】:Rewriting the admin sales report form重写管理员销售报告表
【发布时间】:2011-10-10 20:44:55
【问题描述】:

在我的配置文件中,我可以很容易地用我自己的方式覆盖销售 -> 订单网格

<blocks>
  <adminhtml>
    <rewrite>
      <sales_order_grid>Mine here</sales_order_grid>
    </rewrite>
  </adminhtml>
</blocks>

但我似乎无法对 Reports->Sales->Order 菜单项上的 report_filter_form 执行相同操作。如果我用

替换上面的重写内容
<report_filter_form>mine here</report_filter_form>

这是一个特例还是什么。我已经清除了我的缓存并且没有运气。通过执行 ->getBlock('grid.filter.form') 将块加载到控制器中,然后将其输入 initReportAction 并最终呈现布局。

【问题讨论】:

    标签: magento magento-1.5


    【解决方案1】:

    查看布局文件我看到了这个:

    <block type="sales/adminhtml_report_filter_form_order" name="grid.filter.form">
    

    所以需要覆盖的块是sales/adminhtml_report_filter_form_order

    <blocks>
      <sales>
        <rewrite>
          <adminhtml_report_filter_form_order>Mine here</adminhtml_report_filter_form_order>
        </rewrite>
      </sales>
    </blocks>
    

    【讨论】:

    • 谢谢,我现在明白这是如何确定的,但我没有那么幸运跟踪 getBlock('report_sales_sales.grid') 使用和加载的网格。对那个有帮助吗?我尝试在整个代码库中搜索块名称,但找不到。
    • 网格是一种特殊情况。 “网格容器”通常在布局中正常定义,它有一个$_controller 成员变量(在本例中为"report_sales_sales"),用于自动创建网格块。在这种情况下,容器是“adminhtml/report_sales_sales”,因此网格是“adminhtml/report_sales_sales_grid”。
    • 作为一种更通用的查找类的方法,有一种使用block hints in admin的方法。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-20
    相关资源
    最近更新 更多