radical hacks WebBBS File Attachment Enhancements Multiple Taxes for Web Store By & Milan C. Shah

This hack was worked out by Guinevere Orvis and Milan on the Web Store discussion board. Here is how to calculate different taxes depending on what state or province the order is going to.

Guinevere says to do the following:

In web_store_order_lib.pl, go down to the subroutine that calculates your sales tax. This should read:

sub calculate_sales_tax { local($subtotal) = @_; local($sales_tax) = 0; # If the sales tax is dependant on # a form variable, then # we check the value of that form # variable against the possible values # that have been designated in the # @sc_sales_tax_form_variable array. # # A match results in the sales tax # being calculated. if ($sc_sales_tax_form_variable ne "") { foreach $value (@sc_sales_tax_form_values) { if (($value =~ /^$form_data{$sc_sales_tax_form_variable}$/i) && ($form_data{$sc_sales_tax_form_variable} ne "")) { $sales_tax = $subtotal * $sc_sales_tax; } } # If it is not form variable # dependant, then the sales tax is # always calculated # } else { $sales_tax = $subtotal * $sc_sales_tax; } # We return the sales tax already # in a preformatted form. # return (&format_price($sales_tax)); } # End of calculate sales tax

CHANGE ALL OF THIS TO:

sub calculate_sales_tax { local($subtotal) = @_; local($sales_tax) = 0; return(&calculate_general_logic( $subtotal, $total_quantity, $total_measured_quantity, *sc_tax_logic, *sc_order_form_tax_related_fields)); } # End of calculate sales tax

THIS WILL ONLY WORK IF YOU HAVE ALSO MADE THE CHANGES POSTED BY Milan C Shah. Here is what Milan said to change:

In your setup file (web_store.setup.html, etc.) change:

$sc_sales_tax = ".0775"; # 7.75% $sc_sales_tax_form_variable = "04-b_state"; @sc_sales_tax_form_values = ("il", "Illinois");

TO:

@sc_tax_logic = ("al|1-|||4%", "il|1-|||7.75%", "wi|1-|||5.6%");

THEN find the lines that read:

@sc_order_form_shipping_related_fields and @sc_order_form_discount_related_fields

ADD this line after those two:

@sc_order_form_tax_related_fields = ("04-b_state");

NOW in your outlet_order_form_with_shipping.html file use a drop-down menu for the user to select the state. (This step not neccessary, but recommended so that there's no possibility of the user entering in a mispelled state). For example:

State:
Alabama
Illinois
Wisconsin
NONE

THE "NONE" is for out of U.S. orders.

This solution worked for me, and others on the discussion board. I hope you find it useful. Post any questions on the discussion board if you have any.