View Full Version : Tax is lost at checkout if product weight is zero

07-10-2004, 08:25 AM
I don't want to update each product with a weight as shipping will be free/included in the price, but I am finding that the products are being determined as 'virtual' in class shopping_cart, the shopping_cart page is therefore bypassing the delivery page (checkout_shipping), and the tax is lost:
in class order when called from checkout_payment
tax_address[entry_country_id] = null
tax_address[entry_zone_id] = null

but they are correct (222 and 1 respectively) if the product has a weight.

07-10-2004, 09:27 AM
The problem seems to start class order when it is called from checkout_payment
$tax_address_query = tep_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)($this->content_type == 'virtual' ? $billto : $sendto) . "'");
$tax_address = tep_db_fetch_array($tax_address_query);
In the above sql ab.address_book_id returns as 6 when called from checkout_shipping but is 0 when called from checkout_payment.

The result of ($this->content_type == 'virtual' ? $billto : $sendto) is 6 when called from checkout_shipping and is empty when called from checkout_payment.

billto: 6
sendto: 6
this->content_type: virtual_weight
products_tax: 17.5

billto: 6
this->content_type: virtual_weight
products_tax: 0

So the sendto id is being lost!

In checkout_shipping $sendto = $customer_default_address_id but it is not set in checkout_payment. Checkout_shipping offers an address selection, so if that page is bypassed surely in checkout_payment if $sendto is empty it should be set to:
$sendto = $customer_default_address_id;[/code]

07-29-2004, 08:05 AM
I am VERY interested to know if you find the way to fix your problem, as I have the same one and I a looking for the fix for 2 days, looking at the code.
Is there any erlation with the weight of the product ?
Thanks so much if you can help me,

07-29-2004, 01:48 PM
In checkout_payment.php around line 68 and before the line '$order = new order;' I inserted the following line:

if ($sendto == '') {$sendto = $customer_default_address_id;}

08-10-2004, 03:09 AM
Thanks for your reply, this can be a bypass. I will give it a try.