Magento: Mage_Adminhtml_Promo_QuoteController not found? - php

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

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.

Related

( ! ) Fatal error: Cannot redeclare class Google_OAuth2

I want sign up with google plus in codeigniter. I have include files which are required for the php script but I'm getting error
(( ! ) Fatal error: Cannot redeclare class Google_OAuth2 in
D:\wamp\www\Surecash_back\application\libraries\google-plus-api-client-master\src\auth\Google_OAuth2.php
on line 453)
The error message tells you a very simple thing:
You are trying to load\include the same class file more then once
(which results in re-declaring a class name of an already declared class).
The fastest way to check this, will be:
If you are using an autoloader - check your autoloader folder tree for the existance of a file named Google_OAuth2.php
Run a project-wide (all files in your project) search for the string "Google_OAuth2.php" and another search for "class Google_OAuth2", look for any duplicate include(), include_once() or require_once().
(in phpStorm you click Cmd+Shift+F to open the path search, and in the options tab select "Whole project" in Scope.)
See where and if you are including\requiring\autoloading the Google_OAuth2 class file more then one time.
Finally, remove the duplicate.
Hope it helps a bit!

Codeigniter: PHP error on all pages

I have been working on a site using codeigniter. On localhost, everything works well but when I uploaded it online, all its pages got a php error below the footer. The error is as shown below:
A PHP Error was encountered
Severity: Warning
Message: Unknown: failed to open stream: No such file or directory
Filename: Unknown
Line Number: 0
The Controller
class Home extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->helper(array('form','url'));
$this->load->library(array('session'));
$this->load->database();
$this->load->model('property_model');
}
public function index()
{
$data['title'] = "iRent-Home";
$this->load->view('home',$data);
}
}
I thought the error might be caused by the header or footer views since they are loaded on each page. I have counter checked the code in those two views and they look okay. I think it might also be a permissions issue, tried giving several files permission but it didn't work. Anyone with an idea what the problem is?
kindly read the documentation on errors https://ellislab.com/codeigniter/user-guide/general/errors.html and review your code

Trying to load a view in an existing codeigniter application, need advice on the errors Im getting

