投稿総数:
8
カルマ:
40
参加:
2009/03/29
I want to add a total to the header. I can't find the correct code to add it. This is something i tried but doesn't work Total:<%=ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartManager.GetShoppingCartSubTotal).ToString %> Does any one know the correct code? thanks Mike
投稿総数:
16619
カルマ:
155940
参加:
2008/10/22
ロケーション:
Armenia
Show subtotal (and not total): [quote]ShoppingCart Cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); decimal shoppingCartSubTotalDiscount; decimal shoppingCartSubTotal = ShoppingCartManager.GetShoppingCartSubTotal(Cart, NopContext.Current.User, out shoppingCartSubTotalDiscount); decimal shoppingCartSubTotalConverted = CurrencyManager.ConvertCurrency(shoppingCartSubTotal, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); lblSubTotalAmount.Text = LocalizationManager.GetCurrencyString(shoppingCartSubTotalConverted, true, NopContext.Current.WorkingCurrency);[/quote]
投稿総数:
8
カルマ:
40
参加:
2009/03/29
I am getting an error Compiler Error Message: CS0103: The name 'NopContext' does not exist in the current context Source Error: Line 36: ShoppingCart Cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); Line 37: decimal shoppingCartSubTotalDiscount; Line 38: decimal shoppingCartSubTotal = ShoppingCartManager.GetShoppingCartSubTotal(Cart, NopContext.Current.User, out shoppingCartSubTotalDiscount); Line 39: decimal shoppingCartSubTotalConverted = CurrencyManager.ConvertCurrency(shoppingCartSubTotal, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); Line 40: lblSubTotalAmount.Text = LocalizationManager.GetCurrencyString(shoppingCartSubTotalConverted, true, NopContext.Current.WorkingCurrency);
投稿総数:
16619
カルマ:
155940
参加:
2008/10/22
ロケーション:
Armenia
Add a using directive at the top of the file to specify the namespace of NopContext class
投稿総数:
8
カルマ:
40
参加:
2009/03/29
What is NopContext class under. I can't find it using NopSolutions.NopCommerce.Common.Orders; ? I managed to do it. Not used to C# Thanks
投稿総数:
16619
カルマ:
155940
参加:
2008/10/22
ロケーション:
Armenia
using NopSolutions.NopCommerce.Common
投稿総数:
8
カルマ:
40
参加:
2009/03/29
This is working to a certain extent but when i go to my product and add to cart it is not updating the subtotal on first postback this is my code? Seems to be one update behind? protected void Page_Load(object sender, EventArgs e) { ShoppingCart Cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); decimal shoppingCartSubTotalDiscount; decimal shoppingCartSubTotal = ShoppingCartManager.GetShoppingCartSubTotal(Cart, NopContext.Current.User, out shoppingCartSubTotalDiscount); decimal shoppingCartSubTotalConverted = CurrencyManager.ConvertCurrency(shoppingCartSubTotal, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); lblSubTotalAmount.Text = LocalizationManager.GetCurrencyString(shoppingCartSubTotalConverted, true, NopContext.Current.WorkingCurrency); }
投稿総数:
16619
カルマ:
155940
参加:
2008/10/22
ロケーション:
Armenia
Refresh your page after updaing shopping cart: CommonHelper.ReloadCurrentPage();
投稿総数:
8
カルマ:
40
参加:
2009/03/29
That doesn't seem to work. The label is in the header.ascx and the code is on page load of the header.
投稿総数:
8
カルマ:
40
参加:
2009/03/29
I have put the code in the prerender and seems to be working