Author |
Message |
Denny
Newbie
Joined: 17 Jun 2004
Posts: 6
|
 non-taxable items
I plugged the code mentioned in the "othertaxinfo..." file (located in the download section of the free forum) into my cart to make certain items nontaxable (after placing "exempt" in the User5 field in the database), and sure enough those items were not taxed, but the tax was totally screwed up on everything else! Any ideas? Would custom tax logic apply here?
Also I saw mentioned somewhere (darned if I can find it now) you can individually set the tax rate for each item in the database. I wouldn't mind doing this, but I heard the other method was simpler, and I couldn't get that to work.
Any help is appreciated.
Denny
p.s. - I'd like to think I'm not a total idiot, but go ahead & reply to this like I am since I'm NOT a PERL programmer!!!
|
Thu Jun 17, 04 1:41 am |
|
 |
milehightrader
Guest
|
MODERATED
The quoted code below does not work! Don't waste your time trying to make it run. Read the subsequent posts for clarification. A solution to this matter that works is located in the Yahoo! Free Forum in the "Files" section. Posted by Mark S. (Throwaway).
Regards,
Dan
Here is a re-post of some information I found on how to set up tax exempt items.
Quote:This was tested on agoracart v 4.0K-4b Standard. so it
should work fine for all previous versions as well.
if you have customized your tax routine prior to adding
this file you will probably need to make some adjustments
to this file or wherever else it is necessary.
be sure you use a plain text editor to edit these files!
you need to download your store/library/agora_order_lib.pl
via ftp in ascii and make a backup copy just incase things
go wrong. copy from this file everything between the # lines.
then paste and replace the entire "sub calculate_sales_tax"
in the agora_order_lib.pl file. upload and overwrite the
store/library/agora_order_lib.pl via ftp in ascii.
then,
log into your manager and edit the all the products you
need to exempt tax for by adding in user5 the word "exempt"
without the quotes. test for function. you probably should
test with the offline orderform. taxes will not be added
until you declare your state in the orderform and submit.
sub calculate_sales_tax {
local($subtotal) = @_;
local($sales_tax) = 0;
local($tax_form_variable);
local($continue)=1;
local ($inx,$product_id,$my_subtotal,$temp);
local (@my_cart_fields,@my_db_row);
if (!($sc_db_lib_was_loaded =~ /yes/i)) {
&require_supporting_libraries (__FILE__,
__LINE__, "$sc_db_lib_path");
}
&codehook("calc_sales_tax_top");
if ($continue == 0) {
return (&format_price($sales_tax));
}
$tax_form_variable = $form_data{$sc_sales_tax_form_variable};
if ($tax_form_variable eq "") {
$tax_form_variable = $vform{$sc_sales_tax_form_variable};
}
if ($sc_sales_tax_form_variable ne "") {
foreach $value (@sc_sales_tax_form_values) {
if (($value =~
/^${tax_form_variable}$/i) &&
(${tax_form_variable} ne "")) {
open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path",
"calculate tax",__FILE__, __LINE__);
while (<CART>) {
chop;
$temp = $_;
@my_cart_fields = split (/\|/, $temp);
$inx = $cart{"price_after_options"};
$my_subtotal = $my_cart_fields[$inx];
$inx = $cart{"product_id"};
$product_id = $my_cart_fields[$inx];
&check_db_with_product_id($product_id,*my_db_row);
$testval = $my_db_row[$db{"user5"}];
if (!($testval =~ /exempt/i)) {
$sales_tax = $sales_tax + $my_subtotal
* $sc_sales_tax;
}
}
close(CART);
}
}
} else {
open (CART, "$sc_cart_path") || &file_open_error("$sc_cart_path",
"calculate tax",__FILE__, __LINE__);
while (<CART>) {
chop;
$temp = $_;
@my_cart_fields = split (/\|/, $temp);
$inx = $cart{"price_after_options"};
$my_subtotal = $my_cart_fields[$inx];
$inx = $cart{"product_id"};
$product_id = $my_cart_fields[$inx];
&check_db_with_product_id($product_id,*my_db_row);
$testval = $my_db_row[$db{"user5"}];
if (!($testval =~ /exempt/i)) {
$sales_tax = $sales_tax + $my_subtotal
* $sc_sales_tax;
}
}
close(CART);
}
&codehook("calc_sales_tax_bot");
return (&format_price($sales_tax));
}
############################################################
and then I updated the the items that I wanted to be exempt through
the store manager.
|
Thu Jun 17, 04 6:25 am |
|
 |
scottcrew
Moderator
Joined: 13 Feb 2004
Posts: 7516
Location: The West Side of MI USA
|
Ralph,
Looking over this code, perhaps it could also be used for tax exempt ordering when a state reseller's ID is inputted?
But it wouldn't be based on the user 5 field, or any user field of the database, but would be based on a check box being checked on the order form.
Any ideas as to how I might change this snippet of code to do that?
TIA!
_________________ God Bless!
Bonnie - AgoraCart Moderator
Get a Gold Membership
|
Thu Jun 17, 04 2:44 pm |
 |
 |
