I ran into the same problem Spo0f had (Inc/Ex prices mixed up/etc) when I recently upgraded to the 1.30a version.
I've managed to fix it, without seeming to break anything... or so I think at the moment.
I altered, and added, something on two lines in the display_price and display_price_inc_ex_tax functions. Along with editing two lines in the check_inc_ex_status function. All the edits were essentially relating to changing any instance of DISPLAY_PRICE_WITH_TAX to DISPLAY_PRICE_WITH_TAX_EXTENDED.
Below is my edited code file:
<?php
/**
* inc_ex_functions
*
* @copyright Copyright 2008 Andrew Moore
* @copyright Portions 2003-2007 Zen Cart Development Team
* @license [url]http://www.zen-cart.com/license/2_0.txt[/url] GNU Public License V2.0
*/
if(!function_exists(zen_get_products_display_price))
{
function zen_get_products_display_price($products_id)
{
return get_products_display_price($products_id);
}
}
////
// Display Price Retail
// Specials and Tax Included/Excluded
function get_products_display_price($products_id)
{
global $db, $currencies;
$free_tag="";
$call_tag="";
// show case only
if (STORE_STATUS=='1')
return '';
if(CUSTOMERS_APPROVAL=='1' && $_SESSION['customer_id']=='') // customer must be logged in to browse
return '';
else
if(CUSTOMERS_APPROVAL=='2' && $_SESSION['customer_id']=='') // customer may browse but no prices
return TEXT_LOGIN_FOR_PRICE_PRICE;
else
if(CUSTOMERS_APPROVAL=='3' && TEXT_LOGIN_FOR_PRICE_PRICE_SHOWROOM!='') // customer may browse but no prices unless no prompt is set
return TEXT_LOGIN_FOR_PRICE_PRICE_SHOWROOM;
else
if((CUSTOMERS_APPROVAL_AUTHORIZATION!='0' && CUSTOMERS_APPROVAL_AUTHORIZATION!='3') && ($_SESSION['customer_id']=='' || $_SESSION['customers_authorization']>'0')) // customer must be logged in to browse
return TEXT_AUTHORIZATION_PENDING_PRICE;
// $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);
$discount_price=($display_sale_price!=0?$display_sale_price:display_special_price);
if(SHOW_SALE_DISCOUNT_STATUS=='1' && ($display_special_price!=0 || $display_sale_price!=0))
if(SHOW_SALE_DISCOUNT=='1')
if($display_normal_price!=0)
$discount_amount=($display_normal_price!= 0?(100-(($discount_price/$display_normal_price)*100)):0);
else
$discount_amount=$display_normal_price-$discount_price;
if($discount_amount)
if (SHOW_SALE_DISCOUNT==1)
$show_sale_discount='<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . number_format($discount_amount,SHOW_SALE_DISCOUNT_DECIMALS) . PRODUCT_PRICE_DISCOUNT_PERCENTAGE . '</span>';
else
$show_sale_discount='<span class="productPriceDiscount">' . '<br />' . PRODUCT_PRICE_DISCOUNT_PREFIX . display_price($discount_amount, zen_get_tax_rate($product_check->fields['products_tax_class_id'])) . PRODUCT_PRICE_DISCOUNT_AMOUNT . '</span>';
if(DISPLAY_PRICE_WITH_TAX_EXTENDED=='inc/ex')
$inc_ex_class='productTaxExPrice';
else
if(DISPLAY_PRICE_WITH_TAX_EXTENDED=='ex/inc')
$inc_ex_class='productTaxPrice';
if($display_special_price)
{
$show_normal_price='<span class="normalprice">'.display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).' </span>';
$show_price_inc_ex_tax='<br />'.'<span class="'.$inc_ex_class.'">'.display_price_inc_ex_tax($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</span>'; // !!! AGM
if ($display_sale_price && $display_sale_price!=$display_special_price)
{
$show_special_price=' '.'<span class="productSpecialPriceSale">'.display_price($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</span>';
if ($product_check->fields['product_is_free']=='1')
$show_sale_price='<br />'.'<span class="productSalePrice">'.PRODUCT_PRICE_SALE.'<s>'.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.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>'.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">'.display_price($display_special_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</span>';
$show_sale_price='';
}
}
else
{
if ($display_sale_price)
{
$show_normal_price='<span class="normalprice">'.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.display_price($display_sale_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</span>';
$show_price_inc_ex_tax='<br />'.'<span class="'.$inc_ex_class.'">'.display_price_inc_ex_tax($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_normal_price='<s>'.display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</s>';
else
$show_normal_price=display_price($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id']));
$show_special_price='';
$show_sale_price='';
$show_price_inc_ex_tax='<br />'.'<span class="'.$inc_ex_class.'">'.display_price_inc_ex_tax($display_normal_price, zen_get_tax_rate($product_check->fields['products_tax_class_id'])).'</span>';
}
}
$final_display_price='';
$final_display_price_inc_ex_tax='';
$final_display_ex_tag='';
$final_display_inc_tag='';
if(zen_get_tax_rate($product_check->fields['products_tax_class_id'])==0)
{
$final_display_price=$show_normal_price.' '.PRICE_ZERO_TAX_TEXT;
}
else
if($display_normal_price!=0) // don't show the $0.00
{
$final_display_price=$show_normal_price;
$final_display_price_inc_ex_tax=$show_price_inc_ex_tax;
$final_display_ex_tag='<span class="productTaxExTag"> '.PRICE_EX_TAX_TEXT.'</span>';
$final_display_inc_tag='<span class="productTaxIncTag"> '.PRICE_INC_TAX_TEXT.'</span>';
}
switch(DISPLAY_PRICE_WITH_TAX_EXTENDED)
{
case 'ex/inc':
$final_display_price=$final_display_price.$show_special_price.$show_sale_price.$final_display_ex_tag.$show_sale_discount.$final_display_price_inc_ex_tax.$final_display_inc_tag; // !!! AGM
break;
case 'inc/ex':
$final_display_price=$final_display_price.$show_special_price.$show_sale_price.$final_display_inc_tag.$show_sale_discount.$final_display_price_inc_ex_tax.$final_display_ex_tag; // !!! AGM
break;
default:
check_inc_ex_status();
if(isset($_SESSION["inc_ex_tax"]))
if($_SESSION["inc_ex_tax"])
$final_display_price=$final_display_price.$show_special_price.$show_sale_price.$final_display_inc_tag.$show_sale_discount;
else
$final_display_price=$final_display_price.$show_special_price.$show_sale_price.$final_display_ex_tag.$show_sale_discount;
else
$final_display_price=$final_display_price.$show_special_price.$show_sale_price.$show_sale_discount;
break;
}
// 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;
}
function display_price($price,$tax)
{
check_inc_ex_status();
if(((isset($_SESSION["inc_ex_tax"]) && $_SESSION["inc_ex_tax"]) || (!isset($_SESSION["inc_ex_tax"]) && (DISPLAY_PRICE_WITH_TAX_EXTENDED=='true' || DISPLAY_PRICE_WITH_TAX_EXTENDED=='inc/ex'))) && $tax>0)
return display_price_with_tax($price,$tax);
else
return display_price_without_tax($price);
}
function display_price_inc_ex_tax($price,$tax) // Displays price ex tax when set to 'true' or 'inc/ex' and visa versa
{
check_inc_ex_status();
if(((isset($_SESSION["inc_ex_tax"]) && $_SESSION["inc_ex_tax"]) || (!isset($_SESSION["inc_ex_tax"]) && (DISPLAY_PRICE_WITH_TAX_EXTENDED=='true' || DISPLAY_PRICE_WITH_TAX_EXTENDED=='inc/ex'))) && $tax>0)
return display_price_without_tax($price);
else
return display_price_with_tax($price,$tax);
}
function display_price_with_tax($price,$tax)
{
global $currencies;
return $currencies->format(zen_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + zen_calculate_tax($price, $tax));
}
function display_price_without_tax($price)
{
global $currencies;
return $currencies->format(zen_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']));
}
function set_inc_ex_display($price_ex,$price_inc)
{
global $currencies;
$content="";
if($price_ex==$price_inc) // Zero tax
{
$content='<span class="productTaxZeroPrice">'.' '.$currencies->format($price_ex).' '.PRICE_ZERO_TAX_TEXT.'</span>';
}
else
switch(DISPLAY_PRICE_WITH_TAX_EXTENDED)
{
case 'ex/inc':
$content .= '<span class="productTaxExPrice">'.' '.$currencies->format($price_ex).'</span>';
$content .= '<span class="productTaxExTag"> '.PRICE_EX_TAX_TEXT.'</span><br />';
$content .= '<span class="productTaxPrice">'.$currencies->format($price_inc).'</span>';
$content .= '<span class="productTaxIncTag"> '.PRICE_INC_TAX_TEXT.'</span>';
break;
case 'inc/ex':
$content .= '<span class="productTaxPrice">'.' '.$currencies->format($price_inc).'</span>';
$content .= '<span class="productTaxIncTag"> '.PRICE_INC_TAX_TEXT.'</span><br />';
$content .= '<span class="productTaxExPrice">'.$currencies->format($price_ex).'</span>';
$content .= '<span class="productTaxExTag"> '.PRICE_EX_TAX_TEXT.'</span>';
break;
default:
check_inc_ex_status();
if(isset($_SESSION["inc_ex_tax"]))
if($_SESSION["inc_ex_tax"])
$content.='<span class="productIncExTaxPrice">'.$currencies->format($price_inc).'</span><span class="productTaxIncExTag"> '.PRICE_INC_TAX_TEXT.'</span>';
else
$content.='<span class="productIncExTaxPrice">'.$currencies->format($price_ex).'</span><span class="productTaxIncExTag"> '.PRICE_EX_TAX_TEXT.'</span>';
else
$content.="?".$currencies->format($price_ex);
break;
}
return $content;
}
function check_inc_ex_status()
{
if(DISPLAY_PRICE_WITH_TAX_EXTENDED=='true' || DISPLAY_PRICE_WITH_TAX_EXTENDED=='false')
{
$_SESSION["inc_ex_tax"]=(DISPLAY_PRICE_WITH_TAX_EXTENDED=='true');
if(isset($_POST["IncEx"]))
if($_POST["IncEx"]=='I')
$_SESSION["inc_ex_tax"]=true;
else
$_SESSION["inc_ex_tax"]=false;
}
else
if(isset($_SESSION["inc_ex_tax"]))
unset($_SESSION["inc_ex_tax"]);
}
?>
Hope that might help someone! Oh and cheers for the mod Hem :)