VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: antonitus on April 25, 2016, 10:46:53 AM

Title: Tax on shipping cost - label issue on cart
Post by: antonitus on April 25, 2016, 10:46:53 AM
I have an issue with the labels on the cart. My scenario:
1. Added a shipping rule
2. Added a shipping tax rule (separate rule to my other tax rules)
3. Applied this shipping tax rule to the shipping rule

All the tax works out well on the cart., however when I view the cart, it adds a label called 'SHIPPING' which was taken straight from the label name of the shipping tax rule. It also replaces the normal 'TAX' label to '20%' (see 1st picture) Something seriously is wrong here, probably a bug. When I removed the shipping tax rule from the shipping rule, the label reverts back to the normal 'TAX' label (see 2nd picture).

Can somebody please tell me what might be happening here?  I changed the template to another template and the issue still exists so it is not a template issue.  I have another website with another template and I am using the exact same Virtuemart V3.0.16 and everything seems to be ok there. I upgraded that version about 2 weeks ago and the issue I am getting on the new website was upgraded yesterday, so has anything changed on that upgrade since 2 or 3 weeks ago without a version number update?

Regards,
antonitus
Title: Re: Tax on shipping cost - label issue on cart
Post by: GJC Web Design on April 25, 2016, 11:01:59 AM
this comes from

components\com_virtuemart\views\cart\tmpl\default_pricelist.php

<?php if (VmConfig::get ('show_tax')) {
      $tax = vmText::_ ('COM_VIRTUEMART_CART_SUBTOTAL_TAX_AMOUNT');
      if(!empty($this->cart->cartData['VatTax'])){
         if(count($this->cart->cartData['VatTax']) < 2) {
            reset($this->cart->cartData['VatTax']);
            $taxd = current($this->cart->cartData['VatTax']);
            $tax = shopFunctionsF::getTaxNameWithValue($taxd['calc_name'],$taxd['calc_value']);
         }
      }
      ?>
   <th class="vm-cart-item-tax" ><?php echo "<span  class='priceColor2'>" . $tax . '</span>' ?></th>

A step too far I feel

you can replace with

<th class="vm-cart-item-tax" ><?php echo "<span  class='priceColor2'>" . vmText::_ ('COM_VIRTUEMART_CART_SUBTOTAL_TAX_AMOUNT'); . '</span>' ?></th>
Title: Re: Tax on shipping cost - label issue on cart
Post by: antonitus on April 25, 2016, 11:21:49 AM
Hi GJC Web Design,

Thanks for your help again.  What I'm worried about is changing the script and then having to change it again when an update occurs.  I can of course add an override of course. My main concern is why is this happening to the update of Virtuemart I did yesterday and not to the update I did 2-3 weeks ago under the same version number.  I think Virtuemart must have changed something without changing the version number.
Title: Re: Tax on shipping cost - label issue on cart
Post by: GJC Web Design on April 25, 2016, 11:26:43 AM
no idea.. from memory this has been there since 3.0.12 ..

what's the prob with an over ride? 5 mins work at most
Title: Re: Tax on shipping cost - label issue on cart
Post by: antonitus on April 25, 2016, 11:29:48 AM
True. I'm doing it right now as I'm writing this. In fact, the override file is there already, I just have to edit the code you sent me. So thank you for that.
Title: Re: Tax on shipping cost - label issue on cart
Post by: antonitus on April 25, 2016, 11:41:50 AM
I removed this code from 'templates/template_name/layouts/default/html/com_virtuemart/cart/default_pricelist.php' (override file already existed)

if (VmConfig::get ('show_tax') && !empty($this->cart->cartData['VatTax']))
{
reset($this->cart->cartData['VatTax']);
$taxd = current($this->cart->cartData['VatTax']);
$taxTitle = $taxd['calc_name'] . ' ' . rtrim(trim($taxd['calc_value'],'0'), '.') . '%';
}


This worked a treat and now those unwanted labels have been removed and it's back to the normal 'Tax' label.  Maybe Virtuemart should have an option to amend this in the config file or shipping rule in the future.