Skip to content

Commit 1d36628

Browse files
committed
show 0 price for explicit 0 priced items
1 parent 9a0cd09 commit 1d36628

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

core/src/main/java/io/snabble/sdk/PriceFormatter.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ public PriceFormatter(Project project) {
1414
}
1515

1616
public String format(int price) {
17-
if (price == 0) {
17+
return format(price, true);
18+
}
19+
20+
public String format(int price, boolean allowZeroPrice) {
21+
if (price == 0 && !allowZeroPrice) {
1822
return "";
1923
}
2024

@@ -63,7 +67,7 @@ public String format(Product product, boolean discountedPrice, ScannedCode scann
6367
price = scannedCode.getPrice();
6468
}
6569

66-
String formattedString = format(price);
70+
String formattedString = format(price, false);
6771
Product.Type type = product.getType();
6872

6973
Unit referenceUnit = product.getReferenceUnit();

ui/src/main/java/io/snabble/sdk/ui/cart/ShoppingCartView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ public void bindTo(final int position) {
486486
priceTextView.setText(" " + priceFormatter.format(embeddedPrice));
487487
} else if (embeddedAmount != null) {
488488
priceTextView.setText(String.format(" * %s = %s",
489-
priceFormatter.format(productPrice),
489+
priceFormatter.format(productPrice, true),
490490
priceFormatter.format(productPrice * embeddedAmount)));
491491
} else if (embeddedWeight != null) {
492492
String priceSum = priceFormatter.format(product.getPriceForQuantity(embeddedWeight, scannedCode, roundingMode));

0 commit comments

Comments
 (0)