I just started working on a codeigniter application.
The project is simple I just need to create a view and grab some data from a database.
However I keep getting these error when I try to access the view.
I am not sure what these errors mean.
Here is my code I use to load the view in the default controller class, its a separate function from the index function in that class.
function watchlist(){
$this->load->view("watchlist_view");
}
Here is how I am accessing the view in my browser.
localhost/watchlist/index.php/home/watchlist
Here are the errors Im getting.
A PHP Error was encountered
Severity: Warning
Message: session_start(): open(C:/xampp/session_data/localhost\sess_v4oapdmdqjq0s7b1i5j8mb8u95, O_RDWR) failed: No such file or directory (2)
Filename: helpers/session_helper.php
Line Number: 18
Fatal error: Call to undefined method Home::load() in C:\xampp\htdocs\watchlist\application\controllers\home.php on line 23
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in C:\xampp\htdocs\watchlist\system\libraries\Exceptions.php on line 163
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\watchlist\system\libraries\Exceptions.php on line 163
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in C:\xampp\htdocs\watchlist\system\libraries\Exceptions.php on line 163
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\watchlist\system\libraries\Exceptions.php on line 163
Constructor Home Code
class Home extends Controller
{
var $ministry_name = "Security";
function Home()
{
parent::Controller();
}
function index()
{
Removed local redirect. All sites will now redirect to main site
//Added a check to see if the user is still logged in. If so, remain on the site.
if (!$this->authorization->checklogin())
{
header('Location: http://mainsite.org/');
exit;
}
else
{
redirect("/home/main");
exit();
}
}
function watchlist(){
//Loads watchlist view
$this->load->view("watchlist_view");
}
See https://ellislab.com/codeigniter/user-guide/general/controllers.html#constructors. Here you should extend CI_Controller instead of Controller, and you may use a general constructor __construct() and parent::__constructor(); instead of the old same-name style.

Fatal error: Class 'Camiloo_Amazonimport_Helper_Data' not found in /home/drwakde1/public_html/eshop/app/Mage.php on line 547

I am new to Magento. I just installed Camiloo Global Amazon Integration 2.4.1.0, as soon as I installed it, I am not able to login to my Magento admin. When I enter the login id and password in the admin area, it displays the following error -
Fatal error: Class 'Camiloo_Amazonimport_Helper_Data' not found in
/home/drwakde1/public_html/eshop/app/Mage.php on line 547
I would appreciate your help.
Many thanks,
Nilesh
check if app/code/{local or community}/Camiloo/Amazonimport/Helper/Data.php exits? If not, check your module if it has or not. If not, then simply create a file Data.php under above mentioned path and paste the following code in it:
class Camiloo_Amazonimport_Helper_Data extends Mage_Core_Helper_Abstract
{
}

"There is an error" when clicking on some Silverstripe admin pages

I'm trying to fix a problem with some Silverstripe admin pages. Everytime when I click on Cart or Example product page, the message - "There is an error" pops up, and the page wouldn't show. Please see the attached image.
As you can see page Cart and example product's icons are different from the rest. I didn't write the code myself and I've never experienced this before, so any suggestion on where I should start to tackle the problem would be appreciated.
I can copy some code here if you can tell me which part. Thank you very much for your time.
Regards
Sam
Firefox console message when click on the Cart page.
Additional error message under console response tab:
ERROR [User Error]: Bad class to singleton() - ProductImageObject
IN POST /admin/getitem?ID=17&ajax=1
Line 334 in /home/xxx/subdomains/xxx/sapphire/core/Core.php
Source
======
325: *
326: * #param string $className
327: * #return Object
328: */
329: function singleton($className) {
330: global $_SINGLETONS;
331: if(!isset($className)) user_error("singleton() Called without a class", E_USER_ERROR);
332: if(!is_string($className)) user_error("singleton() passed bad class_name: " .
var_export($className,true), E_USER_ERROR);
333: if(!isset($_SINGLETONS[$className])) {
* 334: if(!class_exists($className)) user_error("Bad class to singleton() - $className",
E_USER_ERROR);
335: $_SINGLETONS[$className] = Object::strong_create($className,null, true);
336: if(!$_SINGLETONS[$className]) user_error("singleton() Unknown class '$className'", E_USER_ERROR);
337: }
338: return $_SINGLETONS[$className];
339: }
340:
Trace
=====
<ul>user_error(Bad class to singleton() - ProductImageObject,256)
line 334 of Core.php
singleton(ProductImageObject)
line 96 of DataObjectManager.php
DataObjectManager->__construct(Product,ProductImages,ProductImageObject,Array,getCMSFields_forPopup,,Created DESC,)
line 48 of FileDataObjectManager.php
FileDataObjectManager->__construct(Product,ProductImages,ProductImageObject,ProductImage,Array,getCMSFields_forPopup)
line 125 of Product.php
Product->getCMSFields(CMSMain)
line 444 of CMSMain.php
CMSMain->getEditForm(17)
line 1021 of LeftAndMain.php
LeftAndMain->EditForm()
line 382 of LeftAndMain.php
LeftAndMain->getitem(SS_HTTPRequest)
line 193 of Controller.php
Controller->handleAction(SS_HTTPRequest)
line 137 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
line 281 of Director.php
Director::handleRequest(SS_HTTPRequest,Session)
line 124 of Director.php
Director::direct(/admin/getitem)
line 127 of main.php
</ul>
This can have many reasons, try 2 things to get started:
1) Put your site into development mode (if it isn't already): http://doc.silverstripe.org/sapphire/en/topics/debugging#dev-mode
2) Log errors (server-side): http://doc.silverstripe.org/sapphire/en/topics/error-handling#filesystem-logs
This will help you with server-side errors (and "there has been an error/500" sounds a lot like it) - you should find an entry related to it in the log file. If it's just a client-side / JS thing, you'll need to dive deeper into firebug...
And don't worry about the icons in the page tree, this is a feature (see http://www.ssbits.com/snippets/2009/spice-up-your-cms-sitetree/ for a brief description).
From what I see, you have to check the PHP class that defines your Cart Page. Most probably, you have misspelled or mistyped something.
Bad class to singleton() - ProductImageObject
This is our clue. Try checking line 125 of Product.php.

Categories