Author Topic: display of prices  (Read 6265 times)

Tommy33

  • Beginner
  • *
  • Posts: 10
display of prices
« on: November 03, 2010, 10:34:04 am »
Hello,
I would like to ask, I have a problem with the display of prices.
In the Czech Republic we have different kinds of taxes (DPH) 20% and 10%. When you set up in the component VirtueMarket tax at 20% and 10%.

I know how to make a tax set by default to 20%. But when the subject will build with a 10% tax problem arises because the calculation is for 20%.

I would ask you, how do I make it my duty to the VM as calculated for the 20% to 10%? We deal with this over 7 days, I write on the forums, I did not find anywhere how I can do.

Do you understand what's my problem?

I have VirtueMart 1.1.4

Please help me!!!! :'(


seyi

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 401
    • AwoDev
Re: display of prices
« Reply #1 on: November 03, 2010, 13:04:57 pm »
Hi, do you have a product A that can be taxed at 2 differents tax rates?  Or is it product A is always taxed at 10% and product B is always taxed at 20%?  If it is the second, you should be able to setup the different tax rates in the tax section, and under the product select the correct VAT.
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate

mwenz

  • Jr. Member
  • **
  • Posts: 150
Re: display of prices
« Reply #2 on: November 03, 2010, 13:15:50 pm »
Hello Tommy33,

Someone who uses taxes will hopefully come along. I do not. (and Seyi did while I was writing...)

Looking the manual, I read that VM can allow multiple taxes. Are you saying you have multiple tax rates assigned and it is not working?

http://virtuemart.net/documentation/User_Manual/Tax_Rates.html

Take care, Mike

Tommy33

  • Beginner
  • *
  • Posts: 10
Re: display of prices
« Reply #3 on: November 03, 2010, 14:21:13 pm »
I'll try to write again and slowly ;D

Example (exactly the way I want it) :
price: 540 CZK (including VAT 20%) 450 CZK   <-20% VAT(DPH)
price: 495 CZK (including VAT 10%) 450 CZK   <-10% VAT(DPH)

VM see the price including tax, or price excluding tax. I need to show both of these prices, both with and without tax. ok? :D

When the tax is 20% to see the price with and without the 20% tax. And if the tax of 10% must display the price with and without 10% tax. The amount of tax set in the VM interface, I have set up tax-> CZE 0.2000 and 0.1000, that is fine.

Maybe I better explain it now, and I'm sorry

Thanks

mwenz

  • Jr. Member
  • **
  • Posts: 150
Re: display of prices
« Reply #4 on: November 03, 2010, 14:56:52 pm »
Thank you Tommy33.

I am sorry I cannot help. I don't know how to have two prices using different tax rates. It may be that you will need to hack VM in order to do this.

I don't know how a store set up like that would get customers to select the correct price--wouldn't everyone choose the lesser cost? But perhaps I am still not understanding.

If you only need to show one of those two taxes on any given product, depending on the type of product, I think you can do that by setting up a couple different tax rates and then choosing the tax rate within each product--but then, I don't use taxes so am unsure if the above is correct.

The display of the result is another issue.

Take care, Mike

Tommy33

  • Beginner
  • *
  • Posts: 10
Re: display of prices
« Reply #5 on: November 03, 2010, 15:17:10 pm »
In the Czech Republic, the tax is determined by the state. The products 20% and some 10%. In the web interface, the VM I choose the product according to what the tax will be there. A VM must see these prices.

how can we make VM show 2 prices? one with no taxes and other taxes, I choose tax (20% or 10%). VM has the duty to calculate and display correctly especially.

I don´t know where else than here I can get good advice on what to do :'(

seyi

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 401
    • AwoDev
Re: display of prices
« Reply #6 on: November 03, 2010, 15:51:46 pm »
Hi Tommy, I think what you want is to display 2 prices on each product, the net price and the gross price.  I do not believe this can be done through the settings, you would have to modify the templates.

Another idea... if you need to display gross price to regular customers and net price + tax to business customers, then you could create 2 shopper groups, and within the shopper group setting select how you want product prices displayed.
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate

Tommy33

  • Beginner
  • *
  • Posts: 10
Re: display of prices
« Reply #7 on: November 04, 2010, 10:03:22 am »
hello, but I need to be shown both these prices all the time for all customers.

it is clear that it will have to edit your template, and here I just want to learn how to do. The forums in the Czech Republic, I still could not advise anyone to do it, so I came to you and doufýám that you will find a programmer that could modify this code for me.

seyi

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 401
    • AwoDev
Re: display of prices
« Reply #8 on: November 04, 2010, 13:38:01 pm »
Ok tommy, this can get ugly.  I would recommend you backup all your files before making any of these changes.  For the product detail page, these are the changes you can make:

