2014-02-08 73 views
0

我正在爲銷售訂單網格添加一個新的批量操作,並且在爲我的操作放入網址時,Magento無法找到我的控制器。Magento getURL未找到自定義模塊的控制器

config.xml中

<admin> 
    <routers> 
     <mymodule> 
     <use>admin</use> 
     <args> 
      <module>Namespace_mymodule</module> 
      <frontName>frontendname</frontName> 
     </args> 
     </mymodule> 
    </routers> 
</admin> 

<global> 
    <events> 
     <adminhtml_block_html_before> 
     <observers> 
      <mymodule> 
      <class>Namespace_mymodule_Model_Observer</class> 
      <method>addActions</method> 
      </mymodule> 
     </observers> 
     </adminhtml_block_html_before> 
    </events> 
</global> 

observer.php

public function addActions($event) 
{ 
    $block = $event->getBlock(); 
    if($block instanceof Mage_Adminhtml_Block_Sales_Order_Grid) 
    { 
     $block->getMassactionBlock()->addItem('cpsync', array(
      'label' => 'Push Orders to CounterPoint', 
      'url' => Mage::helper("adminhtml")->getUrl("frontendname/adminhtml_index/push/") 
     )); 
    } 
} 

每當我試着用我大規模行動將其發送給我一個404重定向頁面,網址

sitename.com/ index.php/frontendname/adminhtml_index/push/key/

+0

您可能會對我的免費/開源「Better 404」模塊感興趣。它用404代替了Magento的標準404頁面,其中包含了Magento認爲無法找到你的頁面的診斷信息。 http://alanstorm.com/magento-404-debug –

回答

0

我認爲你的config.xml是錯誤的。在上面的config.xml中,你沒有提到關於模型,塊或助手類。你剛纔宣佈了關於該模塊和一個事件。這是您必須遵循的基本config.xml。嘗試修改你的config.xml如下。

<?xml version="1.0"?> 
<config> 
    <modules> 
     <Test_Helloworld> 
      <version>0.1.0</version> 
     </Test_Helloworld> 
    </modules> 
    <frontend> 
     <routers> 
      <helloworld> 
       <use>standard</use> 
       <args> 
        <module>Test_Helloworld</module> 
        <frontName>helloworld</frontName> 
       </args> 
      </helloworld> 
     </routers> 
     <layout> 
      <updates> 
       <helloworld> 
        <file>helloworld.xml</file> 
       </helloworld> 
      </updates> 
     </layout> 
    </frontend> 
    <global> 
     <blocks> 
      <helloworld> 
       <class>Test_Helloworld_Block</class> 
      </helloworld> 
     </blocks> 
     <helpers> 
      <helloworld> 
       <class>Test_Helloworld_Helper</class> 
      </helloworld> 
     </helpers> 
    </global> 
</config> 
+0

嗨,我不認爲有必要包括,但我有像你這樣的人。仍然沒有任何工作。 –