osCommerce 4 osCommerce 4 App Shop Support Services App Shop Us
• Checkout
• Get in touch

osCommerce

The e-commerce.

# Need Help Related To Tax Calculation

## Recommended Posts

Let us assume there are two tax class

class A and class B

tax rate for class A is 4 % and Tax rate for Class B is 5%

Now , product 1 belongs to tax class a and product B belongs to class B.

Let us assume that both of these tax class is applicable for all country all zone.

Suppose price of Product 1 is 100 and price of product B is 200.

Now i installed specials offer module where we can offer special offer on the

combination of two products either by offering some percentage deduction on their sum of

price or by flat discount in terms of rupees from their sum of price ,that is if we

purchase two products together then price will be less than if we purchase them

separately.

special offer of 10% off on their sum of price is offered on the combination Product A

and Product B . so after special offer their together price is now

[ { 200 + 100 } -(300 *10%) ]=270

Now a customer opt this special offer and add this combination of product a and product b

in his shopping cat. so now in his cart [Product A + Product B] and he now continue

shopping and add Product A in his cart.

so now in his cart special offer product ( i.e Product A + product b] And another

Product A .SO his cart Is like this [ (Product A + Product B ) + Product A ]

Now at the time of checkout how the tax will be calculated ? can any one help me ,i am

getting confuse what will be the logic for the tax calculation .Please help me if u show

the calculation logic in equation format then it will be very help full for me.

##### Share on other sites

Now at the time of checkout how the tax will be calculated ?

Tax is always calculated on the individual products price. See e.g. classes/currencies.php and tep_add_tax, tep_calculate_tax in includes/functions/general.php.

##### Share on other sites

For the above example if we use discount coupon then the tax for individual product was calculated on the deduced price after using the discount coupon.that is for example product A base price was 100 but as we use discount coupon (10% off) so its deduced price is 90 and that why tax for the Product a is 4% of 90 and it is 3.6 and tax for product B is also calculated in the same way.

so my question is that ,As the [ product A+ Product B ] are in a special offer , so in case of special offer product [ product A+ Product B ] is there any formula to calculate tax of individual product or the tax will be calculated on their base price. i need this information.

##### Share on other sites

Tax is always calculated on the individual products price. See e.g. classes/currencies.php and tep_add_tax, tep_calculate_tax in includes/functions/general.php.

For the above example if we use discount coupon then the tax for individual product was calculated on the deduced price after using the discount coupon.that is for example product A base price was 100 but as we use discount coupon (10% off) so its deduced price is 90 and that why tax for the Product a is 4% of 90 and it is 3.6 and tax for product B is also calculated in the same way.

so my question is that ,As the [ product A+ Product B ] are in a special offer ,

that is if we purchase two products together then price will be less than if we purchase them separately.

so in case of special offer product [ product A+ Product B ] is there any formula to calculate tax of individual product or the tax will be calculated on their base price. i need this information.

##### Share on other sites

so in case of special offer product [ product A+ Product B ] is there any formula to calculate tax of individual product or the tax will be calculated on their base price. i need this information.

So you have a problem with how a contribution calculates taxes. That's an issue of that contribution not of osC in general.

Perhaps there is a support thread for that contribution mentioned in the install instructions?

##### Share on other sites

So you have a problem with how a contribution calculates taxes. That's an issue of that contribution not of osC in general.

Perhaps there is a support thread for that contribution mentioned in the install instructions?

There is no such instruction how the tax will be calculated if both the product belongs to different tax rate or if tax is applicable for one any one product .that why i need your help.

##### Share on other sites

There is no such instruction how the tax will be calculated if both the product belongs to different tax rate or if tax is applicable for one any one product .that why i need your help.

On last count there were 6083 different addons. And then you expect someone here to tell you how tax is calculated in a contribution that you don't even mention?

We are not psychics here.

##### Share on other sites

On last count there were 6083 different addons. And then you expect someone here to tell you how tax is calculated in a contribution that you don't even mention?

We are not psychics here.

The name of the add on is 2gether discount .if you have any information please tell me

##### Share on other sites

The name of the add on is 2gether discount .if you have any information please tell me

If you look in includes/modules/order_total/ot_together.php you will find how tax is calculated:

