Magento Catalog ProductController rewrite

后端 未结 1 1247
-上瘾入骨i
-上瘾入骨i 2021-01-24 18:36

I try to override the magento Mage\\Catalog\\controllers\\ProductController.php with a module. In my module i try this:

\\etc\\config.xml


         


        
相关标签:
1条回答
  • 2021-01-24 19:02

    you can use like below

    Edit you Package/Module/etc/config.xml

    <?xml version="1.0"?>
    <config>
    ... Your Other config here ....
       <frontend> 
            <routers> 
              <catalog> 
                 <args> 
                 <modules> 
                    <Package_Catalog before="Mage_Catalog">Package_Catalog</Package_Catalog>
                 </modules> 
                 </args> 
             </catalog> 
           </routers> 
       </frontend> 
    </config>
    

    Now your controller already ready.

    include(Mage::getBaseDir()."/app/code/core/Mage/Catalog/controllers/ProductController.php");
    class Package_Catalog_ProductController extends Mage_Catalog_ProductController
    {
          public function viewAction(){
                 echo __METHOD__;
          }
    }
    ?>
    
    0 讨论(0)
提交回复
热议问题