Magento Adminhtml覆盖模块不起作用 [英] Magento Adminhtml override module not working
问题描述
从我的最后一个问题开始,我被困在尝试进行覆盖.我正是MudithaE在在这里所做的回答.
Stemming from my last question, I am stumped trying to do an override. I am doing exactly what MudithaE's answer here did, too.
我想实现在文件app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php
中找到的自己的_prepareColumns()
.我按如下所示设置模块的目录和文件.在研究过程中,我看到许多开发人员喜欢使用Dev_Module_Block_Adminhtml_blah
,因此我尝试在代码的各处更改目录结构和类名.没变化.我的Cycleworks_SalesGridImproved模块也出现在系统->配置->高级列表中.
I want to implement my own _prepareColumns()
as found in the file app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php
. I set up my module's directories and the files as below. While researching, I saw a lot of developers like to do Dev_Module_Block_Adminhtml_blah
, so I tried changing the directory structure and class names everywhere in my code. No change. My Cycleworks_SalesGridImproved module appears in the System -> Config -> Advanced listing, too.
文件:
app/code/local/Cycleworks/SalesGridImproved/Adminhtml/Block/Sales/Order/Grid.php
:
<?php
class Cycleworks_SalesGridImproved_Adminhtml_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid {
protected function _prepareColumns() // tried public too
{
parent::_prepareColumns();
...
...
$this->addColumn('created_at', array(
'header' => Mage::helper('sales')->__('Purchased On'),
'index' => 'created_at',
'type' => 'datetime',
'format' => 'MMM d, h:mm a',
'width' => '165px',
));
...
...
return $this;
}
}
app/code/local/Cycleworks/SalesGridImproved/etc/config.xml
:
<?xml version="1.0"?>
<config>
<modules>
<!-- also tried: Cycleworks_SalesGridImproved -->
<Cycleworks_Adminhtml>
<version>0.0.01</version>
</Cycleworks_Adminhtml>
</modules>
<global>
<blocks>
<adminhtml>
<salesgridimproved>
<class>Cycleworks_SalesGridImproved_Adminhtml_Block_Sales_Order_Grid</class>
</salesgridimproved>
<rewrite>
<sales_order_grid>Cycleworks_SalesGridImproved_Adminhtml_Block_Sales_Order_Grid</sales_order_grid>
</rewrite>
</adminhtml>
</blocks>
</global>
</config>
在/app/etc/modules/Cycleworks_SalesGridImproved.xml
中:
<?xml version="1.0"?>
<config>
<modules>
<Cycleworks_SalesGridImproved>
<active>true</active>
<codePool>local</codePool>
</Cycleworks_SalesGridImproved>
</modules>
</config>
请让我看看我想念的是什么...谢谢!
Please show me see what I'm missing... Thanks!
更新:
仅发现扩展名EM_DeleteOrder还覆盖了与我相同的销售订单网格类.他的扩展程序配置比我的扩展程序复杂,因为他的扩展程序被设置为在Mage核心之前被调用. config.xml肯定很忙!
Just found out the extension EM_DeleteOrder is also overriding the same sales order grid class that I am. His extension's configuration is more complicated than mine, as his is set up to be called before the Mage core. The config.xml sure is busy!
<?xml version="1.0"?>
<config>
<modules>
<EM_DeleteOrder>
<version>1.0.0</version>
</EM_DeleteOrder>
</modules>
<global>
<rewrite>
<em_emadmin_adminhtml_sales_order>
<from><![CDATA[#/admin/sales_order/#]]></from>
<to>/emadmin/adminhtml_sales_order/</to>
</em_emadmin_adminhtml_sales_order>
</rewrite>
<blocks>
<adminhtml>
<rewrite>
<sales_order_grid>EM_DeleteOrder_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
</rewrite>
</adminhtml>
</blocks>
</global>
<admin>
<routers>
<em_deleteorder>
<use>admin</use>
<args>
<module>EM_DeleteOrder</module>
<frontName>emadmin</frontName>
</args>
</em_deleteorder>
<adminhtml>
<args>
<modules>
<EM_DeleteOrder_Adminhtml before="Mage_Adminhtml">EM_DeleteOrder_Adminhtml</EM_DeleteOrder_Adminhtml>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
您是否有想法如何使用类似的语法并让我的模块正常工作,而不必破解他的代码?像after="Mage_Adminhtml"
一样?
Do you have any thoughts how I can use similar syntax and get my module to work and not have to hack his code? Like with an after="Mage_Adminhtml"
?
最终更新: 可悲的是,下面的3个答案不是答案,这是扩展冲突.我将回答我自己的问题并将其标记为已回答.
Final Update: Sadly, the 3 answers below weren't the answer, it was the extension conflict. I'll answer my own question and mark it answered.
推荐答案
我正在回答自己,因为这是扩展冲突及其解决方案中的重要一课.此外,我学到了很多关于特定安装的知识,以及草率的扩展如何破坏一切.
I'm answering myself, as this was a big lesson in extension conflicts and their resolution. Further, I learned a lot about our particular installation and how sloppy extensions can break everything.
与更新一样, EM_DeleteOrder 覆盖了Adminhtml大宗销售订单网格(absog
).我还使用了扩展名 MDN_ExtensionConflict ,虽然它没有检测到我的确切冲突,但确实向我表明EM_DeleteOrder正在使用absog
.我搜索了一些扩展名,这些扩展名允许在不使用absog
的情况下删除订单,这必须是简单的方法.
As in the update, EM_DeleteOrder was overriding Adminhtml Block Sales Order Grid (absog
). I also used the extension MDN_ExtensionConflict and while it wasn't detecting my exact conflict, it did show me that EM_DeleteOrder was using absog
. I searched for extensions that would allow deletion of orders without using absog
, which must be the easy way to go about it.
扩展名 Asperience_DeleteAllOrders 可以做到这一点,而不会覆盖整个页面,而是捕获了路由器中的某些内容.它的config.xml
对我来说是抽象艺术,因此,如果您是高级开发人员,我想您会比我更欣赏他的工作.
The extension Asperience_DeleteAllOrders manages to do this without overwriting the whole page and instead catches something in the router. Its config.xml
is abstract art to me, so if you're an advanced developer, I think you'd appreciate his work more than I.
最终,我找到了 MageWorx_ExtendedOrders ,它用自己的网格替换了整个absog
,并具有可配置的其他列.包括自定义运输费率,订单编辑,订单删除和订单存档. 149美元的扩展价给我留下了深刻的印象.我还将删除由 MageWorx_ExtendedOrders 替换的多个扩展名.我正在破解其扩展程序的代码,以按期望的顺序排列各列并更新日期格式(并且我将与他们分享我的更改,作为功能建议).
Ultimately, I found MageWorx_ExtendedOrders which replaces the entire absog
with their own grid and has configurable additional columns. Included are custom shipping rates, order editing, deletion of orders, and order archiving. I am impressed with this extension for $149. I also am going through deleting the multiple extensions that were replaced with MageWorx_ExtendedOrders. I'm hacking their extension's code to put the columns in my desired order and to update the date format (and I'll share my changes with them as feature suggestions).
这篇关于Magento Adminhtml覆盖模块不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!