获得2个模块在magento中使用相同的名字

Mem*_*r-X 2 php routes magento

我正在创建一个模块,允许客户编辑他们的订单,如果它还没有到达处理阶段,到目前为止一切正常,但在订单历史页面上我有这3个链接

View Order        | http://www.site.com/Current-Build/sales/order/view/order_id/[ID]/
Reorder           | http://www.site.com/Current-Build/sales/order/reorder/order_id/[ID]/
Edit Order (mine) | http://www.site.com/Current-Build/mymodulefrontname/order/edit/order_id/[ID]/
Run Code Online (Sandbox Code Playgroud)

为了让事情看起来整洁,我试图改变我的链接以匹配之前的2,通过将<frontName>我的模块更改为config.xml中的销售和chnages mymodulefrontnameto sales,虽然这对我的链接问题有效,现在前2个链接现在转到404页

有没有办法让我的模块与Mage_Sales具有相同的名称而不会引起冲突

ben*_*rks 5

Magento 在Magento 1.3 [link]中引入了在现有正名下添加目录的功能.

您的案例中的适当语法是:

<frontend>
    <routers>
        <sales>
            <args>
                <modules>
                    <arbitrary after="Mage_Sales">Your_Module_Sales</arbitrary>
                    <!-- points to Your/Module/controllers/Sales/ -->
                </modules>
            </args>
        </sales>
    </routers>
</frontend>
Run Code Online (Sandbox Code Playgroud)

使用方法在匹配目录中创建一个OrderController.php类,editAction()并且您可以开展业务.

作为样式,上面的配置将开始匹配模块的controllers目录下的Sales子目录中的路由.我更喜欢将这些类型的控制器分开; 您可以选择不同的子目录或选择不使用一个子目录.