Forums / Currencies & Sales Taxes, VAT, GST, etc. / Custom OT Module, Subtotal without tax

Custom OT Module, Subtotal without tax

Started by teva on 21 Feb 2008, 2:39 PM · Views: 6,945

Results 1 to 10 of 10
21 Feb 2008, 2:39 PM
#1
teva avatar

teva

Zen Follower

Join Date:
Sep 2004
Posts:
101
Plugin Contributions:
0

Custom OT Module, Subtotal without tax

Is there a way to add another subtotal module, that would show price without tax?

On checkout i now have

Subtotal = 12
tax = 1
total = 12

I want

Subtotal = 12
Subtotal without tax = 11
tax = 1
total = 12

I have duplicated ot_subtotal module and language file, changed subtotal values to subtotal1. They are shown in the admin panel, but not on checkout page.

Tnx

21 Feb 2008, 3:06 PM
#2
teva avatar

teva

Zen Follower

Join Date:
Sep 2004
Posts:
101
Plugin Contributions:
0

Re: Custom OT Module, Subtotal without tax

Ok, i have found a problem with displaying the module in checkout. I had to change sort order.
Now i have two modules, both showing same price (inc tax). What must i change to get new module, show subtotal without tax? Can this be done in ot modules?

tnx

21 Feb 2008, 3:23 PM
#3
teva avatar

teva

Zen Follower

Join Date:
Sep 2004
Posts:
101
Plugin Contributions:
0

Re: Custom OT Module, Subtotal without tax

Ok, this is funny. I spend two hours searching for solution here and only after posting this "monologue" thread i found a solution.

in new, duplicated module, i have changed this

around line 40
'text' => $currencies->format($order->info['subtotal'], true, $order->info['currency'], $order->info['currency_value']),

to this

'text' => $currencies->format($order->info['subtotal']-$order->info['tax'], true, $order->info['currency'], $order->info['currency_value']),

So i have added this " -$order->info['tax'] "

tnx

18 Jul 2009, 4:17 PM
#4
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,879
Plugin Contributions:
7

Re: Custom OT Module, Subtotal without tax

When I try this, it subtracts the product tax AND the shipping from the product subtotal.
I assume you have long since fixed this, so how did you do it?

Thanks
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

18 Jan 2010, 2:56 PM
#5
bikeforce avatar

bikeforce

New Zenner

Join Date:
Sep 2009
Posts:
73
Plugin Contributions:
0

Re: Custom OT Module, Subtotal without tax

Doesnt seem to work for me on step 3 - of 3 - dont know where its getting that subtotal from - didnt think it would be that simple....

26 Nov 2010, 4:28 PM
#6
rafitaa avatar

rafitaa

New Zenner

Join Date:
Jun 2010
Posts:
1
Plugin Contributions:
0

Re: Custom OT Module, Subtotal without tax

I don't know if someone already responded or if you already figured out, however as no response was placed here I am posting what I did.
I only modified one file which is /includes/modules/order_total/ot_subtotal.php

Now the original file had the following line:

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

And I change such code for:

 if (DISPLAY_PRICE_WITH_TAX == 'true') {
 
 	$newsubtotal=$order->info['subtotal']-$order->info['tax'];

 } else {

 	//$newsubtotal=$order->info['subtotal'];
 
 }

 
  
  $this->output[] = array('title' => $this->title . ':',
                          'text' => $currencies->format($newsubtotal, true, $order->info['currency'], $order->info['currency_value']),
                          'value' => $newsubtotal);

Please note this will only substract the tax amount from the subtotal if the taxes are included in the price, and also that this is basically a cosmetic change only for it to be displayed properly ar check out.

Hope it helps!

THNX!

1 Jan 2011, 11:47 PM
#7
deathman2006 avatar

deathman2006

New Zenner

Join Date:
Apr 2010
Location:
London, UK
Posts:
38
Plugin Contributions:
0

Re: Custom OT Module, Subtotal without tax

Hi, with this method it subtracts the tax from the product but not from the shipping, how can i change it to subtract tax from everything?

Clever AV Ltd
http://www.cleveravltd.co.uk
ZenCart 1.3.9g

29 May 2011, 12:31 PM
#8
b_n avatar

b_n

New Zenner

Join Date:
May 2011
Location:
Valencia, España
Posts:
1
Plugin Contributions:
0

Re: Custom OT Module, Subtotal without tax

Someone find a solution to the question of deathman2006.

I look the same but also with two VAT because now I have products with different types of taxes, and in Spain you must show the tax bases of each tax.

Should I clone the module taxes? So when one finds a vat show only their tax base, and when he finds two show the two tax bases.

I use the version of Zencart 1.38a
I have installed Edit Orders module, PDF Order Center, Include and Exclude Tax in Prices (Nett / Gross), but I want to delete the latter. And show in store prices with taxes included.

Thanks in advance.
Sorry for my English.

7 Nov 2011, 6:13 PM
#9
shippers avatar

shippers

New Zenner

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

Re: Custom OT Module, Subtotal without tax

@rafitaa - For the record - it worked for me - thank you.

28 Feb 2012, 8:57 PM
#10
faldinio avatar

faldinio

New Zenner

Join Date:
Nov 2011
Location:
UK
Posts:
1
Plugin Contributions:
0

Re: Custom OT Module, Subtotal without tax

deathman2006:

Hi, with this method it subtracts the tax from the product but not from the shipping, how can i change it to subtract tax from everything?

I had the same problem and the thread is old so original poster may have solved themselves, but for anyone else who struggled like me, here is a solution I think works. I do not know php so I have thrown this together by just examining the thread and the files and trial and error.

in ot_subtotal change:

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

to a similar change as suggested before:

$newsubtotal=$order->info['subtotal']-$order->info['tax']+$order->info['shipping_tax'];

		} else {

	//$newsubtotal=$order->info['subtotal'];

}

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

now also change ot_shipping from this:

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

to this:

if (DISPLAY_PRICE_WITH_TAX == 'true') {

	$newsubtotal=$order->info['subtotal']-$order->info['tax']+$order->info['shipping_tax'];

		} else {

	//$newsubtotal=$order->info['subtotal'];

}

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

This worked for me and displayed the correct subtotal ex tax and shipping ex tax.

Hope that helps save someone a few hours.

Cheers.

Faldinio.
http://www.localorie.co.uk