2

In a shop using Idev_OneStepCheckout I need to override the deleteAction. OSC doesn't do this, but it does override Mage_Checkout_CartController, only for the _goBack() method. The shop also has a storeview that uses the standard OnePage checkout from Magento.

So, unfortunately, I can't do:

<frontend>
  <routers>
     <checkout>
       <args>
         <modules>
           <MyNameSpace_MyModule before="Idev_OneStepCheckout">MyNameSpace_MyModule_OneStepCheckout</MyNameSpace_MyModule>
           <MyNameSpace_MyModule before="Mage_Checkout">MyNameSpace_MyModule</MyNameSpace_MyModule>
         </modules>
       </args>
     </checkout>
   </routers>
 </frontend>

Well, I can, but my module isn't called in the OSC case. Disabling either makes it work for the checkout in question, so I know my code is correct. Do I have to resort to a rewrite of /checkout/cart/delete for the onepage case or is there a more elegant solution?

1

I'm not sure I follow all your concerns, so apologies if this doesn't answer your question, but I'd approach this by

  1. Creating a custom module

  2. Adding a <modules/>/before="Idev_OneStepCheckout" "rewrite"

  3. Have your new controller class extend the specific Idev_OneStepCheckout you're after

With the above in place you'll have the exact same functionality as you currently do, and then can replace whatever methods you want.

Instead of thinking of these as controller rewrites, it helps to think of them like this

When a request for a URL that looks like /checkout/... comes in, here's a list of module to look for controllers in

So you're not replacing controller files, you'll telling Magento "use my controller instead". Then, if your controller extends the older controller, you get the same behavior. A subtle different, but sometimes it helps people understand what's going on better. The Idev folks did this for their module — if you do it for yours and tell Magento to check it first (i.e. the before) you should be set.

2
  • Yes, this is exactly how I did it. Guess I'll have to dig deeper why things don't work with the other store view. Thanks for confirming this is the right way to do it. – Melvyn Apr 12 '14 at 19:18
  • Alan, can you please put code with explain??? – Amit Bera Apr 13 '14 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.