单击某些Silverstripe管理页面时“出现错误”

时间:2011-09-26 20:25:33

标签: php content-management-system silverstripe

我正在尝试修复一些Silverstripe管理页面的问题。每次当我点击购物车或示例产品页面时,弹出消息 - “有一个错误”,页面将不会显示。请参阅附图。

enter image description here

如您所见,购物车和示例产品的图标与其他图标不同。我自己没有编写代码,我以前从未体验过这个代码,所以对于我应该从哪里开始解决这个问题的任何建议都将不胜感激。

如果你能告诉我哪一部分,我可以在这里复制一些代码。非常感谢你的时间。

此致 萨姆

单击“购物车”页面时的Firefox控制台消息。

enter image description here

控制台响应选项卡下的其他错误消息:

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>

2 个答案:

答案 0 :(得分:1)

这可能有很多原因,请尝试以下两件事:

1)将您的网站置于开发模式(如果尚未进入):http://doc.silverstripe.org/sapphire/en/topics/debugging#dev-mode

2)记录错误(服务器端):http://doc.silverstripe.org/sapphire/en/topics/error-handling#filesystem-logs

这将帮助您解决服务器端错误(以及“出现错误/ 500”的声音) - 您应该在日志文件中找到与其相关的条目。如果它只是一个客户端/ JS的东西,你需要深入了解firebug ...

不要担心页面树中的图标,这是一项功能(有关简要说明,请参阅http://www.ssbits.com/snippets/2009/spice-up-your-cms-sitetree/)。

答案 1 :(得分:0)

从我看到的,你必须检查定义你的购物车页面的PHP类。最有可能的是,你有错误或错误的东西。

  

对singleton()的错误类 - ProductImageObject

这是我们的线索。请尝试检查Product.php的第125行。