方法Mage_Checkout_Block_Cart_Sidebar :: canApplyMsrp(Array())无效

时间:2013-12-26 11:03:34

标签: php magento magento-1.5

我在结帐时遇到magento 1.5.1.0版本的严重错误。有人能帮助我吗? 发生错误当我启用显示购物车边栏时,

Invalid method Mage_Checkout_Block_Cart_Sidebar::canApplyMsrp(Array
  (
  )
  )

  Trace:
  #0 /home5/bunnygla/public_html/app/design/frontend/default/helloresponsive/template/hellothemes/mini_cart.phtml(60): Varien_Object->__call('canApplyMsrp', Array)

  #1 /home5/bunnygla/public_html/app/design/frontend/default/helloresponsive/template/hellothemes/mini_cart.phtml(60): Mage_Checkout_Block_Cart_Sidebar->canApplyMsrp()

  #2 /home5/bunnygla/public_html/includes/src/__default.php(2976): include('/home5/bunnygla...')

  #3 /home5/bunnygla/public_html/includes/src/__default.php(3007): Mage_Core_Block_Template->fetchView('frontend/defaul...')

  #4 /home5/bunnygla/public_html/includes/src/__default.php(3021): Mage_Core_Block_Template->renderView()

  #5 /home5/bunnygla/public_html/includes/src/__default.php(2312): Mage_Core_Block_Template->_toHtml()

  #6 /home5/bunnygla/public_html/includes/src/__default.php(2079): Mage_Core_Block_Abstract->toHtml()

  #7 /home5/bunnygla/public_html/includes/src/__default.php(2030): Mage_Core_Block_Abstract->_getChildHtml('miniCart', true)

  #8 /home5/bunnygla/public_html/app/design/frontend/default/helloresponsive/template/page/html/header.phtml(67): Mage_Core_Block_Abstract->getChildHtml('miniCart')

  #9 /home5/bunnygla/public_html/includes/src/__default.php(2976): include('/home5/bunnygla...')

  #10 /home5/bunnygla/public_html/includes/src/__default.php(3007): Mage_Core_Block_Template->fetchView('frontend/defaul...')

  #11 /home5/bunnygla/public_html/includes/src/__default.php(3021): Mage_Core_Block_Template->renderView()

  #12 /home5/bunnygla/public_html/includes/src/__default.php(2312): Mage_Core_Block_Template->_toHtml()

  #13 /home5/bunnygla/public_html/includes/src/__default.php(2079): Mage_Core_Block_Abstract->toHtml()

  #14 /home5/bunnygla/public_html/includes/src/__default.php(2030): Mage_Core_Block_Abstract->_getChildHtml('header', true)

  #15 /home5/bunnygla/public_html/app/design/frontend/default/helloresponsive/template/page/homepage.phtml(123): Mage_Core_Block_Abstract->getChildHtml('header')

  #16 /home5/bunnygla/public_html/includes/src/__default.php(2976): include('/home5/bunnygla...')

  #17 /home5/bunnygla/public_html/includes/src/__default.php(3007): Mage_Core_Block_Template->fetchView('frontend/defaul...')

  #18 /home5/bunnygla/public_html/includes/src/__default.php(3021): Mage_Core_Block_Template->renderView()

  #19 /home5/bunnygla/public_html/includes/src/__default.php(2312): Mage_Core_Block_Template->_toHtml()

  #20 /home5/bunnygla/public_html/includes/src/__default.php(25560): Mage_Core_Block_Abstract->toHtml()

  #21 /home5/bunnygla/public_html/includes/src/__default.php(12333): Mage_Core_Model_Layout->getOutput()

  #22 /home5/bunnygla/public_html/includes/src/__default.php(9938): Mage_Core_Controller_Varien_Action->renderLayout()

  #23 /home5/bunnygla/public_html/includes/src/__default.php(9860): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')

  #24 /home5/bunnygla/public_html/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')

  #25 /home5/bunnygla/public_html/includes/src/__default.php(12362): Mage_Cms_IndexController->indexAction()

  #26 /home5/bunnygla/public_html/includes/src/__default.php(16512): Mage_Core_Controller_Varien_Action->dispatch('index')

  #27 /home5/bunnygla/public_html/includes/src/__default.php(16109): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
  #28 /home5/bunnygla/public_html/includes/src/__default.php(18506): Mage_Core_Controller_Varien_Front->dispatch()
  #29 /home5/bunnygla/public_html/app/Mage.php(627): Mage_Core_Model_App->run(Array)
  #30 /home5/bunnygla/public_html/index.php(89): Mage::run('', 'store')
  #31 {main}

2 个答案:

答案 0 :(得分:1)

原因:

Mage_Catalog_Helper_Data :: canApplyMsrp()方法是自Magento 1.6版本实现以来,尝试在早期的Magento版本中使用此方法,如Magento 1.5.1.0或Magento 1.5.0.1将导致致命错误。

我假设错误是在文件位置 Mage_Catalog_Helper_Data :: canApplyMsrp()模板/ checkout / cart / item / default.phtml中引起的

解决方案是检查方法 canApplyMsrp 是否存在,如下所示

更改

$canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(),Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);

if (method_exists(Mage::helper('catalog')->canApplyMsrp))
$canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(),Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);

我希望它有所帮助..

答案 1 :(得分:0)

@supal:实际上你的编译器已启用。请禁用它或重新编译。对于这个goto管理员>工具>编译器。禁用它并清除整个缓存。