Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sub Total Displaying VAT


Get-Wireless 2

Recommended Posts

how do I stop the subtotal including VAT (tax)

 

IE it looks like

 

Sub Total = ?11.75

VAT = ?1.75

Total = ?11.75

 

When it should look like

 

Subtotal = ?10

VAT = ?1.75

Total = ?11.75

 

Regards

Shaun

Link to comment
Share on other sites

open your catalog\includes\classes\order.php locate this code:

 

		$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
	$this->info['subtotal'] += $shown_price;

 

replace it with this and try it.

 

		$shown_price = tep_add_tax($this->products[$index]['final_price'], 0) * $this->products[$index]['qty'];
	$this->info['subtotal'] += $shown_price;
	$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];

 

 

I guess you have prices to show with tax right?

Link to comment
Share on other sites

Hi Enigma1,

 

I have the discount coupons contribution installed on my store, so the code is slightly different and I am unsure how to edit it to make it display the subtotal without tax.

 

Display Prices With tax is set to true.

 

I have pasted the code below which is taken from my \catalog\includes\classes\orders.php

in the hope yourself or someone else can shed some light

 

//kgt - discount coupon
	$applied_discount = 0;
	$this_actual_shown_price = null;
	if( !empty( $this->info['coupon'] ) ) {
		$check_code_query = tep_db_query($sql = "select * from " . TABLE_DISCOUNT_COUPONS . " where coupons_id = '" . $this->info['coupon'] . "'");
		  $check_code = tep_db_fetch_array($check_code_query);
		  $applied_discount = tep_add_tax( $this->products[$index]['final_price'] * $check_code['coupons_discount_percent'], $this->products[$index]['tax'] ) * $this->products[$index]['qty'];
	  if( isset( $this->info['applied_discount'][$this->products[$index]['tax_description']] ) ) {
		  $this->info['applied_discount'][$this->products[$index]['tax_description']] += $applied_discount;
	  } else {
		$this->info['applied_discount'][$this->products[$index]['tax_description']] = $applied_discount;
	  }
	if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) {
		$this_actual_shown_price = (tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty']) - $applied_discount;
		$applied_discount = 0;
	  }
	}
		$shown_price = (tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty']) - $applied_discount; 
		$this->info['subtotal'] += $shown_price;
	if( isset( $this_actual_shown_price ) ) $shown_price = $this_actual_shown_price;
//end kgt - discount coupon

 

Regards

Shaun

Link to comment
Share on other sites

here are the 2 lines with the code you posted:

 

			$shown_price = (tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty']) - $applied_discount; 
		$this->info['subtotal'] += $shown_price;

 

Backup the file then replace it:

	   $shown_price = (tep_add_tax($this->products[$index]['final_price'], 0) * $this->products[$index]['qty']) - $applied_discount;
	$this->info['subtotal'] += $shown_price;
		$shown_price = (tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty']) - $applied_discount;

 

and try it.

Link to comment
Share on other sites

Thanks for such a speedy reply,

The subtotal is now taxless Woohoo

 

However the total hasnt had the tax added boohoo

 

I have doubled checked the settings,

 

In Admin under configuration\my Store:

Display Prices With Tax = True

 

Then under the Product I am using to test, The tax Class is set to V.A.T and the:

Products Price (Net): = ?6.3830

Products Price (Total): = ?7.50

 

 

The product I am testing on is priced at:

?6.38 + VAT

VAT @ 17.5% = ?1.1165

Total = ?7.50

 

When at the checkout Confirmation the total is ?6.38 and not ?7.50

Link to comment
Share on other sites

further down in that same file you should have some code like this:

 

	  if (DISPLAY_PRICE_WITH_TAX == 'true') {
	$this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
  } else {
	$this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
  }

 

change it to this:

 

		$this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];

Link to comment
Share on other sites

Thanks again for a speedy reply,

 

Looks like we are on to a winner.

 

Thank you very ver very much for your kind help

 

Regards

Shaun

 

However I have just tested using a coupon and the discounted amount is inclusive of the VAT and its supposed to be before VAT

Link to comment
Share on other sites

for that you may want to ask the support thread of the contribution. I am not familiar with the contribution details so if I post some code it may cause side effects.

Link to comment
Share on other sites

Ok, I will do that Enigma1,

 

Again thanks for your help in getting the subtotal to display properly

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...