本文介绍了“有错误”。当单击某些Silverstripe管理页面时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解决某些Silverstripe管理页面的问题。每当我单击购物车或示例产品页面时,都会弹出消息出现错误,并且该页面不会显示。请参阅所附图片。

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.

关于
Sam

RegardsSam

点击Firefox控制台消息

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)将您的网站置于开发模式(如果尚未开发):

1) Put your site into development mode (if it isn't already): http://doc.silverstripe.org/sapphire/en/topics/debugging#dev-mode

2)记录错误(服务器端):

2) Log errors (server-side): http://doc.silverstripe.org/sapphire/en/topics/error-handling#filesystem-logs

这将帮助您使用服务器侧错误(听起来很像 500错误)-您应该在日志文件中找到与其相关的条目。如果这只是客户端/ JS,您将需要更深入地研究萤火虫...

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).

这篇关于“有错误”。当单击某些Silverstripe管理页面时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 22:36