Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save netsi1964/8736344 to your computer and use it in GitHub Desktop.
Save netsi1964/8736344 to your computer and use it in GitHub Desktop.
Razor snippet which will show a formated Cart TotalPrice
@{
// Check if cart exists
var cart = "Empty";
if (System.Web.HttpContext.Current.Session["eComCart"]!="")
{
Dynamicweb.eCommerce.Orders.Order order = (Dynamicweb.eCommerce.Orders.Order) System.Web.HttpContext.Current.Session["eComCart"];
// Format like this: 1.299,95
cart = String.Format("{0:0,0.00}", order.TotalPrice);
}
}
<h1>@cart</h1>
@netsi1964
Copy link
Author

This snippet can be pasted in any Razor based Dynamicweb Template. You may wish to use other formatting or output. A useful site for formatting in C# is string format double .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment