dailce Posted February 3, 2005 Share Posted February 3, 2005 When you select itemized and charge tax on shipping and tax on the product the original code would not add the correct taxes up. For instance, the total before checkout: Item = $100 Shipping = $10 GST 7% + PST 8% = $15 GST on shipping + PST on shipping = $1.50 Total = $126.50 When the buyer checks out the PayPal_Shopping_Cart_IPN brings you to PayPal and only adds the following: Item = $100 Shipping and Handling = $10 Sales Tax (GST 7% + PST 8%) = $15 Total = $125.00 It doesn't add/include the tax on shipping. I think I fixed it, well this works but I'm not sure about the call to get the shipping tax: Modify include/modules/payment/paypal.php //Itemized Order Details for ($i=0,$index=1; $i<sizeof($order->products); $i++, $index++) { //$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']* $my_currency_value,2)); $tax = (($order->products[$i]['final_price'] * ($order->products[$i]['tax'] / 100)) + ($order->info['shipping_cost'] * ($order->products[$i]['tax'] / 100))) * $my_currency_value; $paypal_fields .= tep_draw_hidden_field('tax_'.$index, number_format($tax, 2)); Basically I added: "+ ($order->info['shipping_cost'] * ($order->products[$i]['tax'] / 100))" However, I'm not sure if: "order->products[$i]['tax'] " is right Is there a way to call it on the shipping, maybe something like: "order->shipping[$i]['tax'] " ?????? I tested it and it works 100% great! Just need someone with more code experince to verify or correct my syntax. Quote Link to comment Share on other sites More sharing options...
dailce Posted February 3, 2005 Author Share Posted February 3, 2005 I should add that this definatly works. But, I have: "+ ($order->info['shipping_cost'] * ($order->products[$i]['tax'] / 100))" This assumes the tax on shipping is the same as the tax on products, but it should be changed if you were adding a differnet tax rate on shipping. Maybe somehitng like: "+ ($order->info['shipping_cost'] * ($order->shipping[XXXX]['tax'] / 100))" I'm just not great at PHP so if someone knows the way to do it please respond. Quote Link to comment Share on other sites More sharing options...
dailce Posted February 3, 2005 Author Share Posted February 3, 2005 I did more test and with mulitple items there seems to be an error, I'm not sure what going on, but I feel that this is the code to alter to correct the problem I listed above - I know this because aggreate works perfectly. Quote Link to comment Share on other sites More sharing options...
dailce Posted February 3, 2005 Author Share Posted February 3, 2005 //Itemized Order Details for ($i=0,$index=1; $i<sizeof($order->products); $i++, $index++) { //$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']* $my_currency_value,2)); $tax = ($order->products[$i]['final_price'] * ($order->products[$i]['tax'] / 100)); $paypal_fields .= tep_draw_hidden_field('tax_'.$index, number_format($tax, 2)); //Customer Specified Product Options: PayPal Max = 2 if ($order->products[$i]['attributes']) { //$n = sizeof($order->products[$i]['attributes']); for ($j=0; $j<2; $j++) { if($order->products[$i]['attributes'][$j]['option']){ $paypal_fields .= $this->optionSetFields($j,$index,$order->products[$i]['attributes'][$j]['option'],$order->products[$i]['attributes'][$j]['value']); } else { $paypal_fields .= $this->optionSetFields($j,$index); } } } else { for ($j=0; $j<2; $j++) { $paypal_fields .= $this->optionSetFields($j,$index); } } } } else { //Aggregate Cart (Method 1) SO does anyone know what to change? Quote Link to comment Share on other sites More sharing options...
dailce Posted February 3, 2005 Author Share Posted February 3, 2005 (edited) DAMM ANOTHER BUG. ANY EXPERT CAN DO WHAT I WANT IT TO DO!!!! Edited February 3, 2005 by dailce Quote Link to comment Share on other sites More sharing options...
rd1000 Posted May 13, 2005 Share Posted May 13, 2005 DAMM ANOTHER BUG. ANY EXPERT CAN DO WHAT I WANT IT TO DO!!!! <{POST_SNAPBACK}> I added this line as per your previous post: "+ ($order->info['shipping_cost'] * ($order->products[$i]['tax'] / 100))" but now it adds the shipping tax twice during Paypal checkout. Were you ever able to find a fix? Rob Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.