News:

Looking for documentation? Take a look on our wiki

Main Menu

Show prices excluding TAX in mini-cart and cart variants

Started by vigier, June 28, 2012, 22:45:44 PM

Previous topic - Next topic

vigier

Hi,

I'd like to show prices excluding TAX in the mini-cart and the cart variant.

Minicart:
They are shown by \modules\mod_virtuemart_cart\tmpl\default.php
Replacing
<div class="prices" style="float: right;"><?php echo  $product['prices'] ?></div>
by
<div class="prices" style="float: right;"><?php echo  $product['subtotal'] ?></div>

does show me the right prices, but they are unformatted. I want them to be formatted like usual, so "€ 99,95" instead of "99.9".
I found other code that does formatting, they all start with "$this->currency->". But when in that default.php, there is no "this".

Cart variant
No idea where to start...

What to do?


vigier

The mini-cart isn't a problem anymore since I just switched off the prices.
But does anyone know how to change the cart variant to show prices without tax?

jjk

Quote from: vigier on June 28, 2012, 22:45:44 PM
... "€ 99,95" instead of "99.9"...No idea where to start...

Formatting for your currency display is in Configuration - Currencies - Euro
For your question about prices without tax there is no simple answer. That depends on how you are using calculation and tax rules, which prices you enter into the product form, how you have set up your Configuration - Pricing, your VM2 version, etc.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

vigier

Hi,

Thnx for your reply. I think the settings of currency display are right, since everywhere the shown prices are in the correct format (€ as currency sign, rounding to 2 decimals). When I echo the subtotal field, it just isn't formatted.

About the other part:

  • VM 2.0.8a
  • Using a +19% tax calculation rule. That's also the only calculation rule I have.
  • I enter the price excluding tax as cost price, and VM does the rest.

Kind regards, Vigier

vigier

I tried it again and found it: administrator\components\com_virtuemart\models\customfields.php

Old code at custom type V (cart variant)
$price = strip_tags ($currency->priceDisplay ($calculator->calculateCustomPriceWithTax ($productCustom->custom_price)));

New code: just removed the calculate part...
$price = strip_tags ($currency->priceDisplay ($productCustom->custom_price));

The prices in the cart variant are shown the way I want them to be. And it still adds the right value to the total price. But is there any drawback? Some problem that might pop up after doing this?
I hope you can answer this question jjk.

Kind regards,
Vigier

jjk

Quote from: vigier on July 08, 2012, 22:02:03 PM
I hope you can answer this question jjk.

No, I can't. (I'm php illiterate)  ;)

...But I think your solution is a wrong solution (might work for you nevertheless), that doesn't solve the real problem. I suppose it's a bug elsewhere. In my case prices without tax don't show in the cart at all.
I think in your case you should be able to achieve what you want by displaying the price without tax in the product details view and select "Tax per Bill" in your tax rule.
However, since you seem to be located in a EU country, why do you want to display prices without tax? Are you selling B2B only?
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

vigier

I agree with you about that's acutually a wrong solution. But when I change the tax type to tax per bill, the calculation of tax in the cart goes wrong.
The tax is 19% over here. I added an article that costs € 5.00. The shipping costs are € 6.75, including € 1.08 tax. The right tax should be 19% of € 5.00 + € 1.08 = € 2.03.

When I switch to tax per product, the total amount of tax is € 2.03. 19% x € 5.00 = € 0.95. € 0.95 + € 1.08 (shipping) = € 2.03. This is the right amount.
When I switch to tax per bill, the total amount of tax is € 3.31, € 2.23 for the products and € 1.08 for sending the item. Where does the € 2.23 come from? 19% of (€ 5.00 + € 6.75) = € 2.23. But the € 6.75 already includes tax! So it calculates the tax more than double on the shipping costs.

I'm planning to sell mostly B2B, consumers are also welcome to my site. It's not live yet, planned to do that somewhere within a week.