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

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.

Related

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
{
}

OpenCart can't add or edit product

My OpenCart version 1.5.6 and I'm not using vQmod.
So recently I added one custom product field. This tutorial helped me to do that
http://forum.opencart.com/viewtopic.php?f=22&t=36625#p181916
Now, when I'm trying to add a new product to store this error appears:
Fatal error: Call to undefined method ModelCatalogCategory::getAllCategories() in C:\apache\localhost\www\webshop.kg\admin\controller\catalog\product.php on line 1018
If I'm trying to edit already existing product these two errors appear:
Notice: Undefined index: seo_title in C:\apache\localhost\www\webshop.kg\admin\model\catalog\product.php on line 456Notice: Undefined index: seo_h1 in C:\apache\localhost\www\webshop.kg\admin\model\catalog\product.php on line 457
Fatal error: Call to undefined method ModelCatalogCategory::getAllCategories() in C:\apache\localhost\www\webshop.kg\admin\controller\catalog\product.php on line 1018
What possible reason could create such a behavior?
Thank you for your attention.
The problem is within your controller as the model in admin/model/catalog/category.php does not contain a method getAllCategories() (unless you added it there which is not a case because of the fatal error) - it contains only the method getCategories().
Furthermore your Undefined index notices are saying that within your product model (lines 456 and 457) you are relying on the presence of the indexes seo_title and seo_h1 but they are not set.
I do not know the code you have modified in admin/model/catalog/product.php but you should use something like this:
if(isset($data['seo_title'])) { /* do setting of seo title */ } /* else { do not set this } */
if(isset($data['seo_h1'])) { /* do setting of seo h1 */ } /* else { do not set this } */
Maybe posting the method reliable for storing new or updating existing product code would be more helpful...
The model in admin/model/catalog/category.php does not contain a method getAllCategories(). So you need to define it in category model.
public function getAllCateories() {
$query = "WRITE YOUR QUERY";
}

Fatal error: Call to a member function in product.php

I am new to opencart, so please help me.
I am using opencart version 1.5.6, now whenever I edit and delete the product it shows me
Fatal error: Call to a member function productUpdateListen() on a non-object in /home/crazepur/public_html/admin/controller/catalog/product.php on line 78
and
Fatal error: Call to a member function deleteProduct() on a non-object in /home/crazepur/public_html/admin/controller/catalog/product.php on line 133 respectively.
Although it edit and delete the product.
Please help me how to fix it.
Code in Line 78 $this->openbay->productUpdateListen($this->request->get['product_id'], $this->request->post);
And code in line 133 $this->openbay->deleteProduct($product_id);
This means $this->openbay is not an object which contains function productUpdateListen() & deleteProduct(), probably it's NULL or false in some cases (nothing found) due to it's not accessible. Out of scope.
Try
var_dump($this->openbay);
Check the O/P
it's simple and the error-message says it all: your $this->openbay doesn't have those methods (productUpdateListen() and deleteProduct()) - most likely it isn't an object at all.
please debug your code since it's impossible to say what's going wrong wich so little information. to start, do a var_dump($this->openbay); right before the function-calls and check the output.

Magento: Mage_Adminhtml_Promo_QuoteController not found?

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.

Symfony2 - How to delete/move an entity?

I am learning symfony2 and atfer creating some Doctrine Entities in a bundle, I wanted to move them.
However, after moving, and changing any instances of them being referenced, I was getting errors when trying to run my application.
I moved them back, and everything was fine.
Now I am just tyring to remove them completly, but again, I get errors when doing so.
Any help on removing Entities entirely?
I did exactly the same thing that Mr Pablo did, but for a bundle : I moved a bundle (renamed) and modified all calls to it.
I have the same error :
ErrorException: Catchable Fatal Error: Object of class __PHP_Incomplete_Class could not be converted to string in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php line 70
in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php line 65
at ErrorHandler->handle() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php line 70
at AbstractToken->getUsername() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php line 56
at SecurityDataCollector->collect() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/Profiler/Profiler.php line 174
at Profiler->collect() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php line 90
at ProfilerListener->onKernelResponse()
at call_user_func() in /Volumes/Data/home/timi/Sites/symfony2/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php line 82
at TraceableEventDispatcher->doDispatch() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 3678
at EventDispatcher->dispatch() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 4754
at ContainerAwareEventDispatcher->dispatch() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 3904
at HttpKernel->filterResponse() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 3896
at HttpKernel->handleRaw() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 3846
at HttpKernel->handle() in /Volumes/Data/home/timi/Sites/symfony2/app/cache/dev/classes.php line 4791
at HttpKernel->handle() in /Volumes/Data/home/timi/Sites/symfony2/app/bootstrap.php.cache line 547
at Kernel->handle() in /Volumes/Data/home/timi/Sites/symfony2/web/app_dev.php line 20
Some help will be very welcomed :)
EDIT:
Well I solved the problem, Adam Stacey had heard it well :)
Before changing anything, I was logged in the website, by using FOSUserBundle firewall.
By changing the name of the bundle, it fooled the firewall and it was stuck at line 70 of ./vendor/symfony/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php
Here is the function :
public function getUsername()
{
if ($this->user instanceof UserInterface) {
return $this->user->getUsername();
}
return (string) $this->user;
}
So I commented out the line return (string) $this->user;, reloaded the webpage, logged out, than reverted the comment. And voilĂ  !
What kind of errors were you getting?
Make sure you:
Clear cache
Rebuild database
Don't have any entity relationships with it
Don't have any code based on the entities
Like Inori mentioned have you tried rebuilding your entities?
If not try this from the CLI:
php app/console doctrine:generate:entities Acme
php app/console doctrine:schema:update --force
Replace "Acme" with your name, company name or whatever you have used in your bundles.
The other thing you may have to do is remove any instances where you have used the entities.
For example, you may have some entities in the controllers that look like this:
use Acme\BundleName\Entity\SomeEntity;
use Acme\BundleName\Entity\AnotherEntity;
They will need to be removed.
If you have the details of the particular errors that are coming up let me know what they are and I will try and help you further.
I have heard that this can also sometimes be to do with sessions. Are you using any bundles for authentication or anything like that?
In your php.ini file do you have your set to:
session.auto_start = Off
This may be way off, but worth a go. Let me know.
On a separate note. Did your server setup pass the checks in the app/check.php file that you can run via CLI?

Categories