CubeCart Tax Classes on Product Page

A client of mine sells a mix of VAT and VAT exempt products via a CubeCart 4 store I setup.

Although CubeCart allows this and calculates the VAT right on the checkout process, it doesn’t have any facility to show the customer which tax class the product falls into on the viewProd page.

Annoying.

cc tax As you can see we’ve got two main tax classes set. “+VAT” and “VAT Exempt”.

Here’s how to display this information on your viewProd page.

Step One – Edit includes/content/viewProd.inc.php

Around line 36 you will see $query. Replace with

$query = "SELECT I.*, C.cat_name, C.cat_father_id, I.taxType , ".$glob['dbprefix']."CubeCart_taxes.taxName
FROM ".$glob['dbprefix']."CubeCart_inventory AS I
LEFT JOIN ".$glob['dbprefix']."CubeCart_category AS C ON I.cat_id = C.cat_id
LEFT JOIN ".$glob['dbprefix']."CubeCart_taxes ON I.taxType = ".$glob['dbprefix']."CubeCart_taxes.id
WHERE I.disabled='0'
AND I.productId = ".$db->mySQLSafe($_GET['productId']);
Further down find,

> $view_prod->assign("TXT_DESCRIPTION",$prodArray[0]['description']);
Add below

>$view_prod->assign("TAX_TYPE",$prodArray[0]['taxName']);
Step Two - Edit skins/YOUR SKIN/styleTemplates/content/viewProd.tpl

Put the {TAX_TYPE} where you want the Tax Name to appear. Probably next to the price.

vat 2

vat

Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.