gpt4 book ai didi

php - 让 2 个模块在 magento 中使用相同的 frontname

转载 作者:行者123 更新时间:2023-12-02 05:12:23 25 4
gpt4 key购买 nike

我正在创建一个模块,允许客户在订单尚未进入处理阶段时编辑他们的订单,到目前为止一切正常,但是在订单历史记录页面上我有这 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]/

为了让事情看起来整洁,我尝试通过更改 <frontName> 来更改我的链接以匹配前 2 个链接将我的模块添加到 config.xml 中并更改 mymodulefrontnamesales ,虽然这对我的链接问题有效,但现在前 2 个链接现在转到 404 页

有没有一种方法可以让我的模块与 Mage_Sales 具有相同的 frontname 而不会引起冲突

最佳答案

Magento introduced the ability to add directories under existing frontnames in 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>

使用 editAction() 方法在匹配目录中创建一个 OrderController.php 类,您就可以开始工作了。

作为一种风格,上面的配置将开始匹配模块的 controllers 目录下的 Sales 子目录中的路由。我更喜欢将这些类型的 Controller 分开;您可以选择不同的子目录或选择根本不使用一个子目录。

关于php - 让 2 个模块在 magento 中使用相同的 frontname,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15212753/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com