firegento/firegento-germansetup — pull request #43 by Vinai (2012-08-02 12:20:01+00:00)
Title: Avoid getQuote() on the session if quote hasn't been initialized yet

If the customer switches the store currency, `collectTotals()` is called on the quote model by the session before the quote is set on the session.
This means calls to `Mage::getSingleton('checkout/session')->getQuote()` will again instantiate and load a new quote model, on which will then try to collect the totals, resulting in an endless loop.

For this reason `Mage::getSingleton('checkout/session')->getQuote()` cannot be used by the tax/config model, unless the quote is already available on the checkout/session.

This fix works around the problem by simulating an empty quote items array, so the rewritten class will simply use the default shipping tax id.

Loading the quote item collection directly doesn't work without instantiating and loading the quote model manually, which would add a lot of overload.
Since the shipping totals are only displayed in the cart, where there is no currency switcher (by default), all should be good though.
If this solution isn't good enough, I would suggest creating a resource model that manually selects the tax classes from the quote item products, so that even though it's additional queries, they are minimized and optimized.