2

i'm creating a module that allows the customer to edit their order if it hasn't reach the processing stage, so far everything works however on the order history page i have these 3 links

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]/

to make things look neat i tried to change my link to match the previous 2 by changing the <frontName> of my module to sales in config.xml and chnages the mymodulefrontname to sales, while that's worked for my link problem is that now the first 2 links now go to 404 pages

is there a way i can get my module to have the same frontname as Mage_Sales without causing conflicts

4

1 に答える 1

5

Magento introduced the ability to add directories under existing frontnames in Magento 1.3 [link].

The appropriate syntax in your case would be:

<frontend>
    <routers>
        <sales>
            <args>
                <modules>
                    <arbitrary after="Mage_Sales">Your_Module_Sales</arbitrary>
                    <!-- points to Your/Module/controllers/Sales/ -->
                </modules>
            </args>
        </sales>
    </routers>
</frontend>

Create an OrderController.php class in the matching directory with an editAction() method and you are in business.

As a matter of style, the above config would start matching routes in the Sales subdirectory under your module's controllers directory. I prefer to keep these types of controllers separated; you may choose a different subdirectory or choose to not use one at all.

于 2013-03-05T00:53:00.040 に答える