Toplam Gönderi:
8
Karma:
40
Katılım:
29.03.2009
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
Toplam Gönderi:
16619
Karma:
155940
Katılım:
22.10.2008
yer:
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]
Toplam Gönderi:
8
Karma:
40
Katılım:
29.03.2009
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);
Toplam Gönderi:
16619
Karma:
155940
Katılım:
22.10.2008
yer:
Armenia
Add a using directive at the top of the file to specify the namespace of NopContext class
Toplam Gönderi:
8
Karma:
40
Katılım:
29.03.2009
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
Toplam Gönderi:
16619
Karma:
155940
Katılım:
22.10.2008
yer:
Armenia
using NopSolutions.NopCommerce.Common
Toplam Gönderi:
8
Karma:
40
Katılım:
29.03.2009
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); }
Toplam Gönderi:
16619
Karma:
155940
Katılım:
22.10.2008
yer:
Armenia
Refresh your page after updaing shopping cart: CommonHelper.ReloadCurrentPage();
Toplam Gönderi:
8
Karma:
40
Katılım:
29.03.2009
That doesn't seem to work. The label is in the header.ascx and the code is on page load of the header.
Toplam Gönderi:
8
Karma:
40
Katılım:
29.03.2009
I have put the code in the prerender and seems to be working