2

I'm trying to re-write wishlist controller using following config code

<frontend>
        <routers>
            <wishlist>
                <args>
                    <modules>
                        <Retailon_Wishlist before="Mage_Wishlist">Retailon_Wishlist
                        </Retailon_Wishlist>
                    </modules>
                </args>
            </wishlist>
        </routers>
</frontend>

controller

<?php
   require_once Mage::getModuleDir('controllers', 'Mage_Wishlist') . DS . 'IndexController.php';
class Retailon_Wishlist_IndexController extends Mage_Wishlist_IndexController  {

  Mage::log("arg", null, 'wish.log');
    protected function _addItemToWishList()
    {
        Mage::log("arg2", null, 'wish.log');
// code snippets ...

But this controller is not being called though my module is enabled.

3

Your configurations looks okay for me. However check following things

  • Make sure your module resides in app\code\local\Retailon\Wishlist\
  • Make sure your module have an activation file at app\etc\modules\Retailon_Wishlist.xml
  • Your controller location is app\code\local\Retailon\Wishlist\controllers\IndexController.php

  • Check Qaisar's answer. Make sure there is no space in between. Try to use this.

    <config>
        <frontend>
            <routers>
                <wishlist>
                    <args>
                        <modules>
                            <retailon_wishlist before="Mage_Wishlist">Retailon_Wishlist</retailon_wishlist>
                        </modules>
                    </args>
                </wishlist>
            </routers>
        </frontend>
    </config>
    
  • Last but not least flush your cache.

Some Other Useful Notes

  • Mage::log() usage outside of the function _addItemToWishList() is wrong. It wont invoke by php (php basics);

  • When you try to inspect, make sure the method _addItemToWishList() will get called.

  • Also try to use this: Mage::log("arg2", null, 'wish.log', true); The last parameter will forcefully log the string arg2 in wish.log even if it is in production mode


Here I assume your module resides in local codepool

3

maybe space issue it will be in one line

<Retailon_Wishlist before="Mage_Wishlist">Retailon_Wishlist</Retailon_Wishlist>
  • 1
    good point. Most probably this would be the cause. – Rajeev K Tomy Oct 9 '15 at 6:00
  • 1
    I have delete my answer..because of after page refresh.. i have seen that the same answer already provide by you.good works – Amit Bera Oct 9 '15 at 9:10
1

No need to define override in config.xml.

Just use below code to override:

 require_once Mage::getModuleDir('controllers', 'Mage_Wishlist') . DS . 'IndexController.php';

class Retailon_Wishlist_IndexController extends Mage_Wishlist_IndexController  {
...
  • 1
    Sorry Satish, I didnt understand your answer. OP has his controller defined exactly like this ! – Rajeev K Tomy Oct 9 '15 at 6:01
  • Hi Rajiv, As amit having trouble to override controller using settings in config.xml. So I suggesting to no need to do any configuration in config.xml. Just require once your desired controller file to your module controller file to override it. – Satish Sojitra Oct 9 '15 at 7:06
  • Without specifying rewrite in config.xml, Magento wont going to look for his controller. – Rajeev K Tomy Oct 9 '15 at 7:11
  • I have already did it for newsletter controller and it's working fine for me. We already specifying require_once to add core controller file in our controller file. Just you need to call parent:: method whenever needed. – Satish Sojitra Oct 9 '15 at 7:36
  • @SatishSojitra,does not fulfill amitshree question.....Please read the question clearfully – Amit Bera Oct 9 '15 at 9:01
1

The issue is with your line

<Retailon_Wishlist before="Mage_Wishlist">Retailon_Wishlist
                        </Retailon_Wishlist>

It should be like this

<frontend>
        <routers>
            <wishlist>
                <args>
                    <modules>
                        <Retailon_Wishlist before="Mage_Wishlist">Retailon_Wishlist</Retailon_Wishlist>
                    </modules>
                </args>
            </wishlist>
        </routers>
</frontend>

Remember when you are putting value between xml tag it should not contain any space as magento compare this value

0

Update your config file :-

<frontend>
        <routers>
            <wishlist>
                <args>
                    <modules>
                        <retailon_wishlist before="Mage_Wishlist">Retailon_Wishlist</retailon_wishlist>
                    </modules>
                </args>
            </wishlist>
        </routers>
</frontend>
  • FYI, There is no problem to use Retailon_Wishlist inside module node. – Rajeev K Tomy Oct 9 '15 at 6:02

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.