5

Magentoadminpanelの私のモジュールにはhttp: //example.com/index.php/mymodule/ ...のようなURLがあり、注文を含むカスタムグリッドが含まれています。ユーザーがグリッド行をクリックしたときに、標準の「注文ビュー」ページにリダイレクトしたいと思います。

public function getRowUrl($row)
{
    if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
        return $this->getUrl('sales_order/view', array('order_id' => $row->getId()));
    }
    return false;
}

しかし、このURLはhttp://example.com/index.php/ admin / sales_order / view/ ...ではなくhttp: //example.com/index.php/sales_order/view/...を指しています。何か提案はありますか?

UPD。config.xml

<admin>
    <routers>
        <mymodule>
            <use>admin</use>
            <args>
                <module>Foo_Mymodule</module>
                <frontName>mymodule</frontName>
            </args>
        </mymodule>
    </routers>
</admin>
4

1 に答える 1

7

単純に に置き換える必要がありsales_order/viewます*/sales_order/view。手段は、管理者にある現在の*ルーターを使用しますadminhtml

編集
詳細を説明するには、これを構成に入れます。

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <mymodule after="Mage_Adminhtml">Foo_Mymodule_Adminhtml</mymodule>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

これで、値*/mymodule/indexによって URL が生成され、http://example.com/index.php/admin/mymodule/indexそれがファイルをロードしFoo/Mymodule/controllers/Adminhtml/MymoduleController.phpてメソッドを見つけようとしますFoo_Mymodule_Adminhtml_MymoduleController::indexAction()。メソッドが存在する場合は実行されます。存在しない場合は、管理ルーターが引き継ぎ、404 を表示するか、ダッシュボードにリダイレクトします。

于 2011-09-05T10:12:09.537 に答える