Question

I am facing a serious error in magento version 1.5.1.0 while checkout. can somebody help me? the error occurs When i enable display shopping cart sidebar,

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}
Was it helpful?

Solution

Reason:

Mage_Catalog_Helper_Data::canApplyMsrp() method is implemented since Magento 1.6 version, attempts to use this method in earlier Magento versions, like Magento 1.5.1.0 or Magento 1.5.0.1 will result in fatal error.

I am assuming the error is caused at file location Mage_Catalog_Helper_Data::canApplyMsrp() in template/checkout/cart/item/default.phtml

The solution is to check if the method canApplyMsrp exists like below

Change

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

To

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

I hope it helps..

OTHER TIPS

@supal: actually your compiler is on. Please disable it or recompile. For this goto admin > tools > compiler. Disable it and clear whole cache.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top