Kendo Grid doesn't show .00 on product price column in Areas > Admin > Views > Product > List.cshtml

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
I was looking at the prices on the Product list page and noticed that when the price is an exact dollar amount i.e. $12.00 the column only shows 12. I see that there is a line of code that checks to see if the product is not a grouped product. This is where the price is being formatted i.e.

``` template: "# if(ProductTypeId != @((int) ProductType.GroupedProduct)) { # #: Price# # }  # "  ```

I've tried to manipulate the

``` { # #: Price# # } ```

section to see if I could change the format of the decimal that way, but it didn't work. Next I added this line of code

```  format: "{0:c2}"  ```

This line of code works so long as the template: . . . line of code is commented out.

My question is, how can I get the price column to display the .00 when the product is an exact dollar amount WHILE KEEPING THE template. . . logic?
5 years ago
template: "# if(ProductTypeId != @((int) ProductType.GroupedProduct)) {#" + '#: kendo.format("{0:n2}", Price)#' + "#}  #"

or

template: "# if(ProductTypeId != @((int) ProductType.GroupedProduct)) {#" + '#: kendo.format("{0:c}", Price)#' + "#}  #"

2nd option displays as currency
3 years ago
How to do this on nopcommerce 4.4?
3 years ago
<script>
    function renderColumnPrice(data, type, row, meta) {
        return (row.ProductTypeId != @((int)ProductType.GroupedProduct) ) ? parseFloat(data).toFixed( 2 ) : null;
    }
3 years ago
I found a more effective solution
Intl.NumberFormat('vi-VN', { style: 'currency', currency: 'VND' }).format(data)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.