Guest Posted April 28, 2010 Share Posted April 28, 2010 To Whom That Reads: I just recently installed Kiss Error Handling (by FWR). I tackled most of the errors but I have some undefined variables with oscommerce that I would like to fix without messing anything up. Can i just add blank variables at the beggining? Ex. $country_id = ''; Error: Undefined variable: country_id File: includes/functions/general.php Line: 428 Error: Undefined variable: country_id File: includes/functions/general.php Line: 438 Error: Undefined variable: zone_id File: includes/functions/general.php Line: 438 Error: Undefined variable: class_id File: includes/functions/general.php Line: 438 general.php lines 420-447. //// // 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; return $osC_Tax->getTaxRate($class_id, $country_id, $zone_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; } Link to comment Share on other sites More sharing options...
germ Posted April 29, 2010 Share Posted April 29, 2010 //// // 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; return $osC_Tax->getTaxRate($class_id, $country_id, $zone_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; } } Try that. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
MrPhil Posted April 29, 2010 Share Posted April 29, 2010 I don't think either listing is right. The first one ends the function after one executable line, leaving a bunch of orphaned lines. @germ's revision is done after one one line (return), leaving a bunch of code that, while it's now in a function, won't be executed. Something looks very wrong here. Link to comment Share on other sites More sharing options...
germ Posted April 29, 2010 Share Posted April 29, 2010 My only aim was to get rid of the error. I figured if he wanted code in there that would never get executed, that's his busines... :blink: If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
MrPhil Posted April 29, 2010 Share Posted April 29, 2010 I figured if he wanted code in there that would never get executed, that's his busines... Well, obviously he don't know squat about programming, or he would have fixed it himself. He said it was an add-on, so most likely the installation didn't go right, and dropped code in the wrong place. He should be taking this up with FWR. My only aim was to get rid of the error. And I've got a toothache. Can borrow your shotgun to blow my face off? I've always fancied a full face transplant... Link to comment Share on other sites More sharing options...
Guest Posted April 29, 2010 Share Posted April 29, 2010 Thanks for the help guys and I appreciate the conservation on my behalf. I like to think I know a little more then squat about programming as I have written a few mods for my store. However, business is doing good and states are high, any mistake could be very costly. The functions I am referring to are stock for oScommerce I believe. I don't know when they are used and I surely do not want to break them. I just want to simply define the variables in such a way that allows the function to function properly. Thanks for the continued support :) Link to comment Share on other sites More sharing options...
germ Posted April 29, 2010 Share Posted April 29, 2010 Well, obviously he don't know squat about programming, or he would have fixed it himself. He said it was an add-on, so most likely the installation didn't go right, and dropped code in the wrong place. He should be taking this up with FWR. And I've got a toothache. Can borrow your shotgun to blow my face off? I've always fancied a full face transplant... I'll even throw in a couple of 000 buck shells and load it for you - no extra charge. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
Guest Posted April 30, 2010 Share Posted April 30, 2010 O come on guys... Although its quite entertaining to read your messages there is no winning a flame war. Link to comment Share on other sites More sharing options...
MrPhil Posted April 30, 2010 Share Posted April 30, 2010 :rolleyes: Nah, I'm chuckling. Actually, I do have a face that curdles milk, terrifies infants, and sets dogs howling, so almost anything would be an improvement! :thumbsup: @germ and I sometimes do disagree on things, but I'm not holding any grudge against him. Link to comment Share on other sites More sharing options...
germ Posted April 30, 2010 Share Posted April 30, 2010 :rolleyes: Nah, I'm chuckling. Actually, I do have a face that curdles milk, terrifies infants, and sets dogs howling, so almost anything would be an improvement! :thumbsup: @germ and I sometimes do disagree on things, but I'm not holding any grudge against him. No harm - No foul. :) If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
Jack_mcs Posted April 30, 2010 Share Posted April 30, 2010 The functions I am referring to are stock for oScommerce I believe. I don't know when they are used and I surely do not want to break them. I just want to simply define the variables in such a way that allows the function to function properly. The function you posted isn't a stock function and won't work the way it is coded. You might want to compare it against the same function included in the oscommerce package. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Guest Posted May 2, 2010 Share Posted May 2, 2010 The function you posted isn't a stock function and won't work the way it is coded. You might want to compare it against the same function included in the oscommerce package. Jack, I appreciate the help! Your post solved my problem. I assumed it was a stock function as it had no comments nearby. I compared the file against a stock file and learned it had indeed been modified. I tracked the changes and learned it was a tax optimization change by Chemo. I also figured out that I had not followed the instructions correctly when I made the change over a year ago. I re-followed the instructions and everything is golden now. Thanks for everyone's help! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.