Jump to content

UK - Show prices without/with tax on all pages?


Guest

Recommended Posts

Hi all,

I am trying to alter CC3 to show all my price (all over the site) with and without tax (VAT in the UK @ 17.5%). I have thought of just altering each page to add 17.5% manually, but if VAT were to change I would be left hunting through code again.

So I was wondering if there is an easy way to do this using the built in functionality? I have set my store so that prices don't include tax, and it will always be shipping to the UK, so all will have to pay VAT.

Has anyone done a similar mod? The tax rates don't appear to be stored in a global until a user has logged in - this doesn't apply to me, as all users will pay tax.

Any thoughts and help gratefully received.

Matt

Link to comment
Share on other sites

Guest estelle

Matt, if you want your prices to be shown including tax, the easiest way to do this is to include taxes in your prices to start off with.

Then in each place where "Subtotal" is displayed you could change this text to "Subtotal (incl. VAT)". This could probably be done simply by modifying lang.inc.php.

You may also want to make appropriate changes so that Tax is correctly displayed as a percentage of the subtotal, but is *not* added into the (Grand) Total.

Link to comment
Share on other sites

Thanks for the reply. I had considered that, but the person I am working on the site for wants prices to be shown as:

£price (£price (including VAT))

I am trying to make a flimsy mod to do this at the moment, but I wondered if there was any predefined methods.

Matt

Link to comment
Share on other sites

Guest estelle

You might be able to enable taxes (so that the total tax is shown as Tax: $x.xx during checkout and on receipts, etc), and then just modify the priceFormat() function in includes/functions.inc.php to display the price as "$price1 ($price2 incl. tax)". But this would be complicated if different tax percentages are involved, or if some things e.g. shipping are not taxed.

It would be a bit of a hack though. If you wanted to do it more properly you would need to pass more parameters to the priceFormat function so that it knows the "taxType" and can determine the right tax percentage. "taxType" is stored in the CubeCart_inventory table, and also in the CubeCart_config table as part of serialized data for each of the different shipping methods.

Link to comment
Share on other sites

Thanks again for the replies. I have cobbled together a working function, but actually, altering the priceFormat() function would make more sense.

I will have another play, but heres the very basic function for now:

function priceWithVAT($price) {

	$vatRate = 17.5;

	$price = $price + (($price / 100) * $vatRate);  

	if ($price == "0") { $price = "0.00"; }

	return $price;

}




Put that in functions.inc.php, then i've just altered the pages as necessary. E.g. with viewProd.inc.php:

Change:


$view_prod->assign("TXT_PRICE",priceFormat($prodArray[0]['price']));




to:




$view_prod->assign("TXT_PRICE", priceFormat($prodArray[0]['price']) . "<br><span class=\"vatPrice\">(".priceFormat(priceWithVAT($prodArray[0]["price"]))." inc. VAT)</span>");




And then adding a CSS class to style.css:


span.vatPrice {

	font-size: 85%;

	font-style: italic;

}

I know its sloppy, and doesn't take into account the languages etc, but it works for my needs :blink:

Matt

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...