Magento Forum

No luck overriding DownloadController
 
wryterra
Jr. Member
 
Total Posts:  2
Joined:  2011-01-27
 

I’ve read the Wiki, searched the forum, I’m still having no luck.

I have a cml_All.xml which does work, as it shows cml_s3 in the modules list in Magento.

I have an /app/code/local/cml/s3/etc/config.xml file that reads:

<?xml version="1.0"?>
<config>
    <
modules>
        <
cml_s3>
            <
version>0.1.0</version>
        </
cml_s3>
    </
modules>
    <global>
        <!-- 
This rewrite rule could be added to the database instead -->
        <
rewrite>
            <!-- 
This is an identifier for your rewrite that should be unique -->
            <!-- 
THIS IS THE CLASSNAME IN YOUR OWN CONTROLLER -->
            <
cml_s3_downloadable_download>
                <
from><![CDATA[#^/downloadable/download/#]]></from>
                
<to>/s3/downloadable_download/</to>
            </
cml_s3_downloadable_download>
        </
rewrite>
    </global>
    <
frontend>
        <
routers>
            <
mynamespace_mymodule>
                <use>
standard</use>
                <
args>
                    <
module>cml_s3</module>
                    <!-- 
This is used when "catching" the rewrite above -->
                    <
frontName>s3</frontName>
                </
args>
            </
cml_s3>
        </
routers>
    </
frontend>
</
config>

and I have an /app/code/local/cml/s3/controllers/DownloadableController.php that reads:

<?php
require("Mage/Downloadable/controllers/DownloadController.php");
class 
cml_s3_DownloadController extends Mage_Downloadable_DownloadController
{
   
// Taken from http://www.magentocommerce.com/bug-tracking/issue?issue=5452
   
public function linkAction()
   
{
        
print 'w00t';
   
}
}

What am I doing wrong? It’s doing my nut.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagePsycho
Moderator
 
Avatar
Total Posts:  1702
Joined:  2009-06-23
 

REF: http://www.magentocommerce.com/boards/viewthread/218515/#t297676

Let me know if that helps.

 
Magento Community Magento Community
Magento Community
Magento Community
 
wryterra
Jr. Member
 
Total Posts:  2
Joined:  2011-01-27
 

Thanks for the reply, unfortunately it doesn’t seem to have helped. My config.xml now reads:

<?xml version="1.0"?>
<config>
    <
frontend>
        <
routers>
            <
downloadable>
                <
args>
                    <
modules>
                        <
cml_s3 before="Mage_Downloadable">cml_s3_Overwrite_Downloadable</cml_s3>
                    </
modules>
                </
args>
            </
downloadable>
        </
routers>
    </
frontend>
</
config>

However, I still get the normal download linkAction.

 
Magento Community Magento Community
Magento Community
Magento Community
 
srenon
Jr. Member
 
Total Posts:  3
Joined:  2011-12-21
 

Your naming convention seem to be incorrect

/app/code/local/cml/s3/etc/config.xml

should be

/app/code/local/Cml/S3/etc/config.xml

Should be

<?php
require("Mage/Downloadable/controllers/DownloadController.php");
class 
Cml_S3_DownloadController extends Mage_Downloadable_DownloadController
{
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top