Displaying tax as part of the product price

The Tax Categories pages in WebSphere Commerce Accelerator allow you to select an option to include the tax in the product price. In order to display this price on your product pages (or any page where you display the price), include the following code in your JSP files:

BigDecimal oldPrice =
product.getCalculatedPrice().getPrimaryPrice().getValue();
CategorizedMonetaryAmountsDataBean cMADB = product.getDisplayTaxes();
BigDecimal taxAmount = cMADB.getCategoryAmount();
BigDecimal TotalPriceWithTax = oldPrice.add(cMADB.getCategoryAmount());
FormattedMonetaryAmountDataBean formattedAmount = new
FormattedMonetaryAmountDataBean(); formattedAmount.setAmount(TotalPriceWithTax);
com.ibm.commerce.beans.DataBeanManager.activate (formattedAmount, commandContext);

To display both prices (with and without the tax), include the following code:

<font class="Was">regularPrice : <%=product.getCalculatedPrice()%></font><br>
<font class="Was">Total Price With Tax : <%=formattedAmount%></font><br>

For more information, see the source code for the ToolTech Item Display page.