I m stuck with

Fatal error: Maximum function nesting level of '400'reached

in magento version When i recalculate total in sales_quote_collect_totals_after event.The code of observer is as below

public function recalculateTotal($observer){


and the same error occur when i submit my custom form.but if i change form method POST to GET it works fine.

I can't understand what's going inside it.Please can somebody get out from it.

1 Answer 1


The problem is the following:

  • collectTotals function in app/code/core/Mage/Sales/Model/Quote.php triggers the sales_quote_collect_totals_after event
  • sales_quote_collect_totals_after event triggers your recalculateTotal observer function
  • your recalculateTotal function calls collectTotals
  • and so on, resulting in an infinite loop

My suggestion:

I'm not sure the reason why you wrote this line:


But changing it to:


Will fix the infinite loop issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.