Zen Cart Logo
Forums / Currencies & Sales Taxes, VAT, GST, etc. / Showing price with and without tax

Showing price with and without tax

Views: 13,083

Results 1 to 20 of 20
30 Aug 2006, 8:50 AM
#1
raymasa avatar

raymasa

New Zenner

Join Date:
May 2006
Posts:
24
Plugin Contributions:
0

Showing price with and without tax

Hi all,

Is it possible to display two different prices for a product, one with tax and the other without? I know in the configure store I can select to either show the price with and without, but what if I want to show both prices for the product? For example, show both of the following for each product:

9.95 (without tax)
10.70 (with tax)

Thanks,

Ray

30 Aug 2006, 6:04 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Showing price with and without tax

Displaying more than one price at a time is not a built-in feature of Zen Cart at the present time.

If you wanted to code it yourself, I just noted that there are 1807 references to "price" in the code, and 994 references to "tax". Might be an all-nighter... :shocking:

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

31 Aug 2006, 9:31 AM
#3
raymasa avatar

raymasa

New Zenner

Join Date:
May 2006
Posts:
24
Plugin Contributions:
0

Re: Showing price with and without tax

Ah, bummer.....well, I will try and deal with one price...:).

Thanks for your help.

Ray

22 Oct 2006, 8:12 PM
#4
dave71 avatar

dave71

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Showing price with and without tax

Right
There is a way to code this into currencies (probably not the cleanest way but it works)

OK here's what to do

Set up Zen cart to (Display Prices with Tax = false)

Then

Change the order totals to

Shipping to 200
Subtotal to 300
VAT to 400
Total to 500

Then open \includes\classes\currencies.php
look for around line 71

 function display_price($products_price, $products_tax, $quantity = 1) {
      return $this->format(zen_add_tax($products_price, $products_tax) * $quantity);
    }
  }

change to

 function display_price($products_price, $products_tax, $quantity = 1) {
  return $this->format ($products_price * $quantity) . ' ex. <img border="0" src="images/pixel_trans.gif" width="2%" height="1"><span class="incvat">' . $this->format (zen_add_tax($products_price, $products_tax)* 1.175* $quantity) . ' inc.' . '</span>';
return $return_this;
	  }
    }

then open
\includes\modules\order_total\ot_subtotal.php

look for around line 35

    function process() {
      global $order, $currencies;
      $this->output[] = array('title' => $this->title . ':',
                              'text' => $currencies->format($order->info['subtotal'], true, $order->info['currency'], $order->info['currency_value']),
                              'value' => $order->info['subtotal']);
    }

change to

 function process() {
      global $order, $currencies;
      $this->output[] = array('title' => $this->title . ':',
                              'text' => $currencies->format($order->info['subtotal']+$order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']),
                              'value' => $order->info['subtotal']);
    }

PLEASE ENSURE THAT YOU BACKUP BEFORE CHANGING ANY OF THE FILES

Hope this helps

Dave

25 Oct 2006, 10:56 PM
#5
sn0ut avatar

sn0ut

New Zenner

Join Date:
Oct 2005
Location:
UK - London
Posts:
56
Plugin Contributions:
3

Re: Showing price with and without tax

thats a good fix and almost solves my problems too, thanks for kicking me down the correct path :) prob is... now every product has vat applied to it and not all of my shop items are taxable :(

Any ideas how

function display_price($products_price, $products_tax, $quantity = 1) {
  return $this->format ($products_price * $quantity) . ' ex. <img border="0" src="images/pixel_trans.gif" width="2%" height="1"><span class="incvat">' . $this->format (zen_add_tax($products_price, $products_tax)* 1.175* $quantity) . ' inc.' . '</span>';
return $return_this;
      }
    }  

Can have a test statement in it to see whether the product has a tax class or not?

Thanks

27 Oct 2006, 7:57 AM
#6
raymasa avatar

raymasa

New Zenner

Join Date:
May 2006
Posts:
24
Plugin Contributions:
0

