Forums / Bug Reports / [Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

[Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

Locked

Views: 6,504

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
10 Jul 2010, 1:30 AM
#1
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,732
Plugin Contributions:
56

[Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

In 1.3.8, the label "Sales Tax" would be used because no actual tax applied, i.e.

Sales Tax: $0.00

In 1.3.9d, a tax which does not apply is displayed:

FL TAX 7.0%: $0.00

I reviewed a few files and didn't see an obvious root cause. A patch would be to use TEXT_UNKNOWN_TAX_RATE in ot_tax.php if value is 0.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

14 Jul 2010, 3:42 PM
#2
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,928
Plugin Contributions:
3

Re: [Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

Hmm

I tested this locally and if the address of the customer is 'in scope' for the tax zones set up in the store then you are correct, that the store will show the tax description of an applicable zone.

However if the customers address is not in scope, then a generic 'Sales Tax' label is shown.

15 Jul 2010, 12:50 AM
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,732
Plugin Contributions:
56

Re: [Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

I will cook up a simple test case with a default install ASAP to show this behavior.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

21 Jul 2010, 8:55 PM
#4
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,928
Plugin Contributions:
3

Re: [Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

Hi,

Any updates on this.

21 Jul 2010, 11:44 PM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,732
Plugin Contributions:
56

Re: [Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

Installed 139b, created fresh database.
Updated to 139d.
Tax applies to FL only at 7%.
Turn on Sales Tax Display Status 1 in Admin
Check out with a Georgia address.
Page 2 shows FL Tax 7.0%: $0.00

This should say "Sales Tax: $0.00" - no?

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

22 Jul 2010, 11:04 AM
#6
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,928
Plugin Contributions:
3

Re: [Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

Hi,

You are correct :)

There are a couple of cases where the code still fails to format the tax description correctly

can you try this updated code for ot_tax.php

    function process() {
      global $order, $currencies;

      reset($order->info['tax_groups']);
      $taxDescription = '';
      $taxValue = 0;
      if (STORE_TAX_DISPLAY_STATUS == 1)
      {
        $result = zen_get_all_tax_descriptions();
        if (count($result) > 0)
        {
          foreach ($result as $description)
          {
            if (!isset($order->info['tax_groups'][$description]))
            {
              $order->info['tax_groups'][$description] = 0;
            }
          }
        }
      }
      if (count($order->info['tax_groups']) > 1 && isset($order->info['tax_groups'][0])) unset($order->info['tax_groups'][0]);
      while (list($key, $value) = each($order->info['tax_groups'])) {
        if (SHOW_SPLIT_TAX_CHECKOUT == 'true')
        {
          if ($value > 0 or ($value == 0 && STORE_TAX_DISPLAY_STATUS == 1 )) {
            $this->output[] = array('title' => ((is_numeric($key) && $key == 0) ? TEXT_UNKNOWN_TAX_RATE :  $key) . ':',
                                    'text' => $currencies->format($value, true, $order->info['currency'], $order->info['currency_value']),
                                    'value' => $value);
          }
        } else
        {
          if ($value > 0 || ($value == 0 && STORE_TAX_DISPLAY_STATUS == 1))
          {
            $taxDescription .= ((is_numeric($key) && $key == 0) ? TEXT_UNKNOWN_TAX_RATE :  $key) . ' + ';
            $taxValue += $value;
          }
        }
      }
      if (SHOW_SPLIT_TAX_CHECKOUT != 'true' && ($taxValue > 0 or STORE_TAX_DISPLAY_STATUS == 1))
      {
        $this->output[] = array(
                        'title' => substr($taxDescription, 0 , strlen($taxDescription)-3) . ':' ,
                        'text' => $currencies->format($taxValue, true, $order->info['currency'], $order->info['currency_value']) ,
                        'value' => $taxValue);
      }
    }
22 Jul 2010, 11:43 AM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,732
Plugin Contributions:
56

Re: [Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

Nope. Still shows FL Tax.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

22 Jul 2010, 1:33 PM
#8
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,928
Plugin Contributions:
3

Re: [Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

k,

I think the problem was that I'm testing slightly differently to you, in that I was changing the primary address via the My Account section. This was masking the fact that the logic to choose the tax descriptions was only relying on the primary address, so changes made to the tax address (either by adding a new address or selecting a non primary address, would not be recognised)

So with fingers crossed, can you try this

    function process() {
      global $order, $currencies;

      reset($order->info['tax_groups']);
      $taxDescription = '';
      $taxValue = 0;
      if (STORE_TAX_DISPLAY_STATUS == 1)
      {
        $taxAddress = zen_get_tax_locations();
        $result = zen_get_all_tax_descriptions($taxAddress['country_id'], $taxAddress['zone_id']);
        if (count($result) > 0)
        {
          foreach ($result as $description)
          {
            if (!isset($order->info['tax_groups'][$description]))
            {
              $order->info['tax_groups'][$description] = 0;
            }
          }
        }
      }
      if (count($order->info['tax_groups']) > 1 && isset($order->info['tax_groups'][0])) unset($order->info['tax_groups'][0]);
      while (list($key, $value) = each($order->info['tax_groups'])) {
        if (SHOW_SPLIT_TAX_CHECKOUT == 'true')
        {
          if ($value > 0 or ($value == 0 && STORE_TAX_DISPLAY_STATUS == 1 )) {
            $this->output[] = array('title' => ((is_numeric($key) && $key == 0) ? TEXT_UNKNOWN_TAX_RATE :  $key) . ':',
                                    'text' => $currencies->format($value, true, $order->info['currency'], $order->info['currency_value']),
                                    'value' => $value);
          }
        } else
        {
          if ($value > 0 || ($value == 0 && STORE_TAX_DISPLAY_STATUS == 1))
          {
            $taxDescription .= ((is_numeric($key) && $key == 0) ? TEXT_UNKNOWN_TAX_RATE :  $key) . ' + ';
            $taxValue += $value;
          }
        }
      }
      if (SHOW_SPLIT_TAX_CHECKOUT != 'true' && ($taxValue > 0 or STORE_TAX_DISPLAY_STATUS == 1))
      {
        $this->output[] = array(
                        'title' => substr($taxDescription, 0 , strlen($taxDescription)-3) . ':' ,
                        'text' => $currencies->format($taxValue, true, $order->info['currency'], $order->info['currency_value']) ,
                        'value' => $taxValue);
      }
    }
22 Jul 2010, 11:12 PM
#9
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,732
Plugin Contributions:
56

Re: [Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

Same issue.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

22 Jul 2010, 11:25 PM
#10
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,928
Plugin Contributions:
3

Re: [Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

k,

any possibility of a screenshot of checkout_confirmation showing the problem

22 Jul 2010, 11:27 PM
#11
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,732
Plugin Contributions:
56

Re: [Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

Argh! I'm sorry - second patch works perfectly. I had forgotten to change my address when I ran the test again.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

23 Jul 2010, 10:49 AM
#12
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,928
Plugin Contributions:
3

Re: [Done v1.3.9e] With Sales Tax Display Status=1, $0 Sales tax has wrong label

No problem,

Thanks for all the help in testing back and forth.