Contributions

Other (Category Index)
Search: 

Optimize tep_get_tax_rate() method

This topic is for support of the Optimize tep_get_tax_rate() contribution.

Problem:
Each time a price is displayed on osCommerce the tax rate for that product is queried. Even if the user has set to not display taxes with price the tax rate is queried.

Solution:
Query for each rate one time as it is needed and then store it in session cache.

What this contribution does:
This code change will modify the tep_get_tax_rate() method so the first time a tax rate is requested it stores it in session. On every tax rate query it is first checked to verify if it's already in sesssion and if not will query / store in cache. If it is already in session it will return that value and save the database lookup.

Result:
Reduction in per page query count and faster execution times. Query reduction has been demonstrated to be around 75% savings on some pages.

Tested on:
8 setups with differing server configurations and osC setup. This change should not affect any other contributions.

Install time:
As fast as you can open a file, make one change, and upload.

Enjoy!
=================================
Support for this contribution is here: http://forums.oscommerce.com/index.php?showtopic=110585

Expand All / Collapse All

Fix to class file - logged in users getting 0 tax added..USE THIS ONE! xmanflash 27 Aug 2006

Sorry - the prev file had a text wrap problem which broke the code - I knew I should have not bothered trying to help! :-) anyhow.... Fixed now..

Fix to class file - logged in users getting 0 tax added.. xmanflash 27 Aug 2006
Optimize tep_get_tax_rate() v1.1 Chemo 24 Nov 2004
Simpler Install Instructions Alex Norden 24 Nov 2004
Implement MS3 Tax Class for MS2 Chemo 31 Oct 2004
Optimize tep_get_tax_rate() method v1.1 Bobby 5 Sep 2004
Optimize tep_get_tax_rate() method Chemo 5 Sep 2004

Note: Contributions are used at own risk.