Re: Showing price with and without tax

Hi Dave71,

Awesome, thanks for the solution. I will give that a try on my install.

Ray

27 Oct 2006, 8:23 AM
#7
lloyd_borrett avatar

lloyd_borrett

Zen Follower

Join Date:
Mar 2006
Location:
Rosebud, Victoria, Australia
Posts:
308
Plugin Contributions:
2

Re: Showing price with and without tax

G'day,

I haven't tackled displaying the ex and inc tax prices to shoppers as I don't need that feature.

However, I was annoyed that the admin product preview page didn't show both prices and coded a fix for that. See http://www.zen-cart.com/forum/showthread.php?t=48921

Best Regards, Lloyd Borrett.

Zen Cart 1.5.5e, PHP 5.3.29 MySQL 5.5.42

27 Oct 2006, 9:33 AM
#8
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Showing price with and without tax

Is this what you're after ... www.fastlec.co.uk ?

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

27 Oct 2006, 7:56 PM
#9
dave71 avatar

dave71

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Showing price with and without tax

sn0ut:

thats a good fix and almost solves my problems too, thanks for kicking me down the correct path :) prob is... now every product has vat applied to it and not all of my shop items are taxable :(

Any ideas how

function display_price($products_price, $products_tax, $quantity = 1) {
return $this->format ($products_price * $quantity) . ' ex. <img border="0" src="images/pixel_trans.gif" width="2%" height="1"><span class="incvat">' . $this->format (zen_add_tax($products_price, $products_tax)* 1.175* $quantity) . ' inc.' . '</span>';
return $return_this;
}
}

> 
> Can have a test statement in it to see whether the product has a tax class or not?
> Thanks



Try this......

