Forums / All Other Contributions/Addons / TaxCloud causing sales tax to be computed twice during order emails

TaxCloud causing sales tax to be computed twice during order emails

Views: 1,227

Results 1 to 3 of 3
28 Apr 2014, 2:53 PM
#1
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

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

$ot['text'] = '$' . $newValue;

Around line 1201

$ot_tax['text'] = '$' . $taxcloudTaxTotal;

AFTER

                    $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)**

**
Super Orders view of the order, I can confirm from phpMyAdmin that this still holds to be true:**

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:

    $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++;
            }
        }
    } 
28 Apr 2014, 3:06 PM
#2
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

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:

Here is it only listed once.

29 Apr 2014, 3:22 AM
#3
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

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.)