Denny
Newbie
Joined: 17 Jun 2004
Posts: 6
|
 don't start building on this code yet...
this is the code I used in my cart & couldn't get it to work. I've seen several other posts of others than couldn't get it to work for them, but no posts of users who had it working. So beware.
|
Thu Jun 17, 04 4:18 pm |
|
 |
milehightrader
Guest
|
Hi Bonnie,
Can't help you with that. I don't use any tax logic on my store, as the Tax Manager has everything I need, and haven't had the time to learn the advanced phases. Somewhere in one of the forums, most likely one of the Pro, I think there is some logic for handling reseller accounts, but with my feeble mind I may be dreaming..... <LOL>
|
Thu Jun 17, 04 6:01 pm |
|
 |
milehightrader
Guest
|
Hi Denny,
Thanks for the FYI...... Maybe someone will respond who has found a fix for it.
|
Thu Jun 17, 04 6:11 pm |
|
 |
Dan
Guest
|
 tax exempt
hell-o
that info was posted by me. it was taken directly out of the store/protected/docs.
i elaborated a little on it and tested it. it works! as stated in the message.
if it doesn't work for you then you may have other configurations that are interferring or you have implimented it improperly.
try it again and check your error log in the manager.
tell me what it isn't doing or what is happening.
regards,
dan
|
Fri Jun 18, 04 12:41 pm |
|
 |
Denny
Newbie
Joined: 17 Jun 2004
Posts: 6
|
 tax exempt
I just now did a fresh download & install of the latest version of Agora(just in case I had made a tweak on the last install causeing the problem) , cut & paste the code in the above response (instead of the one in the othertaxinfo...zip file), & got the same response - "exempt" items don't get taxed, taxes are totally off on all other items (with no discernable pattern or tax rate).
Checked error log & it was empty. Perhaps your agora_order_lib.pl was not "stock" before making this change? Dunno. But I'd be very interested in hearing from anyone else getting it to work since I've heard of several unsuccessful attempts.
FYI, the link to the new install is:
http://www.ClickHereForAGreat.com/ecom/store
Tax state is Illinois - 6.75% (taxes worked fine before code modification)
The first Perl book (Learning Perl) is set up as nontaxable.
|
Fri Jun 18, 04 3:42 pm |
|
 |
Dan
Guest
|
hell-o
i went to your store and this is the result i got:
1 Learning Perl $ 20.00
1 Programming Perl (2nd Edition) $ 35.96
Order Totals
Item Cost Subtotal: $ 55.96
Sales Tax: 2.43
Grand Total: $ 58.39
i added learning perl and checked...no tax
then went back and added programming perl and got the above results.
i went back and added more:
1 Learning Perl 5 $ 20.00
1 Programming Perl (2nd Edition) $ 35.96
1 Dynamic HTML: The Definitive Guide $ 31.96
Order Totals
Item Cost Subtotal: $ 87.92
Sales Tax: 4.58
Grand Total: $ 92.50
i went back and removed all items. then added randomly:
1 Learning Perl 5 $ 20.00
1 Perl and CGI for the World Wide Web $ 15.19
1 HTML: The Definitive Guide $ 27.96
1 HTML Goodies $ 15.99
Order Totals
Item Cost Subtotal: $ 79.14
Sales Tax: 3.99
Grand Total: $ 83.13
i went back, removed all items then added items excluding the exempt product:
1 Perl Cookbook $ 31.96
1 Mastering Regular Expressions $ 20.00
1 Dreamweaver 2 Bible $ 31.99
Order Totals
Item Cost Subtotal: $ 83.95
Sales Tax: 5.67
Grand Total: $ 89.62
am i missing something?
regards,
dan
|
Sat Jun 19, 04 12:52 am |
|
 |
Dan
Guest
|
 non taxable
hell-o
denny. are you getting the same incorrect results?
you said:
"taxes are totally off on all other items (with no discernable pattern or tax rate). "
are you still getting those results? what exactly are you doing to get those results?
regards,
dan
|
Sun Jun 20, 04 12:30 pm |
|
 |
Dan
Guest
|
 RE: non taxable
hell-o
hey denny, ya there?
still havin probs with the code? would like to know where you're at with this thing.
regards,
dan
|
Wed Jun 23, 04 7:32 pm |
|
 |
