This is an automated email from the ASF dual-hosted git repository. nmalin pushed a commit to branch release18.12 in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release18.12 by this push: new 48ecfad Fixed: Incorrect price for selected variant shown (OFBIZ-12236) 48ecfad is described below commit 48ecfade8e92b91c2523dd898cde2026f31df2a6 Author: Nicolas Malin <nicolas.ma...@nereide.fr> AuthorDate: Mon Sep 27 16:18:50 2021 +0200 Fixed: Incorrect price for selected variant shown (OFBIZ-12236) When the webshop (ecommerce component) has been set up for retail (B2C), with the tax setting 'Show prices with VAT tax included' set to 'Y' in store 9000 the appropriat Tax Auth Geo and Tax Auth set in store 9000 the flag 'Include Tax In Price' set to 'Y' for the Tax Auth the price for a virtual product is shown including VAT. However, for a selected variant the price shown is without VAT Thanks: Pierre Smits to raise the issue and Priya Sharma for solved it --- .../groovyScripts/entry/catalog/InlineProductDetail.groovy | 4 ++-- .../order/groovyScripts/entry/catalog/ProductDetail.groovy | 14 +++++++------- .../groovyScripts/entry/catalog/ProductSummary.groovy | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/applications/order/groovyScripts/entry/catalog/InlineProductDetail.groovy b/applications/order/groovyScripts/entry/catalog/InlineProductDetail.groovy index 9a232c2..f0e7b8a 100644 --- a/applications/order/groovyScripts/entry/catalog/InlineProductDetail.groovy +++ b/applications/order/groovyScripts/entry/catalog/InlineProductDetail.groovy @@ -288,8 +288,8 @@ if (inlineProduct) { } amt.append(" if (sku == \"" + variant.productId + "\") return \"" + (variant.requireAmount ?: "N") + "\"; ") variantInfoJS.append(" variantReqAmounts['" + variant.productId + "'] = '" + (variant.requireAmount ?: "N") + "';\n") - variantPriceJS.append(" if (sku == \"" + variant.productId + "\") return \"" + numberFormat.format(variantPriceMap.basePrice) + "\"; ") - variantInfoJS.append(" variantPrices['" + variant.productId + "'] = '" + numberFormat.format(variantPriceMap.basePrice) + "';\n") + variantPriceJS.append(" if (sku == \"" + variant.productId + "\") return \"" + numberFormat.format(variantPriceMap.price) + "\"; ") + variantInfoJS.append(" variantPrices['" + variant.productId + "'] = '" + numberFormat.format(variantPriceMap.price) + "';\n") } amt.append(" } ") variantPriceJS.append(" } ") diff --git a/applications/order/groovyScripts/entry/catalog/ProductDetail.groovy b/applications/order/groovyScripts/entry/catalog/ProductDetail.groovy index f7826ea..257d483 100644 --- a/applications/order/groovyScripts/entry/catalog/ProductDetail.groovy +++ b/applications/order/groovyScripts/entry/catalog/ProductDetail.groovy @@ -446,9 +446,9 @@ if (product) { } amt.append(" if (sku == \"" + variant.productId + "\") return \"" + (variant.requireAmount ?: "N") + "\"; ") variantInfoJS.append(" variantReqAmounts['" + variant.productId + "'] = '" + (variant.requireAmount ?: "N") + "';\n") - if (variantPriceMap && variantPriceMap.basePrice) { - variantPriceJS.append(" if (sku == \"" + variant.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.basePrice, currencyUomId, locale, 10) + "\"; ") - variantInfoJS.append(" variantPrices['" + variant.productId + "'] = '" + UtilFormatOut.formatCurrency(variantPriceMap.basePrice, currencyUomId, locale, 10) + "';\n") + if (variantPriceMap && variantPriceMap.price) { + variantPriceJS.append(" if (sku == \"" + variant.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.price, currencyUomId, locale, 10) + "\"; ") + variantInfoJS.append(" variantPrices['" + variant.productId + "'] = '" + UtilFormatOut.formatCurrency(variantPriceMap.price, currencyUomId, locale, 10) + "';\n") } // make a list of virtual variants sku with requireAmount @@ -487,8 +487,8 @@ if (product) { } } variantPriceList.add(virtualPriceMap) - variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.basePrice, currencyUomId, locale, 10) + "\"; ") - variantInfoJS.append(" variantPrices['" + virtual.productId + "'] = '" + UtilFormatOut.formatCurrency(variantPriceMap.basePrice, currencyUomId, locale, 10) + "';\n") + variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.price, currencyUomId, locale, 10) + "\"; ") + variantInfoJS.append(" variantPrices['" + virtual.productId + "'] = '" + UtilFormatOut.formatCurrency(variantPriceMap.price, currencyUomId, locale, 10) + "';\n") } else { virtualPriceMap = runService('calculatePurchasePrice', priceContext) variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.price, currencyUomId, locale, 10) + "\"; ") @@ -545,8 +545,8 @@ if (product) { BigDecimal calculatedPrice = (BigDecimal)virtualPriceMap.get("price") // Get the minimum quantity for variants if MINIMUM_ORDER_PRICE is set for variants. virtualVariantPriceList.add(virtualPriceMap) - variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(virtualPriceMap.basePrice, currencyUomId, locale, 10) + "\"; ") - variantInfoJS.append(" variantPrices['" + virtual.productId + "'] = '" + UtilFormatOut.formatCurrency(virtualPriceMap.basePrice, currencyUomId, locale, 10) + "';\n") + variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(virtualPriceMap.price, currencyUomId, locale, 10) + "\"; ") + variantInfoJS.append(" variantPrices['" + virtual.productId + "'] = '" + UtilFormatOut.formatCurrency(virtualPriceMap.price, currencyUomId, locale, 10) + "';\n") } else { virtualPriceMap = runService('calculatePurchasePrice', priceContext) variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(virtualPriceMap.price, currencyUomId, locale, 10) + "\"; ") diff --git a/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy b/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy index 43cf65a..be638d0 100644 --- a/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy +++ b/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy @@ -191,13 +191,13 @@ if (product) { } else { virtualPriceMap = runService('calculatePurchasePrice', priceContext) } - if (virtualPriceMap.basePrice) { - basePrice = numberFormat.format(virtualPriceMap.basePrice) + if (virtualPriceMap.price) { + price = numberFormat.format(virtualPriceMap.price) } else { - basePrice = UtilProperties.getResourceBundleMap("CommonUiLabels", locale).get("CommonNA") + price = UtilProperties.getResourceBundleMap("CommonUiLabels", locale).get("CommonNA") } - variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + basePrice + "\"; ") - variantInfoJS.append(" variantPrices['" + virtual.productId + "'] = '" + basePrice + "';\n") + variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + price + "\"; ") + variantInfoJS.append(" variantPrices['" + virtual.productId + "'] = '" + price + "';\n") } variantPriceJS.append(" } ") @@ -208,7 +208,7 @@ if (product) { context.virtualJavaScript = jsBuf } } - variantInfoJS.append(" variantPrices['" + product.productId + "'] = '" + numberFormat.format(priceMap.basePrice) + "';\n") + variantInfoJS.append(" variantPrices['" + product.productId + "'] = '" + numberFormat.format(priceMap.price) + "';\n") variantInfoJS.append(" });\n</script>\n") context.variantInfoJavaScript = variantInfoJS