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
Legend: 
Download

Report
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..
When I installed this contrib, it worked fine until users logged in as members and my GST tax rate started returning 0 instead of 10%
I looked at the support forum and the fix was shown by Ted - http://forums.oscommerce.com/index.php?showtopic=110585&st=20&p=627360&#entry627360
Here it is for all those who might tread that same path and not bother looking at the support forum..
The included file is only the replacement for catalogincludesfunctionstax.php
Thanks to Chemo for all his wonderful work and diligent help to users who want more and better out of osCommerce...
And Thanks also to the folks who made osCommerce initially, may MS3 be much more efficient, and SOON! :-)
Previous upload by by Alex Norden is incorrect and SHOULD not be installed. It will break the functions and may render the store with fatal errors.
Follow the instructions contained in this package for MS2 installs.
It may have been a problem with improper pre tags for code that presented the problems to Alex. I have corrected this.
I had a problem with the install instructions of the previous package.
the changes to my ms2 should be done without the
} at the end of functions. If the previous install does not work for you, try this.
Note- you don't need to download the zip with this contrip, use the previous one.
<h3 class="install">STEP 3 - Edit includes/functions/general.php</h3>
<blockquote>
<strong class="highlight">REPLACE tep_get_tax_rate()</strong> it with this code:
<p class="code">
function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {<br>
global $customer_zone_id, $customer_country_id, $osC_Tax;<br>
return $osC_Tax->getTaxRate($class_id, $country_id, $zone_id);<br>
</p>
<strong class="highlight">REPLACE tep_get_tax_description()</strong> it with this code:
<p class="code">
function tep_get_tax_description($class_id, $country_id, $zone_id) {<br>
global $osC_Tax;<br>
return $osC_Tax->getTaxRateDescription($class_id, $country_id, $zone_id);<br>
</p>
</blockquote>
Uses the elegant MS3 tax class for the MS2 codebase.
This makes the install instructions more clear.
Also, I included a quick debug tool that is handy for this contribution and anything else that comes. It outputs the session and cookie globals.
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