As requested- Here's a how to. I must stress that this should not be attempted unless you are confident with working with programming languages and make sure you back up your cart before doing anything else!!!.
Some of the coding takes place in the core modules rather than the user generated custom files.
First I added 2 new defines to the end of the list in ../includes/languages/custom/english.php. My additions tagged !!! AGM:
// extra product listing sorter
define('TEXT_PRODUCTS_LISTING_ALPHA_SORTER', '');
define('TEXT_PRODUCTS_LISTING_ALPHA_SORTER_NAMES', 'Items starting with ...');
define('TEXT_PRODUCTS_LISTING_ALPHA_SORTER_NAMES_RESET', '-- Reset --');
// Tax/VAT headings !!!
define('PRICE_EX_TAX_TEXT','Ex VAT'); // !!! AGM
define('PRICE_INC_TAX_TEXT','Inc VAT'); // !!! AGM
///////////////////////////////////////////////////////////
// include email extras
Then I added some Tax styles to my stylesheet at ../includes/templates/custom/css/stylesheet.css
.productSpecialPrice, .productSalePrice, .productSpecialPriceSale, .productPriceDiscount {
color: #ff0000;
}
.productTaxPrice // !!! AGM
{
color: #808080;
}
.productTaxIncTag, .productTaxExTag // !!! AGM
{
font-size: 80%;
}
.productTaxExTag // !!! AGM
{
color: #000000;
}
.productTaxIncTag // !!! AGM
{
color: #808080;
}
.orderHistList {
margin: 1em;
padding: 0.2em 0em;
list-style-type: none;
}
Next I changed the zen_add_tax function to include an override so that it would include tax in a price regardless of what the DISPLAY_PRICE_WITH_TAX value was set to. This is in ../includes/functions/functions_taxes.php. I did try saving this to a custom folder but zencart would handle it so I changed the main core code.
// Add tax to a products price based on whether we are displaying tax "in" the price !!! AGM- $include_tax is an override
function zen_add_tax($price, $tax, $include_tax='false') {
global $currencies;
if ( ($include_tax==true || DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) ) {
return zen_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + zen_calculate_tax($price, $tax);
} else {
return zen_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
}
}
I then added two more functions to the bottom of the currency class at ../includes/classes/currencies.php:
function display_price($products_price, $products_tax, $quantity = 1) {
return $this->format(zen_add_tax($products_price, $products_tax) * $quantity);
}
function display_price_with_tax($products_price, $products_tax, $quantity = 1) { // !!! AGM
return $this->format(zen_add_tax($products_price, $products_tax, true) * $quantity);
}
function display_price_without_tax($products_price, $products_tax, $quantity = 1) { // !!! AGM
return $this->format($products_price * $quantity);
}
}
?>
Finally I made some major changes to the zen_get_products_display_price function to provide the output. This is in ../includes/functions/functions_prices.php:
////
// Display Price Retail
// Specials and Tax Included
function zen_get_products_display_price($products_id) {
global $db, $currencies;
$free_tag = "";
$call_tag = "";
// 0 = normal shopping
// 1 = Login to shop
// 2 = Can browse but no prices
// verify display of prices
switch (true) {
case (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == ''):
// customer must be logged in to browse
return '';
break;
case (CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == ''):
// customer may browse but no prices
return TEXT_LOGIN_FOR_PRICE_PRICE;
break;
case (CUSTOMERS_APPROVAL == '3' and TEXT_LOGIN_FOR_PRICE_PRICE_SHOWROOM != ''):
// customer may browse but no prices
return TEXT_LOGIN_FOR_PRICE_PRICE_SHOWROOM;
break;
case ((CUSTOMERS_APPROVAL_AUTHORIZATION != '0' and CUSTOMERS_APPROVAL_AUTHORIZATION != '3') and $_SESSION['customer_id'] == ''):
// customer must be logged in to browse
return TEXT_AUTHORIZATION_PENDING_PRICE;
break;
case ((CUSTOMERS_APPROVAL_AUTHORIZATION != '0' and CUSTOMERS_APPROVAL_AUTHORIZATION != '3') and $_SESSION['customers_authorization'] > '0'):
// customer must be logged in to browse
return TEXT_AUTHORIZATION_PENDING_PRICE;
break;
default:
// proceed normally
break;
}
// show case only
if (STORE_STATUS != '0') {
if (STORE_STATUS == '1') {
return '';
}
}
// $new_fields = ', product_is_free, product_is_call, product_is_showroom_only';
$product_check = $db->Execute("select products_tax_class_id, products_price, products_priced_by_attribute, product_is_free, product_is_call from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'" . " limit 1");
$show_display_price = '';
$display_normal_price = zen_get_products_base_price($products_id);
$display_special_price = zen_get_products_special_price($products_id, true);
$display_sale_price = zen_get_products_special_price($products_id, false);
$show_sale_discount = '';
if (SHOW_SALE_DISCOUNT_STATUS == '1' and ($display_special_price != 0 or $display_sale_price != 0)) {
if ($display_sale_price) {
if (SHOW_SALE_DISCOUNT == 1) {
if ($display_normal_price != 0) {
$show_discount_amount = number_format(100 - (($display_sale_price / $display_normal_price) * 100),SHOW_SALE_DISCOUNT_DECIMALS);
} else {
$show_discount_amount = '';
}
$show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $show_discount_amount . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';
} else {
$show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $currencies->display_price(($display_normal_price - $display_sale_price), zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT . '</span>';
}
} else {
if (SHOW_SALE_DISCOUNT == 1) {
$show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . number_format(100 - (($display_special_price / $display_normal_price) * 100),SHOW_SALE_DISCOUNT_DECIMALS) . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';
} else {
$show_sale_discount = '<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . $currencies->display_price(($display_normal_price - $display_special_price), zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT . '</span>';
}
}
}
if ($display_special_price) {
$show_normal_price = '<span class="normalprice">' . $currencies->display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . ' </span>';
if ($display_sale_price && $display_sale_price != $display_special_price) {
$show_special_price = ' ' . '<span class="productSpecialPriceSale">' . $currencies->display_price($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</span>';
$show_price_with_tax='<br />'.'<span class="productTaxPrice">'.$currencies->display_price_with_tax($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</span>'; // !!! AGM
if ($product_check->fields['product_is_free'] == '1') {
$show_sale_price = '<br />' . '<span class="productSalePrice">' . PRODUCT_PRICE_SALE . '<s>' . $currencies->display_price($display_sale_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s>' . '</span>';
} else {
$show_sale_price = '<br />' . '<span class="productSalePrice">' . PRODUCT_PRICE_SALE . $currencies->display_price($display_sale_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</span>';
}
} else {
if ($product_check->fields['product_is_free'] == '1') {
$show_special_price = '<br />' . '<span class="productSpecialPrice">' . '<s>' . $currencies->display_price($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s>' . '</span>';
} else {
$show_special_price = '<br />' . '<span class="productSpecialPrice">' . $currencies->display_price($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</span>';
}
$show_sale_price = '';
$show_price_with_tax='<br />'.'<span class="productTaxPrice">'.$currencies->display_price_with_tax($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</span>'; // !!! AGM
}
} else {
if ($display_sale_price) {
$show_normal_price = '<span class="normalprice">' . $currencies->display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . ' </span>';
$show_special_price = '';
$show_sale_price = '<br />' . '<span class="productSalePrice">' . PRODUCT_PRICE_SALE . $currencies->display_price($display_sale_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</span>';
$show_price_with_tax='<br />'.'<span class="productTaxPrice">'.$currencies->display_price_with_tax($display_sale_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</span>'; // !!! AGM
} else {
if ($product_check->fields['product_is_free'] == '1') {
$show_normal_price = '<s>' . $currencies->display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . '</s>';
} else {
$show_normal_price = $currencies->display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id']));
}
$show_special_price = '';
$show_sale_price = '';
$show_price_with_tax='<br />'.'<span class="productTaxPrice">'.$currencies->display_price_with_tax($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</span>'; // !!! AGM
}
}
if($display_normal_price == 0) // don't show the $0.00
{
$final_display_price=''; // !!! AGM
$final_display_price_with_tax=''; // !!! AGM
$final_display_ex_tag=''; // !!! AGM
$final_display_inc_tag=''; // !!! AGM
}
else
{
$final_display_price = $show_normal_price; // !!! AGM
$final_display_price_with_tax=$show_price_with_tax; // !!! AGM
$final_display_ex_tag='<span class="productTaxExTag"> '.PRICE_EX_TAX_TEXT.'</span>'; // !!! AGM
$final_display_inc_tag='<span class="productTaxIncTag"> '.PRICE_INC_TAX_TEXT.'</span>'; // !!! AGM
}
// if DISPLAY_PRICE_WITH_TAX=2 !!! AGM
$final_display_price = $final_display_price . $show_special_price . $show_sale_price . $final_display_ex_tag . $show_sale_discount . $final_display_price_with_tax . $final_display_inc_tag; // !!! AGM
// else // !!! AGM
// $final_display_price = $final_display_price . $show_special_price . $show_sale_price . $show_sale_discount; // !!! AGM
// If Free, Show it
if ($product_check->fields['product_is_free'] == '1') {
if (OTHER_IMAGE_PRICE_IS_FREE_ON=='0') {
$free_tag = '<br />' . PRODUCTS_PRICE_IS_FREE_TEXT;
} else {
$free_tag = '<br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . OTHER_IMAGE_PRICE_IS_FREE, PRODUCTS_PRICE_IS_FREE_TEXT);
}
}
// If Call for Price, Show it
if ($product_check->fields['product_is_call']) {
if (PRODUCTS_PRICE_IS_CALL_IMAGE_ON=='0') {
$call_tag = '<br />' . PRODUCTS_PRICE_IS_CALL_FOR_PRICE_TEXT;
} else {
$call_tag = '<br />' . zen_image(DIR_WS_TEMPLATE_IMAGES . OTHER_IMAGE_CALL_FOR_PRICE, PRODUCTS_PRICE_IS_CALL_FOR_PRICE_TEXT);
}
}
return $final_display_price . $free_tag . $call_tag;
}
Hope that's helpful. Feel free to ask me any questions. I do want to add admin items to this as currently the scheme is hardwired rather than set by a variable switch- I think I've said before that I would like to make DISPLAY_PRICE_WITH_TAX at integer rather than a variable.