lildog Posted July 29, 2008 Share Posted July 29, 2008 Has anyone tested a bad address and gotten an email alert? My shippingmodules prevent my code from going that far so it is just speculative code. If anyone could test it it would be great. lildog Link to comment Share on other sites More sharing options...
mivox Posted July 29, 2008 Share Posted July 29, 2008 Has anyone tested a bad address and gotten an email alert? Tested it with the 'bad' Gig Harbor address in the download, and got this error: Parse error: syntax error, unexpected '{' in /usr/www/users/absak/catalog/checkout_process.php on line 270 Line 270 is the 'if' statement to trigger the email: if ((tep_session_is_registered('wa_dest_tax_rate') && ($wa_dest_tax_rate['rate']=='false' || $wa_dest_tax_rate['rate']>0 )) { Link to comment Share on other sites More sharing options...
mivox Posted July 29, 2008 Share Posted July 29, 2008 One addition (hopefully a quick one ;) ) that would be super helpful for me, would be to add an optional line to the DOR failure section at the end of wa_taxes.php file that could be uncommented if you *don't* have an overall store tax rate, but still need to charge tax on WA orders ... I'd add it myself, but I'm not sure of the syntax. Something like this maybe? }else{ //$wa_dest_tax_rate[rate] is false(there was an error from DOR) just continue to use the stores tax //uncomment the next line if you need to charge WA tax, but don't have an overall store tax rate //$wa_dest_tax_rate['9.0000']*100; } Other than the error routine, the contrib seems to be working perfectly on correct addresses! Thanks so much! (It would also be fantastic if, instead of the regular tax rate line on the order confirmation screen, an error would return a configurable message next to the default rate? I'd like to say something like "There was an error calculating WA tax rates. Your tax rate will be corrected before processing.") Link to comment Share on other sites More sharing options...
lildog Posted July 29, 2008 Share Posted July 29, 2008 I think your if statement has too many brackets: the variables are wrong but it does send off an email. I will make the fixes. try this one: if (tep_session_is_registered('wa_dest_tax_rate') && ($wa_dest_tax_rate['rate']=='false' || $wa_dest_tax_rate['rate']>0 )){ if ((tep_session_is_registered('wa_dest_tax_rate') && ($wa_dest_tax_rate['rate']=='false' || $wa_dest_tax_rate['rate']>0 )) { Link to comment Share on other sites More sharing options...
ashkanfd Posted July 29, 2008 Share Posted July 29, 2008 thanks & regards Link to comment Share on other sites More sharing options...
lildog Posted July 29, 2008 Share Posted July 29, 2008 mivox- here is the correct code I think. //uncomment the next line if you need to charge WA tax, but don't have an overall store tax rate //return $wa_dest_tax_rate[rate]=9.0000*100; Link to comment Share on other sites More sharing options...
lildog Posted July 29, 2008 Share Posted July 29, 2008 mivox- I am hesitant to add the change below because most shops I know will automatically process the order when the customer clicks the confirm button, which means: A. The order is held and not processed until the shop owner manually adds the tax OR B. You have to charge the customer again but for the remainder of the tax, for a 100 dollar order for me would be like 4 cents. let me know what you think...if it is generally needed I will add it. lildog (It would also be fantastic if, instead of the regular tax rate line on the order confirmation screen, an error would return a configurable message next to the default rate? I'd like to say something like "There was an error calculating WA tax rates. Your tax rate will be corrected before processing.") Link to comment Share on other sites More sharing options...
lildog Posted July 29, 2008 Share Posted July 29, 2008 uploaded a newer version to reflect the new changes lildog Link to comment Share on other sites More sharing options...
mivox Posted July 29, 2008 Share Posted July 29, 2008 I think your if statement has too many brackets: the variables are wrong but it does send off an email. I will make the fixes. try this one: if (tep_session_is_registered('wa_dest_tax_rate') && ($wa_dest_tax_rate['rate']=='false' || $wa_dest_tax_rate['rate']>0 )){ OK, I updated the code, and am now able to complete an order with a nonexistent address without an error message ... but still no email. Link to comment Share on other sites More sharing options...
mivox Posted July 30, 2008 Share Posted July 30, 2008 mivox- I am hesitant to add the change below because ... Good points ... I'll just try the code out on our store, and if someone else is worried about it, I'm sure they'll check this thread from the URL in the readme file and find it, eh? :-) Link to comment Share on other sites More sharing options...
mivox Posted July 30, 2008 Share Posted July 30, 2008 mivox- here is the correct code I think. //return $wa_dest_tax_rate[rate]=9.0000*100; LOL ... couple decimal places off. That code calculated $11K+ tax instead of $113! Would have had a P.O.'d customer at some point! haha Here's the correct code: //return $wa_dest_tax_rate['rate']=0.0900*100; And, it *does* have to be that *exact* number of decimal places in the rate (before and after the decimal point), for anyone else who's rolling their own tax rate. Link to comment Share on other sites More sharing options...
mivox Posted July 30, 2008 Share Posted July 30, 2008 OK, I updated the code, and am now able to complete an order with a nonexistent address without an error message ... but still no email. Correction: The emails are just seriously delayed ... but they do eventually arrive, a couple hours after the order is placed. So, it's all working! :-) Thanks to everyone who put this contrib together! Link to comment Share on other sites More sharing options...
lildog Posted July 30, 2008 Share Posted July 30, 2008 Whew 11k in taxes. Don't want to make up an error in that! LOL. I will fix that and upload a new version. That is a big mistake! Overdrafts, NSF , Funds not available eeeekk! What a mess. thanks mivox lildog Link to comment Share on other sites More sharing options...
lildog Posted July 30, 2008 Share Posted July 30, 2008 The delay would be caused by your server....do you have a mail log? They were probably just backed up. I am considering adding the tax error message in the checkout confirmation, but it would require Order Editor contribution right? Speaking of which...this is no way at all integrated into the admin side yet. lildog Link to comment Share on other sites More sharing options...
svegliando Posted August 4, 2008 Share Posted August 4, 2008 We have a highly modified implementation of OSC. In addition the store sells both taxable and non-taxable items. I discovered that in catalog/includes/functions/general.php if we check the value of $class_id that is passed to the function tep_get_tax_rate, we could avoid calculating taxes for non-taxable items. It appears that the query (standard OSC code) that follows this does check this value. Again, our implementation is customized so it may not be an issue for others. Hopefully this will help others in a similar situation. Nonetheless, here's the code I used [basically wrapped existing code in if ($class_id != 0) statement]: //BOF WA State Tax Modification if ($class_id != 0){ // if (tep_get_zone_code($customer_country_id, $customer_zone_id, "") == "WA") { //make sure this universal // Changed line above to this one (below) as it did not work for our customized implementation. if (tep_get_zone_code($country_id, $zone_id, "") == "WA") { //make sure this universal //this customer is from Washington State, //so attempt to get their tax rate based on order destination $tax_rate= parse_DOR(); if ($tax_rate!='' && $tax_rate!='0') return $tax_rate ; } } //EOF WA State Tax Modification Link to comment Share on other sites More sharing options...
mivox Posted August 4, 2008 Share Posted August 4, 2008 The delay would be caused by your server....do you have a mail log? They were probably just backed up. Yeah, we have regular intermittent delay problems with our company email, so no worries there. I am considering adding the tax error message in the checkout confirmation, but it would require Order Editor contribution right? Not sure ... what I did was add an extra email send routing in checkout_process.php (by 'borrowing' the SEND_EXTRA_ORDER_EMAILS_TO function) to send a notification to the customer, and edit the error email text to be more "customer friendly". In catalog/checkout_process.php: //BOF WA State Tax Modification if (tep_session_is_registered('wa_dest_tax_rate') && ($wa_dest_tax_rate['rate']=='false' || $wa_dest_tax_rate['rate']>0 )){ //there was a tax error email the store owner $wa_email_body = sprintf(WA_DEST_TAX_ERROR_TEX,$insert_id,$wa_dest_tax_rate['rate']); tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, WA_DEST_TAX_ERROR_SUB, $wa_email_body, WA_DEST_TAX_ERROR_NAME, STORE_OWNER_EMAIL_ADDRESS); if (SEND_EXTRA_ORDER_EMAILS_TO != '') { tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], WA_DEST_TAX_ERROR_SUB, $wa_email_body, WA_DEST_TAX_ERROR_NAME, STORE_OWNER_EMAIL_ADDRESS); } } //EOF WA State Tax Modification In catalog/includes/languages/english/checkout_process.php: //BOF WA State Tax Modification define('WA_DEST_TAX_ERROR_SUB', 'Company Name: Sales Tax Error'); define('WA_DEST_TAX_ERROR_TEX', 'There has been an error calculating the sales tax for your order.' . "\n\n" . 'Either your address could not be found in the Washington State DOR computer, or there was an error connecting to the DOR system.' . "\n\n" . 'We will recalculate the tax amount, and correct the charges before processing your payment.' . "\n\n" . 'Thank you again for your order!' . "\n\n" . 'Company Store Staff' . "\n\n" . '---------------------------' . "\n" . '(Order# %s - Error Code %s)'); define('WA_DEST_TAX_ERROR_NAME', 'Company Online Store'); //EOF WA State Tax Modification Link to comment Share on other sites More sharing options...
lildog Posted August 5, 2008 Share Posted August 5, 2008 Thank you. I only have taxable products so I didn't even think of this. I will add your code into the contrib today. I really appreciate your input. lildog We have a highly modified implementation of OSC. In addition the store sells both taxable and non-taxable items. I discovered that in catalog/includes/functions/general.php if we check the value of $class_id that is passed to the function tep_get_tax_rate, we could avoid calculating taxes for non-taxable items. It appears that the query (standard OSC code) that follows this does check this value. Again, our implementation is customized so it may not be an issue for others. Hopefully this will help others in a similar situation. Nonetheless, here's the code I used [basically wrapped existing code in if ($class_id != 0) statement]: //BOF WA State Tax Modification if ($class_id != 0){ // if (tep_get_zone_code($customer_country_id, $customer_zone_id, "") == "WA") { //make sure this universal // Changed line above to this one (below) as it did not work for our customized implementation. if (tep_get_zone_code($country_id, $zone_id, "") == "WA") { //make sure this universal //this customer is from Washington State, //so attempt to get their tax rate based on order destination $tax_rate= parse_DOR(); if ($tax_rate!='' && $tax_rate!='0') return $tax_rate ; } } //EOF WA State Tax Modification Link to comment Share on other sites More sharing options...
lildog Posted August 5, 2008 Share Posted August 5, 2008 Do you know why // if (tep_get_zone_code($customer_country_id, $customer_zone_id, "") == "WA") { //make sure this universal didn't work for you? Is this something that may cause others problems? We have a highly modified implementation of OSC. In addition the store sells both taxable and non-taxable items. I discovered that in catalog/includes/functions/general.php if we check the value of $class_id that is passed to the function tep_get_tax_rate, we could avoid calculating taxes for non-taxable items. It appears that the query (standard OSC code) that follows this does check this value. Again, our implementation is customized so it may not be an issue for others. Hopefully this will help others in a similar situation. Nonetheless, here's the code I used [basically wrapped existing code in if ($class_id != 0) statement]: //BOF WA State Tax Modification if ($class_id != 0){ // if (tep_get_zone_code($customer_country_id, $customer_zone_id, "") == "WA") { //make sure this universal // Changed line above to this one (below) as it did not work for our customized implementation. if (tep_get_zone_code($country_id, $zone_id, "") == "WA") { //make sure this universal //this customer is from Washington State, //so attempt to get their tax rate based on order destination $tax_rate= parse_DOR(); if ($tax_rate!='' && $tax_rate!='0') return $tax_rate ; } } //EOF WA State Tax Modification Link to comment Share on other sites More sharing options...
lildog Posted August 5, 2008 Share Posted August 5, 2008 Mivox....I think this may be useful for shops with high dollar items where the tax would be substantial. I like your idea. How exactly do you charge the tax to the order? Do the credit cards not get charged until you approve them? Then how do you add the tax to the order? lildog Link to comment Share on other sites More sharing options...
lildog Posted August 5, 2008 Share Posted August 5, 2008 I have uploaded a new version. -- added code to not calculate WA tax for non taxable items-thanks to svegliando -- moved the require for the tax function up in application top to improve compatibility. lildog Link to comment Share on other sites More sharing options...
watermelon Posted August 5, 2008 Share Posted August 5, 2008 Reporting requirement for WA Sales Tax First - lildog thanks so much for all of your hard work on this contribution - Second - I've been reading a bit through this thread about people working on the reporting section of this contribution. Does anyone have some working code that we can begin to test out? Link to comment Share on other sites More sharing options...
lildog Posted August 5, 2008 Share Posted August 5, 2008 There is simple reporting in the newest version. It emails the store owner to let them know there was an error. The code is in the parse_DOR function. lildog Reporting requirement for WA Sales Tax First - lildog thanks so much for all of your hard work on this contribution - Second - I've been reading a bit through this thread about people working on the reporting section of this contribution. Does anyone have some working code that we can begin to test out? Link to comment Share on other sites More sharing options...
mivox Posted August 5, 2008 Share Posted August 5, 2008 How exactly do you charge the tax to the order? Do the credit cards not get charged until you approve them? Then how do you add the tax to the order? We don't use an automatic card processing service. The orders are processed manually, by phone (which is, IMO, also a good idea for any online store selling high-dollar merchandise) ... so we just charge the total amount for the order, including tax and shipping and everything, at that time. Link to comment Share on other sites More sharing options...
watermelon Posted August 5, 2008 Share Posted August 5, 2008 There is simple reporting in the newest version. It emails the store owner to let them know there was an error. The code is in the parse_DOR function. lildog aha - I am thinking not of error reporting but of the requirement that the state of Washington has for reporting tax collected per county per month. The next one is due August 15th. Link to comment Share on other sites More sharing options...
lildog Posted August 7, 2008 Share Posted August 7, 2008 All my accounting is done externally so I don't really use the oscommerce reports. Any examples that would make a good model? Surely there is already one I could modify to fit the bill? lildog Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.