wolmat Posted August 23, 2006 Share Posted August 23, 2006 Hello Chemo, thanx for this great contribution. The shop works much faster than before! BUT there ist a little problem with the tax calculation... If a user is logged in, the price is without tax! I have two geo_zone_ids - id=1 for EU incl. German Tax and id=2 for world without taxes... It is exactly the same, if a user is logged in...wherever he come from. The tax class should distinguish if the logged user is from the EU and should show the prices with taxes or if the user is from a "world-country" and show them without taxes :( :( I have installed the "Optimize tep_get_tax_rate() v1.1" contribution correctly and turned on the configuration value "Display Prices with Tax = true". Please help :blush: thanx :) Sorry for my bad English ;) Quote Link to comment Share on other sites More sharing options...
wolmat Posted August 24, 2006 Share Posted August 24, 2006 @all Could somebody help me, please! I got really a problem with this class!!! Thanx :) Quote Link to comment Share on other sites More sharing options...
wolmat Posted August 27, 2006 Share Posted August 27, 2006 I was blind :( What a mistake *gggg* stupid wolmat... Quote Link to comment Share on other sites More sharing options...
Andreas2003 Posted August 31, 2006 Share Posted August 31, 2006 Have also a problem with my general.php. I receive an error message Fatal error: Call to a member function on a non-object in /srv/www/htdocs/shop/includes/functions/general.php on line 336 I have several other contribs installed like shopping cart enhancement etc. I know, thats always written here, that the MS3-taxclass is not affecting other contribs. Is there a way how I can find out, what causes a.m. error message ? Thanks in advance, kind regards Andreas Quote Link to comment Share on other sites More sharing options...
aHfUi Posted September 28, 2006 Share Posted September 28, 2006 Shopping Cart more Fatal error: Call to a member function on a non-object in /home/XXXX/public_html/shopping/includes/functions/general.php on line 310 Hi all, I found this error msg when i click " add to cart" button ... And this is insuction for line 310 of general.php (red color part) //// // Returns the tax rate for a zone / class // TABLES: tax_rates, zones_to_geo_zones function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) { global $customer_zone_id, $customer_country_id, $osC_Tax; [color=#FF0000]return $osC_Tax->getTaxRate($class_id, $country_id, $zone_id);[/color] } //// // Return the tax description for a zone / class // TABLES: tax_rates; function tep_get_tax_description($class_id, $country_id, $zone_id) { global $osC_Tax; return $osC_Tax->getTaxRateDescription($class_id, $country_id, $zone_id); } Anybody can help me check what wrong i doing @@? Quote Link to comment Share on other sites More sharing options...
aHfUi Posted September 28, 2006 Share Posted September 28, 2006 Finally, i get the solution ... This is from what chemo posted before Special to who install page cache and Optimization of tep_get_tax_rate Move the tax class initialization code above the page cache code (currently below it). So, it should look like this: // tax class require('includes/classes/tax.php'); $osC_Tax = new osC_Tax; /*--------------------------------------------------------*\ # Page cache contribution - by Chemo # Define the pages to be cached in the $cache_pages array \*--------------------------------------------------------*/ $cache_pages = array('index.php', 'product_info.php', 'conditions.php', 'contact_us.php', 'privacy.php'); #$cache_pages = array('index.php'); if (!tep_session_is_registered('customer_id') && ENABLE_PAGE_CACHE == 'true') { # Start the output buffer for the shopping cart ob_start(); require(DIR_WS_BOXES . 'shopping_cart.php'); $cart_cache = ob_get_clean(); # End the output buffer for cart and save as $cart_cache string # Loop through the $cache_pages array and start caching if found foreach ($cache_pages as $index => $page){ if ( strpos($_SERVER['PHP_SELF'], $page) ){ include_once(DIR_WS_CLASSES . 'page_cache.php'); $page_cache = new page_cache($cart_cache); # The cache timelife can be set globally in the settings # Example below sets it for 60 minutes # $page_cache->cache_this_page(60); $page_cache->cache_this_page(); } # End if } # End foreach } # End if *Information is come from: http://www.oscommerce.com/forums/lofiversion/i...hp/t119114.html Quote Link to comment Share on other sites More sharing options...
kev@num Posted December 6, 2006 Share Posted December 6, 2006 (edited) i'd love to install this contribution, i uploaded the latest tax.php into the correct place and followed the install instructions from the newest i could find with them but receive this error: Fatal error: Call to a member function on a non-object in /home/***/shopincludes/functions/general.php on line 420 i see a previous fix for this which is moving the application_top part up above a CACHE mod, but i do not have this on my store.. does anyone have any ideas about what i can do? thanks in advance :) kev. Edited December 6, 2006 by kev@num Quote Link to comment Share on other sites More sharing options...
kev@num Posted December 6, 2006 Share Posted December 6, 2006 (edited) woohoo... this helped me: got the same error -particularly if a customer was logged in. I solved it my moving the following: require('includes/classes/tax.php'); $osC_Tax = new osC_Tax; from the bottom of application_top.php (as instructed) to just below: // currency if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) { if (!tep_session_is_registered('currency')) tep_session_register('currency'); if (isset($HTTP_GET_VARS['currency'])) { if (!$currency = tep_currency_exists($HTTP_GET_VARS['currency'])) $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } else { $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } } Edited December 6, 2006 by kev@num Quote Link to comment Share on other sites More sharing options...
kev@num Posted December 6, 2006 Share Posted December 6, 2006 hello! it's speeded up my shop now, but previouly when logged in it showed prices including tax.. is there anyway to still show prices like this? i've uploaded the lastest version from aug 2006 with the fix but it doesn't work for me.. Quote Link to comment Share on other sites More sharing options...
gardenho Posted February 15, 2008 Share Posted February 15, 2008 Just a note to say I installed this today and tested thoroughly on ms2.2 and it works a treat. I installed Chemo's vers 1.1 dated Nov 24/04 and then replaced the tax.php file with the latest version dated aug.27/06 from xmanflash. Just thought I'd make a note here of a recent installation for those wondering if it works due to the problems noted here. Also worth mentioning it is an extremely easy contrib to install, my shop has 56 contribs installed total to date and this interfered with NOTHING - don't be afraid to use it, the speeds are fantastic! Quote Link to comment Share on other sites More sharing options...
Dennisra Posted March 9, 2008 Share Posted March 9, 2008 Works for me also. Just a note to say I installed this today and tested thoroughly on ms2.2 and it works a treat. I installed Chemo's vers 1.1 dated Nov 24/04 and then replaced the tax.php file with the latest version dated aug.27/06 from xmanflash. Just thought I'd make a note here of a recent installation for those wondering if it works due to the problems noted here. Also worth mentioning it is an extremely easy contrib to install, my shop has 56 contribs installed total to date and this interfered with NOTHING - don't be afraid to use it, the speeds are fantastic! Quote Link to comment Share on other sites More sharing options...
scranmer Posted July 21, 2008 Share Posted July 21, 2008 (edited) Hi all, anyone else find that when the customer logs in the VAT is then lost from the "whats in my cart"? this is because the customer has logged in and their address has not been selected yet. fix is as follows, I just commented out the offending line and replaced it with the next in catalog\includes\classes\tax.php (line29)... // class methods function getTaxRate($class_id, $country_id = -1, $zone_id = -1) { if ( ($country_id == -1) && ($zone_id == -1) ) { //// if (!tep_session_is_registered('customer_id')) { if (!tep_session_is_registered('customer_id') || $customer_country_id=="") { $country_id = STORE_COUNTRY; $zone_id = STORE_ZONE; } else { $country_id = $customer_country_id; $zone_id = $customer_zone_id; } } HTH Si. Edited July 21, 2008 by Jan Zonjee Quote Link to comment Share on other sites More sharing options...
scranmer Posted July 21, 2008 Share Posted July 21, 2008 (edited) OR even better use the global values function getTaxRate($class_id, $country_id = -1, $zone_id = -1) { global $customer_zone_id, $customer_country_id; //new line to fix tax login issue if ( ($country_id == -1) && ($zone_id == -1) ) { if (!tep_session_is_registered('customer_id')) { $country_id = STORE_COUNTRY; $zone_id = STORE_ZONE; } else { $country_id = $customer_country_id; $zone_id = $customer_zone_id; } } Si. Edited July 21, 2008 by scranmer Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted July 21, 2008 Share Posted July 21, 2008 OR even better use the global values Exactly the fix xmanflash added to that contribution 2 years ago.... (????) Quote Link to comment Share on other sites More sharing options...
lazylex Posted November 1, 2008 Share Posted November 1, 2008 Does anyone has this problem: Prices are visable include TAX. Customer logs in: Prices are still visable include TAX Customer changes address in address book: prices are visable EX TAX. Even when original address is not changed and only saved: prices are visable without tax. Curious if anyone has this problem and off course if anyone has the solution... Regards, Alex Quote Link to comment Share on other sites More sharing options...
dvharrison Posted June 9, 2009 Share Posted June 9, 2009 I want to use this add-on so I can get Sage CSV working. However, I am having trouble modifying the includes/functions/general.php page. Basically its asking me to add: REPLACE tep_get_tax_rate() it with this code: function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) { global $customer_zone_id, $customer_country_id, $osC_Tax; return $osC_Tax->getTaxRate($class_id, $country_id, $zone_id); } When I have listed: function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) { global $customer_zone_id, $customer_country_id; if ( ($country_id == -1) && ($zone_id == -1) ) { if (!tep_session_is_registered('customer_id')) { $country_id = STORE_COUNTRY; $zone_id = STORE_ZONE; } else { $country_id = $customer_country_id; $zone_id = $customer_zone_id; } } $tax_query = tep_db_query("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' group by tr.tax_priority"); if (tep_db_num_rows($tax_query)) { $tax_multiplier = 1.0; while ($tax = tep_db_fetch_array($tax_query)) { $tax_multiplier *= 1.0 + ($tax['tax_rate'] / 100); } return ($tax_multiplier - 1.0) * 100; } else { return 0; } } and function tep_get_tax_description($class_id, $country_id, $zone_id) {global $osC_Tax; return $osC_Tax->getTaxRateDescription($class_id, $country_id, $zone_id); } When I have: function tep_get_tax_description($class_id, $country_id, $zone_id) { $tax_query = tep_db_query("select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' order by tr.tax_priority"); if (tep_db_num_rows($tax_query)) { $tax_description = ''; while ($tax = tep_db_fetch_array($tax_query)) { $tax_description .= $tax['tax_description'] . ' + '; } $tax_description = substr($tax_description, 0, -3); return $tax_description; } else { return TEXT_UNKNOWN_TAX_RATE; } } I have multi shipping zones basically spanning the english and scottish islands. Is this not going to disrupt it? if so, is there an alternative I can add? Any help gratefully received. TIA Quote Debbie Harrison Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 9, 2009 Share Posted June 9, 2009 I want to use this add-on so I can get Sage CSV working. However, I am having trouble modifying the includes/functions/general.php page. I have multi shipping zones basically spanning the english and scottish islands. Is this not going to disrupt it? if so, is there an alternative I can add? Those queries have been moved to the class tax. You can compare the queries and see if they are the same as in general.php (I think they are). The difference is the class tax "remembers" a tax rate and returns the stored rate when asked for it instead of doing a query every time. Quote Link to comment Share on other sites More sharing options...
Mort-lemur Posted May 16, 2010 Share Posted May 16, 2010 Those queries have been moved to the class tax. You can compare the queries and see if they are the same as in general.php (I think they are). The difference is the class tax "remembers" a tax rate and returns the stored rate when asked for it instead of doing a query every time. Hi, Coming into this late I know, but I have the same problem with multi geo-zone shipping, I don't understand your post above - should I be modifying the general.php file or not? as my code does not match that posted in the contribution. Thanks Quote Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members. Link to comment Share on other sites More sharing options...
Mort-lemur Posted May 16, 2010 Share Posted May 16, 2010 Sorry - ignore my post - found the answer on chemo's thread Quote Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members. Link to comment Share on other sites More sharing options...
spoofy Posted October 29, 2010 Share Posted October 29, 2010 Just wanted to confirm and see if there is still a need to use this add-on in rc2.2a or 2.3? Quote My Contributions: Google XML Sitemap SEO compatible with Ultimate SEO URL by FWR Media ::: Accurate & Precise Bread Crumb Trail Link to comment Share on other sites More sharing options...
Jan Zonjee Posted October 30, 2010 Share Posted October 30, 2010 Just wanted to confirm and see if there is still a need to use this add-on in rc2.2a or 2.3? A better version of it (along the lines Chemo posted elsewhere) has been added to 2.3. If you can find the download of 2.3 on Github you just need to change two functions in includes/functions/general.php to get the functionality this addon brings. Quote Link to comment Share on other sites More sharing options...
spoofy Posted October 30, 2010 Share Posted October 30, 2010 A better version of it (along the lines Chemo posted elsewhere) has been added to 2.3. If you can find the download of 2.3 on Github you just need to change two functions in includes/functions/general.php to get the functionality this addon brings. ah I see..well since I am using 2.3 downloaded from github I guess I am all set then.. Thanks! Quote My Contributions: Google XML Sitemap SEO compatible with Ultimate SEO URL by FWR Media ::: Accurate & Precise Bread Crumb Trail Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.