www/administrator/components/com_virtuemart/classes/ps_product, at the end of function show_price, you can calculate the base price and gross price, and pass that into the template.  Something like this:
Code: [Select]
<?php
if ($auth["show_price_including_tax"] == 1) {
$base_price_with_tax $base_price;
$base_price -= ($my_taxrate $base_price);
}
else {
$my_taxrate $this->get_product_taxrate($product_id);
$base_price_with_tax  = ($my_taxrate $base_price);
}
$tpl->set'discount_info'$discount_info );
$tpl->set'text_including_tax'$text_including_tax );
$tpl->set'undiscounted_price', @$undiscounted_price );
$tpl->set'base_price'$base_price );
$tpl->set'base_price_with_tax'$base_price_with_tax );
$tpl->set'price_table'$html);
return $tpl->fetch'common/price.tpl.php');
?>

Then within the template, www/components/com_virtuemart/themes/default/templates/common/price.tpl.php, you can display both prices as you like, for example:
Code: [Select]
<span class="productPrice">
<?php echo $CURRENCY_DISPLAY->getFullValue($base_price?>,
<?php echo $text_including_tax ?>
</span>
<span class="productPrice">
<?php echo $CURRENCY_DISPLAY->getFullValue($base_price_with_tax?>
<?php echo $text_including_tax ?>
</span>
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate

Tommy33

  • Beginner
  • *
  • Posts: 10
Re: display of prices
« Reply #9 on: November 10, 2010, 11:56:36 am »
please, where exactly do I put the condition? I do not know exactly where and when I put it in the end, writes me that message.

www/administrator/components/com_virtuemart/classes/ps_product, at the end of function show_price

exactly where? would not it be better if I were in the mail, send the file "ps_product" You put me there, and I just ordered on the web.
He would do it for me? Or if you got the file with me so I can send it by e-mail: tommmy33@gmail.com?? too please!


Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION in /httpd/html/vivatruckeu/www/administrator/components/com_virtuemart/classes/ps_product.php on line 2878

seyi

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 401
    • AwoDev
Re: display of prices
« Reply #10 on: November 10, 2010, 12:34:12 pm »
Hi Tommy, at the very end of the show_price function is this:
Code: [Select]
<?php
$tpl->set'discount_info'$discount_info );
$tpl->set'text_including_tax'$text_including_tax );
$tpl->set'undiscounted_price', @$undiscounted_price );
$tpl->set'base_price'$base_price );
        
$tpl->set'price_table'$html);
return $tpl->fetch'common/price.tpl.php');
?>

Replace it with this:
Code: [Select]
<?php
if ($auth["show_price_including_tax"] == 1) {
$base_price_with_tax $base_price;
$base_price -= ($my_taxrate $base_price);
}
else {
$my_taxrate $this->get_product_taxrate($product_id);
$base_price_with_tax  = ($my_taxrate $base_price);
}
$tpl->set'discount_info'$discount_info );
$tpl->set'text_including_tax'$text_including_tax );
$tpl->set'undiscounted_price', @$undiscounted_price );
$tpl->set'base_price'$base_price );
$tpl->set'base_price_with_tax'$base_price_with_tax );
$tpl->set'price_table'$html);
return $tpl->fetch'common/price.tpl.php');
?>


Do not include "<?php" at the beginning or "?>" at the end.  See if that works.
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate

Tommy33

  • Beginner
  • *
  • Posts: 10
Re: display of prices
« Reply #11 on: November 10, 2010, 12:59:50 pm »
uaaaaaaaaaaa!! You're really the best: ;D ;D ;D ;D ;D thanks a lot !!!!


it works just fine! even just a tiny little thing. I have the two prices is the same description (including VAT), where exactly do I change the label? (change: -> no VAT / VAT) and then it all is as you imagine it

seyi

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 401
    • AwoDev
Re: display of prices
« Reply #12 on: November 10, 2010, 13:22:15 pm »
Glad you got it working.

That text is probably coming from the $text_including_tax variable.  In your common/price.tpl.php file, you can hard code it, for example:

Code: [Select]
<span class="productPrice">
<?php echo $CURRENCY_DISPLAY->getFullValue($base_price?>,
no VAT
</span>
<span class="productPrice">
<?php echo $CURRENCY_DISPLAY->getFullValue($base_price_with_tax?>
VAT
</span>
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate

Tommy33

  • Beginner
  • *
  • Posts: 10
Re: display of prices
« Reply #13 on: November 10, 2010, 13:29:37 pm »
great, it works! ;D once again thank you very much, when I have a problem I turn to You! ;D

Tommy33

  • Beginner
  • *
  • Posts: 10
Re: display of prices
« Reply #14 on: November 11, 2010, 10:53:39 am »
Hello friends, I experienced another problem with counting rates. Price with VAT is displayed correctly, but the price without VAT Sun The VM in the component is correctly registered. I think it's a problem somewhere in the conversion / calculation of price. Price without VAT for a few bucks less. Any idea please where could be the problem?? Thank :)