0
votes

I'm in the middle of writing some code to possibly extend some modules in Magento, and while I was writing a class to extend the Mage_Adminhtml_Promo_QuoteController, I came across to an error when I testing my class's controller action by using the url: http://127.0.0.1/magenta_demo/index.php/pricebeat_admin/adminhtml_quote/generatecoupon. It's my localhost

The error outputted on the browser was:

Fatal error: Class 'Mage_Adminhtml_Promo_QuoteController' not found in /Applications/XAMPP/xamppfiles/htdocs/magenta_demo/app/code/local/Pricebeat/controllers/Adminhtml/QuoteController.php on line 3

However, when go to my IDE and click on the Mage_Adminhtml_Promo_QuoteController to go that class from the new class I created, it takes me there with no problem.

Here is the code.

class Pricebeat_Adminhtml_QuoteController extends Mage_Adminhtml_Promo_QuoteController
{
        public function generateCouponAction(){
            echo 'Hello world. This is just testing.';
            exit;
        }
}

Unless I am doing something wrong with the directly structure, Is there anything wrong with the code at the moment that keeps on giving me this message?

One more thing. I checked my system log and the message outputted was:

2012-10-06T12:00:31+00:00 ERR (3): Warning: include(Mage/Adminhtml/Promo/QuoteController.php) [function.include]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/magenta_demo/lib/Varien/Autoload.php on line 95 2012-10-06T12:00:31+00:00 ERR (3): Warning: include() [function.include]: Failed opening 'Mage/Adminhtml/Promo/QuoteController.php' for inclusion (include_path='/Applications/XAMPP/xamppfiles/htdocs/magenta_demo/app/code/local:/Applications/XAMPP/xamppfiles/htdocs/magenta_demo/app/code/community:/Applications/XAMPP/xamppfiles/htdocs/magenta_demo/app/code/core:/Applications/XAMPP/xamppfiles/htdocs/magenta_demo/lib:.:/Applications/XAMPP/xamppfiles/lib/php:/Applications/XAMPP/xamppfiles/lib/php/pear') in /Applications/XAMPP/xamppfiles/htdocs/magenta_demo/lib/Varien/Autoload.php on line 95

Any help would be greatly appreciated.

Thanks guys

1

1 Answers

1
votes

Ok I found my problem. Here's the link to refer to the source. http://prattski.com/2010/06/24/magento-overriding-core-files-blocks-models-resources-controllers/

Jesus....

You have to explicitly include the file of the controller class you are overriding.