TaxCloud causing sales tax to be computed twice during order emails
I'm running ZenCart 1.5.1 and the latest version available of the TaxCloud plugin.
During checkout, I'm noticing a few things.
Firstly, the emails are being sent out with the tax showing one decimal even though my ZenCart is configured to show all prices as two decimals. (I wound fixing this by using the inherent number_format() as a temporary fix. as below:
BEFORE
Around line 1194
PHP Code:
$ot['text'] = '$' . $newValue;
Around line 1201
PHP Code:
$ot_tax['text'] = '$' . $taxcloudTaxTotal;
AFTER
PHP Code:
$ot['text'] = '$' . number_format($newValue, TAX_DECIMAL_PLACES);
...
$ot_tax['text'] = '$' . number_format($taxcloudTaxTotal,TAX_DECIMAL_PLACES);
Secondly, I noticed that the emails are being sent out with the sales tax line being sent out twice and calculated twice in the emails. Even though the credit card/paypal account/etc. is only being charged for it once:
Confirmation Email: (ignore the misformatting of the details, that's my own fault)
http://i.imgur.com/rvbvFqp.png
Super Orders view of the order, I can confirm from phpMyAdmin that this still holds to be true:
http://i.imgur.com/CZ9r9w2.png
I found the relevant coding here to TaxCloud that MIGHT be causing this issue but am not sure. Any one mind taking any guess as I'm pulling out my hair over this:
PHP Code:
$TAXCLOUD_ENABLE = func_taxcloud_is_enabled($shippingAddress['country_id']);
if ($TAXCLOUD_ENABLE =='true') {
$taxcloudTaxTotal = $_SESSION['taxcloudTaxTotal'];
if ( isset($taxcloudTaxTotal) && $taxcloudTaxTotal > 0) {
$index = 0;
foreach ($order_totals as $ot) {
if ( $ot['code'] == 'ot_total' ) {
$newValue = $ot['value'] + $taxcloudTaxTotal;
$ot['value'] = $newValue;
$ot['text'] = '$' . number_format($newValue, TAX_DECIMAL_PLACES);
$order_totals[$index + 1] = $ot;
$ot_tax = Array();
$ot_tax['code'] = 'ot_tax';
$ot_tax['title'] = 'Sales Tax (to be collected):';
$ot_tax['text'] = '$' . number_format($taxcloudTaxTotal, TAX_DECIMAL_PLACES);
$ot_tax['value'] = $taxcloudTaxTotal;
$ot_tax['sort_order'] = 500;
$order_totals[$index] = $ot_tax;
}
$index++;
}
}
}
Re: TaxCloud causing sales tax to be computed twice during order emails
Also as a point of information, here is the view from the checkout_payment page:
http://i.imgur.com/BMlS3lA.png
Here is it only listed once.
Re: TaxCloud causing sales tax to be computed twice during order emails
I found out what the problem was with the double posting. There evidently is a conflict with the Rewards Point Suite's "ot_reward_points_display" order total module. Removing this module, or in fact disabling it, enables the sales tax to be calculated as normal. (I had the reward points display set to a sort order of 1000.)