VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: arcticsoft on October 19, 2011, 02:36:28 AM

Title: [fixed] Tax by State
Post by: arcticsoft on October 19, 2011, 02:36:28 AM
Hi,
I am trying to set up a tax rule to calculate tax per state but have encountered a problem. If the user hasn't logged in or if user hasn't provided billing address I was expecting to see no tax but it is actually adding the tax for all states.
For instance.
If the product price is 100.00 and tax for state1 is 5% and for state2 is 7% then calculated tax is 12%. As soon as I pick state1 or state2 in the billing address, the tax calculates as it should.

Am I missing something?
Title: Re: Tax by State
Post by: Milbo on October 19, 2011, 13:16:49 PM
no, you did afaik everthing right, interesting behaviour, I need to take a look on it.
Title: Re: Tax by State
Post by: arcticsoft on October 25, 2011, 03:21:45 AM
Tried with the latest release (2.0.0-RC-2j) and still having the problem.
I have different tax rates by state. If the bill to address is not in any of the states I have rules for, it is applying all tax rates (sum of all rates).
Title: Re: Tax by State
Post by: Milbo on October 27, 2011, 13:50:59 PM
I have fixed it. Is in the svn, this evening
Title: Re: [fixed] Tax by State
Post by: cas on November 09, 2011, 08:23:09 AM
Hi Milbo,

I'm using version M, and in the shopping cart it is still showing the tax amount when the user is not logged in.  Shouldn't the tax be zero when not logged in?

Thanks,
Chuck 
Title: Re: [fixed] Tax by State
Post by: arcticsoft on November 11, 2011, 03:56:56 AM
The same here.  If not logged in, it is still showing all taxes
What was the fix mentioned in the previous post?
Title: Re: [fixed] Tax by State
Post by: chancehoggan on November 20, 2011, 04:21:40 AM
Hi,

Firstly thanks for all the hardwork put into VM2!

I have upgraded to the latest version and it seems all the tax rules are applied. If i select 1 default tax rule for the companies local province and the user enters an address outside this province it will apply no taxes.

If I do not define a specific tax code it still adds all the taxes for all provinces and countries together and creates a rather expensive tax price!
Title: Re: [fixed] Tax by State
Post by: chancehoggan on November 20, 2011, 04:22:47 AM
If I modify the core the system will break on updates.

Any info you can provide on the fix above would be a big help.
Title: Re: [fixed] Tax by State
Post by: ptogel on January 05, 2012, 18:36:23 PM
I still have that problem. Taxes are calculated if the user is not registered or when registered. They should calculate only if in South Carolina. What doe we miss? I have VM 2.0.0.
Title: Re: [fixed] Tax by State
Post by: Milbo on January 05, 2012, 21:01:00 PM
I need backend access to understand this.
Title: Re: [fixed] Tax by State
Post by: agaudreau on January 08, 2012, 21:19:43 PM
I have the same problem.. All taxes are being added in the cart and once I log in to a user, they are all still there even though my tax codes are set up per province, using VM 2.0.0 on Joomla 1.7.3

I will provide backend access for you via PM.
Title: Re: [fixed] Tax by State
Post by: cas on January 08, 2012, 21:43:11 PM
I had this same problem, and I fixed it by going into the Tax & Calculation Rules and editing the Tax rule by selecting 'default' for the Shopper Group.    This way users who are not logged in get assigned the 'anonymous' Shopper Group and no tax is calculated for them.  When a user is logged in, they get assigned the 'default' Shopper Group and the tax rule is appropriately applied if the user is from that state/province.   

I agree the system should check if the user is not logged in and just skip the tax rules for users not logged in, but until that gets changed someday, for now you can simply assign the 'default' user to the Shopper Group in the tax rule, and it will work properly.
Title: Re: [fixed] Tax by State
Post by: agaudreau on January 08, 2012, 23:24:51 PM
That did the trick. Thanks Cas!

Title: Re: [fixed] Tax by State
Post by: cas on January 08, 2012, 23:35:59 PM
Glad to help!  I know I suffered a long time with this one too.   After seeing how many of us are having this same problem, I hope the VM developers will add the simple logic to not calculate tax if no one is logged in, or at least set the Tax rule Shopper Group to 'default' when it's created. 
Title: Re: [fixed] Tax by State
Post by: PRO on January 20, 2012, 21:52:39 PM
Shopper group fix did not work for me, because I let some checkout as guest.

This will hide something if a user has not put in their address yet. (IN THE CART VIEW)

<?php if (!empty($this->cart->BT)){

}

Just wrap whatever with that.

For example

if (!empty($this->cart->BT)){
      foreach($this->cart->cartData['DATaxRulesBill'] as $rule){ ?>
         <tr class="sectiontableentry<?php $i ?>">
            <td colspan="4" align="right"><?php echo   $rule['calc_name'] ?> </td>

                                     <?php if ( VmConfig::get('show_tax')) { ?>
            <td align="right"><?php  ?> </td>
                                <?php } ?>
            <td align="right"><?php echo  $this->cart->prices[$rule['virtuemart_calc_id'].'Diff'];   ?> </td>
            <td align="right"><?php echo $this->cart->prices[$rule['virtuemart_calc_id'].'Diff'];   ?> </td>
         </tr>
         <?php
         if($i) $i=1; else $i=0;
      } }?>


^^^^^

PLEASE dont forget that the total is going to be wrong. BECAUSE the tax will be added to it.

hide the total when address is not filled in. default_pricelist.php


      <?php if (!empty($this->cart->BT)){ ?>  <tr class="sectiontableentry2">
         <td colspan="4" align="right"><?php echo JText::_('COM_VIRTUEMART_CART_TOTAL') ?>: </td>

                        <?php if ( VmConfig::get('show_tax')) { ?>
         <td align="right"> <?php echo "<span  style='color:gray'>".$this->cart->prices['billTaxAmount']."</span>" ?>

</td>
                        <?php } ?>
         <td align="right"> <?php echo "<span  style='color:gray'>".$this->cart->prices

['billDiscountAmount']."</span>" ?> </td>
         <td align="right"><strong><?php echo $this->cart->prices['billTotal'] ?></strong></td>
        </tr> <?php } ?>
Title: Re: [fixed] Tax by State
Post by: cas on January 20, 2012, 22:46:18 PM
Hi Banquet,

Is this being fixed in the base for the next release, or do we all need to hack the code? 

Cheers,
Chuck
Title: Re: [fixed] Tax by State
Post by: PRO on January 21, 2012, 02:17:33 AM
Quote from: cas on January 20, 2012, 22:46:18 PM
Hi Banquet,

Is this being fixed in the base for the next release, or do we all need to hack the code? 

Cheers,
Chuck

This is not a HACK, its a template override.

I do not know, I do know, its not an easy fix because there are so many countries to consider. and they all have to be worked with as far as tax etc. and even discounts. A lot of countries have laws about discounts.

Title: Re: [fixed] Tax by State
Post by: cas on January 21, 2012, 08:46:56 AM
Sure, it's not a core hack, but each time a new version comes out, we will still need to check the new template for updates and then add our override into the new template, so it will be an ongoing issue.   I appreciate that different countries have different tax rules, so then why not have a simple admin setting like the following: Add Tax When User is Not Logged In: Y/N.   This way we get to choose depending on the country we are from. 
Title: Re: [fixed] Tax by State
Post by: AndrewBucklin on March 13, 2012, 23:00:09 PM
+1

Currently ALL tax rates are showing to anonymous users, even though "anonymous" is NOT selected for any of the tax rate rules. The shopper group selected for all of the tax rules is "default".

Any suggestions other than the template override?