```
function process() {
global \$order, \$currencies, \$ot_subtotal, \$cart, \$together_product_names;

\$od_amount = \$this->calculate_2gether_discount();

if (\$od_amount > 0) {
\$this->deduction = \$od_amount;
\$this->output[] = array('title' => sprintf(MODULE_2GETHER_DISCOUNT_FORMATED_TITLE, \$together_product_names),
'text' => sprintf(MODULE_2GETHER_DISCOUNT_FORMATED_TEXT, \$currencies->format(\$od_amount)),
'value' => \$od_amount);

/*****START_TAX_CALCULATIONS*****/
\$discount_percentage = (\$od_amount/\$order->info['subtotal']);

if (\$order->info['tax'] > 0) {

\$tod_amount = (\$order->info['tax'] * \$discount_percentage);
reset(\$order->info['tax_groups']);

while (list(\$key, \$value) = each(\$order->info['tax_groups'])) {

\$god_amount = \$value * \$discount_percentage;
\$order->info['tax_groups'][\$key] = \$order->info['tax_groups'][\$key] - \$god_amount;
}
}

//            \$order->info['total']     -= \$order->info['tax'];
\$order->info['total'] -= \$this->deduction;
\$order->info['tax']     -= \$tod_amount;
//            \$order->info['total']      = (\$order->info['total'] - \$od_amount) + \$order->info['tax'];
/*****END_TAX_CALCULATIONS*****/

if (\$this->sort_order < \$ot_subtotal->sort_order) \$order->info['subtotal'] -= \$this->deduction;
}
}
```

Looks like the order total and discounted amount are calculated as a percentage and this percentage is used to also reduce the tax. This seem to happen on all products.

##### Share on other sites

If you look in includes/modules/order_total/ot_together.php you will find how tax is calculated:

```
function process() {
global \$order, \$currencies, \$ot_subtotal, \$cart, \$together_product_names;

\$od_amount = \$this->calculate_2gether_discount();

if (\$od_amount > 0) {
\$this->deduction = \$od_amount;
\$this->output[] = array('title' => sprintf(MODULE_2GETHER_DISCOUNT_FORMATED_TITLE, \$together_product_names),
'text' => sprintf(MODULE_2GETHER_DISCOUNT_FORMATED_TEXT, \$currencies->format(\$od_amount)),
'value' => \$od_amount);

/*****START_TAX_CALCULATIONS*****/
\$discount_percentage = (\$od_amount/\$order->info['subtotal']);

if (\$order->info['tax'] > 0) {

\$tod_amount = (\$order->info['tax'] * \$discount_percentage);
reset(\$order->info['tax_groups']);

while (list(\$key, \$value) = each(\$order->info['tax_groups'])) {

\$god_amount = \$value * \$discount_percentage;
\$order->info['tax_groups'][\$key] = \$order->info['tax_groups'][\$key] - \$god_amount;
}
}

//            \$order->info['total']     -= \$order->info['tax'];
\$order->info['total'] -= \$this->deduction;
\$order->info['tax']     -= \$tod_amount;
//            \$order->info['total']      = (\$order->info['total'] - \$od_amount) + \$order->info['tax'];
/*****END_TAX_CALCULATIONS*****/

if (\$this->sort_order < \$ot_subtotal->sort_order) \$order->info['subtotal'] -= \$this->deduction;
}
}
```

Looks like the order total and discounted amount are calculated as a percentage and this percentage is used to also reduce the tax. This seem to happen on all products.

Sir ,Thanks for your reply , i am not able to get this section

\$discount_percentage = (\$od_amount/\$order->info['subtotal']);

if (\$order->info['tax'] > 0) {

\$tod_amount = (\$order->info['tax'] * \$discount_percentage);

reset(\$order->info['tax_groups']);

while (list(\$key, \$value) = each(\$order->info['tax_groups'])) {

\$god_amount = \$value * \$discount_percentage;

\$order->info['tax_groups'][\$key] = \$order->info['tax_groups'][\$key] - \$god_amount;

}

}

can u please tell me in words what is going here per step ,please sir i think that it will clear all my doubts.

#### Archived

This topic is now archived and is closed to further replies.

×
×
• Create New...