开发者

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

开发者 https://www.devze.com 2023-04-07 12:52 出处:网络
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. Pleas

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.

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

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.

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

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->__cons开发者_JAVA技巧truct(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.

0

精彩评论

暂无评论...
验证码 换一张
取 消