```php
function display_price($products_price, $products_tax, $quantity = 1) {
if ($products_tax ='ENTER TAX CLASS ID HERE FOR NON TAXABLE ITEM THIS IS A NUMBER'){
 return $this->format ($products_price * $quantity) . '  No Tax'; 
 }else{
  return $this->format ($products_price * $quantity) . ' ex. <img border="0" src="images/pixel_trans.gif" width="2%" height="1"><span class="incvat">' . $this->format (zen_add_tax($products_price, $products_tax)* 1.175* $quantity) . ' inc.' . '</span>';
return $return_this;
      }
    }  
}

As above (obviously changing the text No tax, to what is appropriate) should do what you want it to (Changing the tax class to a number which corresponds to a non taxable ID)

Let me know how you get on

27 Oct 2006, 10:49 PM
#10
sn0ut avatar

sn0ut

New Zenner

Join Date:
Oct 2005
Location:
UK - London
Posts:
56
Plugin Contributions:
3

Re: Showing price with and without tax

thanks for the reply mate... added that code and tested.

It seems to ignore the if statement and just does the first oart for every product, so it shows every product as being tax free!

Is $products_tax defined somewhere or should I redeclare it again in that page?

28 Oct 2006, 10:34 AM
#11
dave71 avatar

dave71

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Showing price with and without tax

sn0ut:

thanks for the reply mate... added that code and tested.

It seems to ignore the if statement and just does the first oart for every product, so it shows every product as being tax free!

Is $products_tax defined somewhere or should I redeclare it again in that page?

Sorry I should have tested the code before posting

Try this

function display_price($products_price, $products_tax, $quantity = 1) { 
if ($products_tax ='0'){ 
 return $this->format ($products_price * $quantity) . '  No Tax';  
 }else{ 
  return $this->format ($products_price * $quantity) . ' ex. <img border="0" src="images/pixel_trans.gif" width="2%" height="1"><span class="incvat">' . $this->format (zen_add_tax($products_price, $products_tax)* 1.175* $quantity) . ' inc.' . '</span>'; 
return $return_this; 
      } 
    }   
}  

So if the products tax rate is '0' it will show price no tax

Dave

28 Oct 2006, 6:43 PM
#12
sn0ut avatar

sn0ut

New Zenner

Join Date:
Oct 2005
Location:
UK - London
Posts:
56
Plugin Contributions:
3

Re: Showing price with and without tax

thanks for your time and the reply m8..

Does this work on your store? because I modified the code and it does not seem to work. I tried changing the tax value to 17.5 and swapping the returns over still does not work.

Im thinking it could be a modification that have made to my store.

EDIT:

Made it work on my store by adding a < before the equals sign:

function display_price($products_price, $products_tax, $quantity = 1) { 
if ($products_tax <='0.0000'){ 
 return $this->format ($products_price * $quantity) . '  No Tax';  
 }else{ 
  return $this->format ($products_price * $quantity) . ' ex. <img border="0" src="images/pixel_trans.gif" width="2%" height="1"><span class="incvat">' . $this->format (zen_add_tax($products_price, $products_tax)* 1.175* $quantity) . ' inc.' . '</span>'; 
return $return_this; 
      } 
    }   
} 

Thanks for your help :)

15 Nov 2006, 9:40 AM
#13
jodz avatar

jodz

New Zenner

Join Date:
Nov 2006
Posts:
44
Plugin Contributions:
0

Re: Showing price with and without tax

Execellny Guide, Thanks Dave. Thought i'd bump this post. I would add this to tutorials or pin it tbh!

20 Nov 2006, 4:47 PM
#14
jodz avatar

jodz

New Zenner

Join Date:
Nov 2006
Posts:
44
Plugin Contributions:
0

Re: Showing price with and without tax

I done a quick edit of the code so that if you just want it to say Inc Vat and not the Ex Vat.

function display_price($products_price, $products_tax, $quantity = 1) { 
if ($products_tax <='0.0000'){ 
 return $this->format ($products_price * $quantity) . '  No Tax';  
 }else{ 
return $this->format (zen_add_tax($products_price, $products_tax)* 1.175* $quantity) . '<span class="incvat">' . ' inc. vat' . '</span>';
return $return_this; 
      } 
    }   
}  

:smartass:

Hope this is of some help to yous peoples.

2 Dec 2006, 6:43 AM
#15
tphoare avatar

tphoare

New Zenner

Join Date:
Sep 2005
Location:
London
Posts:
88
Plugin Contributions:
0

Re: Showing price with and without tax

Does this work with price by attribute?

We tried it and it worked fine on the products themselves but completely screwed up when priced by attribute. The attribute box includes all the formatting code rather than just the two prices.

20 Feb 2008, 5:41 PM
#16
barricades avatar

barricades

Inactive

Join Date:
May 2007
Posts:
150
Plugin Contributions:
0

Re: Showing price with and without tax

We sell a fair bit to the USA from Northern Ireland and I wonder if there is a way to only show IncVAT if the person is shopping in £s or Euros?

Cheers

29 Jan 2009, 12:27 AM
#18
mojodk avatar

mojodk

New Zenner

Join Date:
Jun 2008
Posts:
6
Plugin Contributions:
0

Re: Showing price with and without tax

..might be an allnighter... hiih. nice one

4 Jan 2011, 7:40 PM
#19
webmc avatar

webmc

New Zenner

Join Date:
Jul 2010
Location:
Kent UK
Posts:
50
Plugin Contributions:
0

Re: Showing price with and without tax

This seems like a primitive method of doing this, especially as vat has now gone up to 20%!:no: you should maybe try to use variables instead of hardcoding the current tax rate of one country. You have also failed to take into account other currencies and wont be able to use the european tax module.....

25 Jan 2011, 6:22 AM
#20
liizz avatar

liizz

New Zenner

Join Date:
Jan 2011
Posts:
58
Plugin Contributions:
0

Re: Showing price with and without tax

Hi.

I did try the code Dave1 gave, it works only for one currency.

When I change my currency code, i got a blank screen.

Also, I use attribute pricing bt it displays the price with VAT also..
How to make attribute pricing not affected by the VAT stuff?

I really need a quick fix for it!! :huh:

HELLLLPPPPP!!!

Thanks

Liizz