Overwrite CompareController

I am trying to override Core CompareController. Somehow I don't understand. I did some research on the Magento website: http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/how_to_overload_a_controller

But it didn't help to override the controller.

local / wp / compare / etc. /config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <WP_Compare>
            <version>0.1.0</version>
        </WP_Compare>
    </modules>
    <global>
        <rewrite>
            <WP_Compare_Catalog_Product_Compare>
                <from><![CDATA[#^/catalog/product/compare/#]]></from>
                <to>/compare/catalog/product/compare/</to>
            </WP_Compare_Catalog_Product_Compare>
        </rewrite>
    </global>
</config>

      

local / wp / directory / controllers / product / CompareController.php

<?php

require_once "Mage/Catalog/controllers/Product/CompareController.php";
class WP_Compare_Catalog_Product_CompareController extends Mage_Catalog_Product_CompareController
{

    public function addAction()
    {
        echo 'Lets GO!';
    }

}

?>

      

Can anyone help me with this problem?

Thank.

Gr. Lex

+3


source to share


2 answers


This is the solution for my problem.



<?xml version="1.0"?>
<config>
    <modules>
       <WP_Compare>
           <version>0.1.0</version>
       </WP_Compare>
    </modules>
    <frontend>
        <routers>
            <catalog>
                <use>standard</use>
                <args>
                    <modules>
                        <WP_Compare before="Mage_Catalog">WP_Compare_Catalog</WP_Compare>
                    </modules>
                </args>
            </catalog>
        </routers>
    </frontend>
</config>

      

+4


source


You may need to do something similar to yours, etc. xml:



 <frontend>
  <routers>
     <customer>
        <args>
           <modules>
              <Mymodule_Customer before="Mage_Customer">Mymodule_Customer</Mymodule_Customer>
           </modules>
        </args>
     </customer>
  </routers>
</frontend>

      

-1


source







All Articles