Check the order class:
/includes/classes/order.php
Check the order total module for Total ot_total.php
/includes/modules/order_total/ot_total.php
for starters ...
Check the order class:
/includes/classes/order.php
Check the order total module for Total ot_total.php
/includes/modules/order_total/ot_total.php
for starters ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Well I don't pretend to be a PHP guru but I do have the system in svn and can roughly find my way round Eclipse.... I'll try and run it through the debuggerer and see if I can see anything obvious. Clearly neither of us can see quite what the problem is :-) However, there is one, so that's as good a place to start as any !
If you want admin access to the site I can PM you a login. I think I can give you svn access - let me know if you want to try and and I will look further.
Meanwhile, it's the weekend and I think it's beer o'clock :-) Will have a look if I get a chance. If not, Hasta Lunes......
And thanks once again for all your efforts. It is greatly appreciated. It's why I picked ZenCart......
B. Rgds
John
What is your setting for your admin's Configuration->My Store->Display Prices with Tax? It looks like it might be set to true ...
OK, got bored before bedtime. The calculation is done in order.php here
At this point I checked in Eclipse and the outputs were :Code:// Update the final total to include tax if not already tax-inc if (DISPLAY_PRICE_WITH_TAX == 'true') { $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost']; } else { $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
$this->info['subtotal'] = 175
$this->info['tax'] = (double) 0
$this->info['shipping_cost'] = null
info Array [16]
order_status (string:1) 1
currency (string:3) GBP
currency_value (string:10) 1.00000000
payment_method null
payment_module_code null
coupon_code null
shipping_method null
shipping_module_code null
shipping_cost null
subtotal (double) 175
shipping_tax (int) 0
tax (double) 0
total (int) 0
tax_groups Array [1]
comments (string:0)
ip_address (string:29) 192.168.100.24 - 192.168.100.24
products Array [1]
0 Array [16]
qty (int) 100
name (string:17) 38mm Button Badge
model (string:6) 338253
tax (int) 0
tax_groups Array [1]
tax_description (string:9) Sales Tax
price (string:6) 1.7500
final_price (double) 1.75
onetime_charges (int) 0
weight (int) 0
products_priced_by_attribute (string:1) 0
product_is_free (string:1) 0
products_discount_type (string:1) 2
products_discount_type_from (string:1) 0
id (int) 222
rowClass (string:7) rowEven
Think the problem is earlier in the file but need some sleep now :-)
B. Rgds
John
Gawd this is so frustrating !!! I'm sure the answer is stupidly simple but I'm blowed if I can see it.
What is most odd is that the correct Tax figure is shown on the payment method page and is set in the variable $order->info[tax_groups] - where it gets that from I cannot see at the minute. But when it tries to look for the tax for calculation of the Total it get a big fat zero.
As an experiment I tryed to set Config My Store Display Prices with Tax. At first it would not show a price inc. Tax so I updated the Product whereupon it showed it which cured that problem. However I still got
Sub Total : 250
Tax : 50
Total : 250
That is completely wrong as well and I'm not sure exactly how this should be displayed, but I think it is symptomatic of the problem. If the product is displayed with Tax then this should be a different layout.
e.g with 20% VAT :
Goods : 240
Goods : 120
SubTotal : 360
Shipping : 48
Total : 408
(Tax : 88)
I have just put in a clean installation with the exiting database (i.e NO mods to the files whatsoeer apart from configure information) and the results are still the same.
Guess the next thing to try a a completely clean install :-(
Yours in desperation :-)
John
OK,
After a frustrating day I *think* there is something not quite right in the tax calculations in order.php :
In includes/classes/order.php around line 503 +
$shown_price = (zen_add_tax($this->products[$index]['final_price'] * $this->products[$index]['qty'], $this->products[$index]['tax']))
+ zen_add_tax($this->products[$index]['onetime_charges'], $this->products[$index]['tax']);
= zen_add_tax (1.75 * 100, 0 + 0, 0)
I think this is wrong as function zen_add_tax($price, $tax) only wants two parts.....
Next, I can't describe this bit too well so bear with me ! I think that the variable ($this->products ['index'] ['tax_groups'] - how do you extract a sub/sub/sub array value ???) should be used somehow (in this instance UK VAT)
This is the result of the $this array at this point :
products Array [1]
0 Array [16]
qty (int) 100
name (string:17) 38mm Button Badge
model (string:6) 338253
tax (int) 0
tax_groups Array [1]
***** UK VAT (double) 20 ***** Here ??
tax_description (string:6) UK VAT
price (string:6) 1.7500
final_price (double) 1.75
onetime_charges (int) 0
weight (int) 0
products_priced_by_attribute (string:1) 0
product_is_free (string:1) 0
products_discount_type (string:1) 2
products_discount_type_from (string:1) 0
id (int) 222
rowClass (string:7) rowEven
Or possibly $taxRates
$taxRates Array [1]
UK VAT (double) 20
Not quite sure how - I put a couple of test lines as follows :
$my_rate_name = $this->products[$index]['tax_description'];
$my_rate = $taxRates[$my_rate_name];
$my_rate becomes outputs : (double) 20
But at least it's the right number.....
Not sure where to go from here. Any suggestions please ???
B. Rgds
John