/// <summary> /// Returns product total tax in site main currency. /// </summary> /// <param name="skuPrice">SKU price</param> /// <param name="skuId">SKU ID</param> /// <param name="stateId">Customer billing address state ID</param> /// <param name="countryId">Customer billing addres country ID</param> /// <param name="isTaxIDSupplied">Indicates if customer tax registration ID is supplied</param> private static double GetSKUTotalTax(double skuPrice, int skuId, int stateId, int countryId, bool isTaxIDSupplied) { double totalTax = 0; int cacheMinutes = 0; // Try to get data from cache using (CachedSection <double> cs = new CachedSection <double>(ref totalTax, cacheMinutes, true, null, "skutotaltax|", skuId, skuPrice, stateId, countryId, isTaxIDSupplied)) { if (cs.LoadData) { // Get all the taxes and their values which are applied to the specified product DataSet ds = TaxClassInfoProvider.GetTaxes(skuId, countryId, stateId, null); if (!DataHelper.DataSourceIsEmpty(ds)) { foreach (DataRow dr in ds.Tables[0].Rows) { bool zeroTax = ValidationHelper.GetBoolean(dr["TaxClassZeroIfIDSupplied"], false); if (!(isTaxIDSupplied && zeroTax)) { double taxValue = ValidationHelper.GetDouble(dr["TaxValue"], 0); bool isFlat = ValidationHelper.GetBoolean(dr["TaxIsFlat"], false); // Add tax value totalTax += TaxClassInfoProvider.GetTaxValue(skuPrice, taxValue, isFlat); } } } // Cache the data cs.Data = totalTax; } } return(totalTax); }