• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 995
  • Last Modified:

magento override sendfriend controller

I need to override a core controller on Magento 1.6 community edition.  The controller I am trying to override is Sendfriend one titled ProductController.php.  I have followed various examples on the web and have got nowhere so I am turning to you for help...

So far I have this.

In app/etc/modules I have placed the file TIC_Sendfriend.xml

 
<?xml version="1.0"?>
<config>
    <modules>
        <TIC_Sendfriend>
            <active>true</active>
            <codePool>local</codePool>
        </TIC_Sendfriend>
    </modules>
</config>

Open in new window


In code/local/TIC/Sendfriend/etc I have placed the file config.xml

 
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
  <TIC_Sendfriend>
    <version>0.0.1</version>
  </TIC_Sendfriend>
</modules>
<frontend>
  <routers>
    <sendfriend>
      <args>
        <modules>
          <TIC_Sendfriend before="Mage_Sendfriend">TIC_Sendfriend</TIC_Sendfriend>
        </modules>
      </args>
    </sendfriend>
  </routers>
</frontend>
</config>

Open in new window


And finally in code/local/TIC/Sendfriend/controllers I have placed the file ProductController.php

Which begins:

require_once("Mage/Sendfriend/controllers/ProductController.php");

class TIC_Sendfriend_ProductController extends Mage_Sendfriend_ProductController

Open in new window


Whatever I place in this ProductController.php file is ignored and the core code is used instead.  Please can someone help me identify what I am doing wrong?

Kind regards,

Will
0
wgstjf
Asked:
wgstjf
  • 3
1 Solution
 
miked2004Commented:
looks like modules should just be module

<modules>
          <TIC_Sendfriend before="Mage_Sendfriend">TIC_Sendfriend</TIC_Sendfriend>
        </modules>

Open in new window

0
 
miked2004Commented:
<module>
     <TIC_Sendfriend before="Mage_Sendfriend">TIC_Sendfriend</TIC_Sendfriend>
</module>

Open in new window

0
 
miked2004Commented:
Or may be you need to reference the controller. Info taken from here: http://www.magentothem.com/archives/1437

<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
  <TIC_Sendfriend>
    <version>0.0.1</version>
  </TIC_Sendfriend>
</modules>
<frontend>
  <routers>
    <sendfriend>
      <args>
        <modules>
          <tic_sendfriend before="Mage_Sendfriend_ProductController">TIC_Sendfriend_Product</tic_sendfriend>
        </modules>
      </args>
    </sendfriend>
  </routers>
</frontend>
</config>

Open in new window

0
 
wgstjfAuthor Commented:
Mike,

Thanks so much for your reply.  It is now working!  

The problem was partly due to the lack of referencing the controller and partly due to incorrect folder hierarchy. The problem was eventually solved by going through the tutorial that you provided a link for so the solution was provided by you.  Thanks for saving my sanity!

Cheers,

Will
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now