Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Paypal calculating tax more than once


jtmudge

Recommended Posts

When sending the form from cehckout_confirmation.php, taxes are sent more than once. There are 3 items in the order, so the tax is sent 3 times instead of once. the Total tax should be 2.06 instead of 6.18.

 

Here is a sample of the html generated:

 

<input type="hidden" name="item_name_1" value="SUPERHEAVY ASSLT LANDER">

<input type="hidden" name="item_number_1" value="GHX MT028">

<input type="hidden" name="quantity_1" value="1">

<input type="hidden" name="amount_1" value="18.00">

<input type="hidden" name="tax_1" value="2.06">

<input type="hidden" name="on0_1">

<input type="hidden" name="os0_1">

<input type="hidden" name="on1_1">

<input type="hidden" name="os1_1">

<input type="hidden" name="item_name_2" value="LARGE MULTI ROCKET POD">

<input type="hidden" name="item_number_2" value="GHX SFA019">

<input type="hidden" name="quantity_2" value="2">

<input type="hidden" name="amount_2" value="3.90">

<input type="hidden" name="tax_2" value="2.06">

 

 

The paypal module that generates this looks like this:

//Customer Order Details

for ($i=0; $i<sizeof($order->products); $i++) {

$index = $i+1;

$paypal_fields .= tep_draw_hidden_field('item_name_'.$index, $order->products[$i]['name']).

tep_draw_hidden_field('item_number_'.$index, $order->products[$i]['model']).

tep_draw_hidden_field('quantity_'.$index, $order->products[$i]['qty']).

tep_draw_hidden_field('amount_'.$index, number_format($order->products[$i]['final_price']* $currencies->get_value($my_currency),2)) .

tep_draw_hidden_field('tax_'.$index, number_format($order->info['tax'] * $currencies->get_value($my_currency),2));

 

//Customer Specified Product Options: PayPal Max = 2

if ($order->products[$i]['attributes']) {

for ($j=0, $n=sizeof($order->products[$i]['attributes']); $j<2; $j++) {

if($order->products[$i]['attributes'][$j]['option']){

$paypal_fields .= $this->_drawPayPalOptionSet($j,$index,$order->products[$i]['attributes'][$j]['option'],$order->products[$i]['attributes'][$j]['value']);

} else {

$paypal_fields .= $this->_drawPayPalOptionSet($j,$index,' ',' ');

}

}

} else {

for ($j=0; $j<2; $j++) {

$paypal_fields .= $this->_drawPayPalOptionSet($j,$index,' ',' ');

}

}

}

 

 

Any ideas of how to remedy this?

Link to comment
Share on other sites

$taxValue = ($order->products[$i]['final_price'] * ($order->products[$i]['tax'] / 100))*$currencies->get_value($my_currency);

$paypal_fields .= tep_draw_hidden_field('tax_'.$index, number_format($taxValue, 2));

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...