Denny
Newbie
Joined: 17 Jun 2004
Posts: 6
|
Dan - sorry for not responding sooner - for some reason I wasn't notified by email of your response (and I've been checking!!). Perhaps I'm getting a handle on what's going on after I see your test results. There may be a glitch in multiple quantity purchases (haven't tested thoroughly yet, wanted to hurry up & write you due to my delay thus far in doing so).
I notice all your tests have been with a quantity of 1. In the Perl books, I set the price to $20 for the first & last book, the first one tax exempt, the latter taxed. That way, I just buy 5 of each & it's easy to see what tax rate is being levied (tax on $100 at 6.75% is $6.75, etc). Well, here's the kicker, with a $200 purchase (half of which is taxable), the tax should be $6.75, but it comes out as $1.35!!! This, by the way, is the tax on 1 $20 item!! It appears that only single quantities are being taxed on multiple quantity purchases. Check it out man & let me know what you find...
|
Thu Jun 24, 04 1:25 pm |
|
 |
Dan
Guest
|
 RE: non taxable
hell-o
thanks for the response! it's great to get feed back other than "it doesn't work". LOL and thanks for taking the time.
i deleted my posted file from the free forum so as to not waste anyone elses time. i suppose i was too hasty to test it better.
there is a properly scripted hack posted by mark s. he does good work so it's sure to work. think it's in the pro forum. so, since there is an existing working version there's really no sense persuing this one.
apologies to those who attempted to use it!
regards,
dan
probably wouldn't take much to correct it as is though :-))
|
Thu Jun 24, 04 4:18 pm |
|
 |
Denny
Newbie
Joined: 17 Jun 2004
Posts: 6
|
 tax exempt solved???
Hi again Dan
I don't know Perl so I hope this code is legit, but I added the variable $quantity to 2 lines & it seems to work. The 2 lines were both:
$sales_tax = $sales_tax + $my_subtotal * $sc_sales_tax * $quantity;
Also 1 question: isn't the second "$sales_tax +" above unnecessary since it is zeroed out at the top? I want to take it out if not needed.
Later
Denny
|
Fri Jun 25, 04 12:00 am |
|
 |
Denny
Newbie
Joined: 17 Jun 2004
Posts: 6
|
 disregard above post
Never mind - still doesn't work. Time to throw in the towel & belly up to the pro forum bar.
Denny
|
Fri Jun 25, 04 12:35 am |
|
 |
camlawblog
Newbie
Joined: 26 Nov 2004
Posts: 8
|
Does this code work or not? I tried it for www.yinstyle.com since in MA clothing under $175 (for example, our jackets) are exempt. It didn't work. Any advice?
_________________ Michael H. Cohen
www.camlawblog.com
|
Thu Dec 16, 04 7:59 pm |
|
 |
ewelin
Guest
|
i'm not sure if it works... but Mark created a nice exemptoin hack that's available to lifetime members.... from what i gather it works like a charm
|
Thu Dec 16, 04 8:01 pm |
|
 |
camlawblog
Newbie
Joined: 26 Nov 2004
Posts: 8
|
sorry if this seems naiive ... but where would that be found? If I'm in agora pro am I a Lifetime member?
_________________ Michael H. Cohen
www.camlawblog.com
|
Thu Dec 16, 04 8:14 pm |
|
 |
camlawblog
Newbie
Joined: 26 Nov 2004
Posts: 8
|
Is this it? calculate_sales_tax_override.pl in the mas hysteria files of yahoo groups? I copied code into the agora_order_lib.pl ...
Still doesn't work...
_________________ Michael H. Cohen
www.camlawblog.com
|
Thu Dec 16, 04 8:26 pm |
|
 |
ewelin
Guest
|
from Yahoo Pro Forum files section:
mas_hysteria/mas_count_me_out.zip
|
Thu Dec 16, 04 8:28 pm |
|
 |
Dan
Guest
|
hell-o
the code had a minor flaw in it. someone apparently posted a fix but i failed to see it before deleting the file from the yahoo! free forum.
as eric said mark had recoded the routine so it wasn't so clunky. his version was a result on my non working version which is why i opted to delete mine.
i believe you can find it in the yahoo! free forum under the "files" link.
regards,
dan
|
Fri Dec 17, 04 3:19 am |
|
 |
camlawblog
Newbie
Joined: 26 Nov 2004
Posts: 8
|
Just to be clear:
Use "count me out.zip" which is the correct file?
_________________ Michael H. Cohen
www.camlawblog.com
|
Sat Dec 18, 04 7:20 pm |
|
 |
ewelin
Guest
|
yuppers that be the one you want
|
Sat Dec 18, 04 10:05 pm |
|
 |
mylo
Newbie
Joined: 03 Mar 2005
Posts: 4
|
 Can't find the file
Dan wrote:hell-o
the code had a minor flaw in it. someone apparently posted a fix but i failed to see it before deleting the file from the yahoo! free forum.
as eric said mark had recoded the routine so it wasn't so clunky. his version was a result on my non working version which is why i opted to delete mine.
i believe you can find it in the yahoo! free forum under the "files" link.
regards,
dan
Dan - I don't seem to see the file. Is it somewhere else? I offer gift certificates that aren't taxable.
Thanks,
Mylo
|
Fri Mar 04, 05 4:38 pm |
|
 |
Dan
Guest
|
 RE: Can't find the file
hell-o
aparrently this hack is in the pro forum files section.
"calculate_sales_tax_override.pl"
maybe i will resurrect my version and apply the suggested fix. it will need extensive testing. or, just become a lifer and have access to a bunch of cool hacks and stuff.
regards,
dan
|
Sat Mar 05, 05 4:00 am |
|
 |
|