VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: gain on July 19, 2013, 18:24:05 PM

Title: [SOLVED] "Show Tax in Cart" doesn't show tax in chart...
Post by: gain on July 19, 2013, 18:24:05 PM
Hi,
I need to have tax in the cart, but the option in configuration panel seems not to work correctly cause the column in the cart appears, but always empty for products (not for total, screen attached).

I've done some debugging and I've noticed that in administrator/components/com_virtuemart/helpers/currencydisplay.php line 373 (createPriceDiv function) there is an if statement that prevents the print of the tax:
Quote[...]
                //This could be easily extended by product specific settings
                if(!empty($this->_priceConfig[$name][0])){
[...]

In my case $this->_priceConfig[$name][0] is zero (only for the tax print)... Is that right? Or is a product issue? Have I to check my products parameters?

Commenting the if statement seems to solve... but it's quite dangerous (even if Milbo say me it's safe! :P ).

Let me know if you need more details.

Any help would be appreciated.
Thanks in advance.

[attachment cleanup by admin]
Title: Re: [BUG] "Show Tax in Cart" doesn't show tax in chart...
Post by: Milbo on July 22, 2013, 14:45:42 PM
Looks for me like a custom layout, because the general tax is there.
Title: Re: [BUG] "Show Tax in Cart" doesn't show tax in chart...
Post by: gain on July 22, 2013, 15:02:16 PM
My patch for making it works (also attached):

*** EDIT: THE PATCH IS WRONG cause shows taxamount in category list and productdetails also... :(

--- a/administrator/components/com_virtuemart/helpers/currencydisplay.php       2013-07-22 14:48:51.177353944 +0200
+++ b/administrator/components/com_virtuemart/helpers/currencydisplay.php       2013-07-22 14:42:58.301410636 +0200
@@ -370,7 +370,7 @@
                }^M
^M
                //This could be easily extended by product specific settings^M
-               if(!empty($this->_priceConfig[$name][0])){^M
+               if(!empty($this->_priceConfig[$name][0]) || $name == 'taxAmount'){^M
                        if(!empty($price) or $name == 'billTotal' or $name == 'billTaxAmount'){^M
                                $vis = "block";^M
                                $priceFormatted = $this->priceDisplay($price,0,(float)$quantity,false,$this->_priceConfig[$name][1],$name );^M


Hope it helps, breaking nothing... :|

Let me know if its ok.

PS: on my webserver $this->_priceConfig[$name][0] is zero, so empty is true and the if statement is not executed... maybe a php version issue? I don't think so... php.net (http://it2.php.net/empty) say that 0 is considered empty either as a string or as integer... any hint would be appreciated...
Title: Re: [BUG] "Show Tax in Cart" doesn't show tax in chart...
Post by: Milbo on July 22, 2013, 15:48:26 PM
disable the shoppergroup price display override.

Then post us a screenshot of your vm setting
Title: Re: [BUG] "Show Tax in Cart" doesn't show tax in chart...
Post by: gain on July 22, 2013, 15:58:58 PM
I've disabled the shoppergroup price override, but tax in cart are not visible again. The html span tag is empty (screen attached).

Price settings also attached... let me know if you need other settings...

Thanks

[attachment cleanup by admin]
Title: Re: [BUG] "Show Tax in Cart" doesn't show tax in chart...
Post by: gain on April 29, 2014, 12:58:47 PM
Problem persists with VirtueMart 2.6 too...
Title: Re: [BUG] "Show Tax in Cart" doesn't show tax in chart...
Post by: gain on April 29, 2014, 15:30:36 PM
I've understand the real problem only now.

VirtueMart allows you to show tax in products and not in cart, but not vice versa.

I'd thought that the Price Configuration > Show Tax in Cart option managed the entire visualization of the tax in cart, but that's not true: it managed the only column visualization instead!
If you enable it and not the Show Following Prices > Tax amount option, you'll have the colum in the cart but empty rows.

For a correct visualization you have to enable the Tax amount option too (see the attachment).

For hide the tax in products I've used this CSS:
div.browse-view div.PricetaxAmount,
div.productdetails div.PricetaxAmount {
  display: none !important;
}


[attachment cleanup by admin]