opencart/opencart — pull request #992 by faaliyet (2013-11-13 22:42:41+00:00)
Title: Optimized Tax

Since every product on the page needs to be calculated
($this->tax->calculate) for its tax rate, tax library hits 3 complex SQL
query per product.

So, lets say customer lists 100 products using the listing option and
lets say modules such as featured, latest, special, cart, bestseller are
listing around 10 products for each.

So all they are hitting around (100 x 3) + (10 x 5(number of modules) x
3) = 300 + 150 = 450 complex SQL Queries.

But this tax library fixes this count to ONLY 1. So you save 449 queries
and it only recalculates tax rates when payment, shipping or store
address changed.

The idea from https://github.com/opencart/opencart/pull/763/files, but
mine is much more optimized as well as framework standards and sql query
counts.

PS: Tested