Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Substituting Statement With Query


1Putts

Recommended Posts

Posted

OK, this is my last stab at this...I'm on my third day of trying to figure this out:

 

How would I modify the following statement to query the database for the actual tax rate used for a particular order. So rather than "15.0"; there would be a query:

 

$AddShippingTax = "15.0";

 

Basically I want the $AddShippingTax variable to reflect the actual tax rate since it varies depending on where the customer is located.

 

Thanks in advance.

Posted

This must be more difficult than I had originally thought. Allright then...

 

How do I query the database for the products_tax value for a particular order (i.e. the current order)?

 

Maybe someone knows how to do that. Thanks very much.

Posted

Don't everyone jump in all at once :-"

 

I managed to futz my way to a fix. For those using the order editor contribution and need the shipping tax to be applied in the same manner (ie. the exact same percentage of tax) as the product tax, here's what I did (note, I'm using v1.59):

 

Around line 69, find this:

// Optional Tax Rate/Percent
 $AddShippingTax = "0.0"; // e.g. shipping tax of 17.5% is "17.5"

 

and either comment out the second line or just delete the whole thing.

 

Next, find these lines (around 242):

// Update Tax and Subtotals
   $RunningSubTotal += $products_details["qty"] * $products_details["final_price"];
   $RunningTax += (($products_details["tax"]/100) * ($products_details["qty"] * $products_details["final_price"]));

 

And add the following directly below:

$AddShippingTax = $products_details["tax"];

 

Once again - this is only useful if the amount of tax you apply on shipping is the same as the amount you apply on products. Here in Canada, depending on where the customer is located, the tax rate varies. But whatever the tax rate applies, that is what is added to both the product and shipping costs.

Archived

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

×
×
  • Create New...