public virtual async Task <CustomerNavigationModel> PrepareNavigation(int selectedTabId = 0) { var model = new CustomerNavigationModel(); model.HideAvatar = !_customerSettings.AllowCustomersToUploadAvatars; model.HideRewardPoints = !_rewardPointsSettings.Enabled; model.HideDeleteAccount = !_customerSettings.AllowUsersToDeleteAccount; model.HideForumSubscriptions = !_forumSettings.ForumsEnabled || !_forumSettings.AllowCustomersToManageSubscriptions; model.HideReturnRequests = !_orderSettings.ReturnRequestsEnabled || !(await _returnRequestService.SearchReturnRequests(_storeContext.CurrentStore.Id, _workContext.CurrentCustomer.Id, "", null, 0, 1)).Any(); model.HideDownloadableProducts = _customerSettings.HideDownloadableProductsTab; model.HideBackInStockSubscriptions = _customerSettings.HideBackInStockSubscriptionsTab; model.HideAuctions = _customerSettings.HideAuctionsTab; model.HideNotes = _customerSettings.HideNotesTab; model.HideDocuments = _customerSettings.HideDocumentsTab; model.HideReviews = _customerSettings.HideReviewsTab; model.HideCourses = _customerSettings.HideCoursesTab; if (_vendorSettings.AllowVendorsToEditInfo && _workContext.CurrentVendor != null) { model.ShowVendorInfo = true; } model.SelectedTab = (CustomerNavigationEnum)selectedTabId; return(model); }
public ActionResult CustomerNavigation(int selectedTabId = 0) { var model = new CustomerNavigationModel(); model.SelectedTab = (CustomerNavigationEnum)selectedTabId; return(PartialView(model)); }
protected CustomerNavigationModel GetCustomerNavigationModel(Customer customer) { var model = new CustomerNavigationModel(); model.HideAvatar = !_customerSettings.AllowCustomersToUploadAvatars; model.HideRewardPoints = !_rewardPointsSettings.Enabled; model.HideForumSubscriptions = !_forumSettings.ForumsEnabled || !_forumSettings.AllowCustomersToManageSubscriptions; model.HideReturnRequests = !_orderSettings.ReturnRequestsEnabled || _orderService.SearchReturnRequests(_storeContext.CurrentStore.Id, customer.Id, 0, null, 0, 1).Count == 0; model.HideDownloadableProducts = _customerSettings.HideDownloadableProductsTab; model.HideBackInStockSubscriptions = _customerSettings.HideBackInStockSubscriptionsTab; return(model); }
public virtual CustomerNavigationModel PrepareNavigation(int selectedTabId = 0) { var model = new CustomerNavigationModel(); model.HideAvatar = !_customerSettings.AllowCustomersToUploadAvatars; model.HideRewardPoints = !_rewardPointsSettings.Enabled; model.HideForumSubscriptions = !_forumSettings.ForumsEnabled || !_forumSettings.AllowCustomersToManageSubscriptions; model.HideReturnRequests = !_orderSettings.ReturnRequestsEnabled || _returnRequestService.SearchReturnRequests(_storeContext.CurrentStore.Id, _workContext.CurrentCustomer.Id, "", null, 0, 1).Count == 0; model.HideDownloadableProducts = _customerSettings.HideDownloadableProductsTab; model.HideBackInStockSubscriptions = _customerSettings.HideBackInStockSubscriptionsTab; model.SelectedTab = (CustomerNavigationEnum)selectedTabId; return(model); }
public ActionResult Details(int orderId) { Order order = _orderService.GetOrderById(orderId); if (order == null || order.Deleted || _workContext.CurrentCustomer.Id != order.CustomerId) { return(new HttpUnauthorizedResult()); } ViewBag.Msg = TempData["ReturnRequestSuccess"] ?? new MessageModel(); var model = PrepareOrderDetailsModel(order); CustomerNavigationModel navModel = new CustomerNavigationModel(); ViewData["OrderDetail"] = model; //foreach (var sci in model.Items)//aa //{ // sci.AttributeInfo = _productAttributeFormatter.FormatAttributes(order.OrderProductVariants.Where(x => x.ProductVariant.ProductId == sci.ProductId).FirstOrDefault().ProductVariant, sci.AttributeInfo, "<h2>{0} <span>{1}</span></h2>", _workContext.CurrentCustomer, htmlEncode: false); //} ViewData["NavModel"] = navModel; return(View(model)); }
public ActionResult ReturnRequest(int orderId) { var order = _orderService.GetOrderById(orderId); if (order == null || order.Deleted || _workContext.CurrentCustomer.Id != order.CustomerId) { return(new HttpUnauthorizedResult()); } if (!_orderProcessingService.IsReturnRequestAllowed(order)) { return(RedirectToAction("Index", "Home")); } CustomerNavigationModel navModel = new CustomerNavigationModel(); ViewData["NavModel"] = navModel; var model = new SubmitReturnRequestModel(); model = PrepareReturnRequestModel(model, order); ViewBag.Msg = new MessageModel(); return(View(model)); }
public virtual CustomerNavigationModel PrepareCustomerNavigationModel(int selectedTabId = 0) { var model = new CustomerNavigationModel(); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerInfo", Title = _localizationService.GetResource("Account.CustomerInfo"), Tab = CustomerNavigationEnum.Info, ItemClass = "customer-info" }); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerAddresses", Title = _localizationService.GetResource("Account.CustomerAddresses"), Tab = CustomerNavigationEnum.Addresses, ItemClass = "customer-addresses" }); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerOrders", Title = _localizationService.GetResource("Account.CustomerOrders"), Tab = CustomerNavigationEnum.Orders, ItemClass = "customer-orders" }); if (_orderSettings.ReturnRequestsEnabled && _returnRequestService.SearchReturnRequests(_storeContext.CurrentStore.Id, _workContext.CurrentCustomer.Id, 0, null, 0, 1).Any()) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerReturnRequests", Title = _localizationService.GetResource("Account.CustomerReturnRequests"), Tab = CustomerNavigationEnum.ReturnRequests, ItemClass = "return-requests" }); } if (!_customerSettings.HideDownloadableProductsTab) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerDownloadableProducts", Title = _localizationService.GetResource("Account.DownloadableProducts"), Tab = CustomerNavigationEnum.DownloadableProducts, ItemClass = "downloadable-products" }); } if (!_customerSettings.HideBackInStockSubscriptionsTab) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerBackInStockSubscriptions", Title = _localizationService.GetResource("Account.BackInStockSubscriptions"), Tab = CustomerNavigationEnum.BackInStockSubscriptions, ItemClass = "back-in-stock-subscriptions" }); } if (_rewardPointsSettings.Enabled) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerRewardPoints", Title = _localizationService.GetResource("Account.RewardPoints"), Tab = CustomerNavigationEnum.RewardPoints, ItemClass = "reward-points" }); } model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerChangePassword", Title = _localizationService.GetResource("Account.ChangePassword"), Tab = CustomerNavigationEnum.ChangePassword, ItemClass = "change-password" }); if (_customerSettings.AllowCustomersToUploadAvatars) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerAvatar", Title = _localizationService.GetResource("Account.Avatar"), Tab = CustomerNavigationEnum.Avatar, ItemClass = "customer-avatar" }); } if (_forumSettings.ForumsEnabled && _forumSettings.AllowCustomersToManageSubscriptions) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerForumSubscriptions", Title = _localizationService.GetResource("Account.ForumSubscriptions"), Tab = CustomerNavigationEnum.ForumSubscriptions, ItemClass = "forum-subscriptions" }); } if (_catalogSettings.ShowProductReviewsTabOnAccountPage) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerProductReviews", Title = _localizationService.GetResource("Account.CustomerProductReviews"), Tab = CustomerNavigationEnum.ProductReviews, ItemClass = "customer-reviews" }); } if (_vendorSettings.AllowVendorsToEditInfo && _workContext.CurrentVendor != null) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerVendorInfo", Title = _localizationService.GetResource("Account.VendorInfo"), Tab = CustomerNavigationEnum.VendorInfo, ItemClass = "customer-vendor-info" }); } model.SelectedTab = (CustomerNavigationEnum)selectedTabId; return(model); }
/// <summary> /// Prepare the customer navigation model /// </summary> /// <param name="selectedTabId">Identifier of the selected tab</param> /// <returns>Customer navigation model</returns> public virtual CustomerNavigationModel PrepareCustomerNavigationModel(int selectedTabId = 0) { var model = new CustomerNavigationModel(); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerInfo", Title = _localizationService.GetResource("Account.CustomerInfo"), Tab = CustomerNavigationEnum.Info, ItemClass = "customer-info" }); // Remove customer addresses from My Account page -- David in Jun. 2020 //model.CustomerNavigationItems.Add(new CustomerNavigationItemModel //{ // RouteName = "CustomerAddresses", // Title = _localizationService.GetResource("Account.CustomerAddresses"), // Tab = CustomerNavigationEnum.Addresses, // ItemClass = "customer-addresses" //}); // Remove customer orders from My Account page -- David in Jun. 2020 //model.CustomerNavigationItems.Add(new CustomerNavigationItemModel //{ // RouteName = "CustomerOrders", // Title = _localizationService.GetResource("Account.CustomerOrders"), // Tab = CustomerNavigationEnum.Orders, // ItemClass = "customer-orders" //}); if (_orderSettings.ReturnRequestsEnabled && _returnRequestService.SearchReturnRequests(_storeContext.CurrentStore.Id, _workContext.CurrentCustomer.Id, pageIndex: 0, pageSize: 1).Any()) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerReturnRequests", Title = _localizationService.GetResource("Account.CustomerReturnRequests"), Tab = CustomerNavigationEnum.ReturnRequests, ItemClass = "return-requests" }); } if (!_customerSettings.HideDownloadableProductsTab) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerDownloadableProducts", Title = _localizationService.GetResource("Account.DownloadableProducts"), Tab = CustomerNavigationEnum.DownloadableProducts, ItemClass = "downloadable-products" }); } if (!_customerSettings.HideBackInStockSubscriptionsTab) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerBackInStockSubscriptions", Title = _localizationService.GetResource("Account.BackInStockSubscriptions"), Tab = CustomerNavigationEnum.BackInStockSubscriptions, ItemClass = "back-in-stock-subscriptions" }); } if (_rewardPointsSettings.Enabled) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerRewardPoints", Title = _localizationService.GetResource("Account.RewardPoints"), Tab = CustomerNavigationEnum.RewardPoints, ItemClass = "reward-points" }); } model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerChangePassword", Title = _localizationService.GetResource("Account.ChangePassword"), Tab = CustomerNavigationEnum.ChangePassword, ItemClass = "change-password" }); if (_customerSettings.AllowCustomersToUploadAvatars) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerAvatar", Title = _localizationService.GetResource("Account.Avatar"), Tab = CustomerNavigationEnum.Avatar, ItemClass = "customer-avatar" }); } if (_forumSettings.ForumsEnabled && _forumSettings.AllowCustomersToManageSubscriptions) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerForumSubscriptions", Title = _localizationService.GetResource("Account.ForumSubscriptions"), Tab = CustomerNavigationEnum.ForumSubscriptions, ItemClass = "forum-subscriptions" }); } if (_catalogSettings.ShowProductReviewsTabOnAccountPage) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerProductReviews", Title = _localizationService.GetResource("Account.CustomerProductReviews"), Tab = CustomerNavigationEnum.ProductReviews, ItemClass = "customer-reviews" }); } if (_vendorSettings.AllowVendorsToEditInfo && _workContext.CurrentVendor != null) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerVendorInfo", Title = _localizationService.GetResource("Account.VendorInfo"), Tab = CustomerNavigationEnum.VendorInfo, ItemClass = "customer-vendor-info" }); } if (_gdprSettings.GdprEnabled) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "GdprTools", Title = _localizationService.GetResource("Account.Gdpr"), Tab = CustomerNavigationEnum.GdprTools, ItemClass = "customer-gdpr" }); } if (_captchaSettings.Enabled && _customerSettings.AllowCustomersToCheckGiftCardBalance) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CheckGiftCardBalance", Title = _localizationService.GetResource("CheckGiftCardBalance"), Tab = CustomerNavigationEnum.CheckGiftCardBalance, ItemClass = "customer-check-gift-card-balance" }); } model.SelectedTab = (CustomerNavigationEnum)selectedTabId; return(model); }
public virtual CustomerNavigationModel PrepareCustomerNavigationModel(int selectedTabId = 0) { var model = new CustomerNavigationModel(); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerInfo", Title = _localizationService.GetResource("Account.CustomerInfo"), Tab = CustomerNavigationEnum.Info, ItemClass = "customer-info" }); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerAddresses", Title = _localizationService.GetResource("Account.CustomerAddresses"), Tab = CustomerNavigationEnum.Addresses, ItemClass = "customer-addresses" }); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerOrders", Title = _localizationService.GetResource("Account.CustomerOrders"), Tab = CustomerNavigationEnum.Orders, ItemClass = "customer-orders" }); if (!_customerSettings.HideDownloadableProductsTab) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerDownloadableProducts", Title = _localizationService.GetResource("Account.DownloadableProducts"), Tab = CustomerNavigationEnum.DownloadableProducts, ItemClass = "downloadable-products" }); } if (!_customerSettings.HideBackInStockSubscriptionsTab) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerBackInStockSubscriptions", Title = _localizationService.GetResource("Account.BackInStockSubscriptions"), Tab = CustomerNavigationEnum.BackInStockSubscriptions, ItemClass = "back-in-stock-subscriptions" }); } if (_rewardPointsSettings.Enabled) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerRewardPoints", Title = _localizationService.GetResource("Account.RewardPoints"), Tab = CustomerNavigationEnum.RewardPoints, ItemClass = "reward-points" }); } model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerChangePassword", Title = _localizationService.GetResource("Account.ChangePassword"), Tab = CustomerNavigationEnum.ChangePassword, ItemClass = "change-password" }); if (_customerSettings.AllowCustomersToUploadAvatars) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerAvatar", Title = _localizationService.GetResource("Account.Avatar"), Tab = CustomerNavigationEnum.Avatar, ItemClass = "customer-avatar" }); } if (_catalogSettings.ShowProductReviewsTabOnAccountPage) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerProductReviews", Title = _localizationService.GetResource("Account.CustomerProductReviews"), Tab = CustomerNavigationEnum.ProductReviews, ItemClass = "customer-reviews" }); } model.SelectedTab = (CustomerNavigationEnum)selectedTabId; return(model); }
public ActionResult ReturnRequestSubmit(int orderId, SubmitReturnRequestModel model, FormCollection form) { //TempData["ReturnRequestSuccess"] = null; CustomerNavigationModel navModel = new CustomerNavigationModel(); ViewData["NavModel"] = navModel; MessageModel msg = new MessageModel(); var order = _orderService.GetOrderById(orderId); if (order == null || order.Deleted || _workContext.CurrentCustomer.Id != order.CustomerId) { return(new HttpUnauthorizedResult()); } if (!_orderProcessingService.IsReturnRequestAllowed(order)) { return(RedirectToAction("Index", "Home")); } int count = 0; foreach (var opv in order.OrderProductVariants) { int quantity = 0; //parse quantity bool selection = false; foreach (string formKey in form.AllKeys) { if (formKey.Equals(string.Format("quantity{0}", opv.Id), StringComparison.InvariantCultureIgnoreCase)) { int.TryParse(form[formKey], out quantity); continue; } if (formKey.Equals(string.Format("selection{0}", opv.Id), StringComparison.InvariantCultureIgnoreCase)) { bool.TryParse(form[formKey], out selection); continue; } } if (selection && quantity > 0) { var rr = new ReturnRequest() { OrderProductVariantId = opv.Id, Quantity = quantity, CustomerId = _workContext.CurrentCustomer.Id, ReasonForReturn = model.ReturnReason, RequestedAction = model.ReturnAction, CustomerComments = model.Comments, StaffNotes = string.Empty, ReturnRequestStatus = ReturnRequestStatus.Pending, CreatedOnUtc = DateTime.UtcNow, UpdatedOnUtc = DateTime.UtcNow }; _workContext.CurrentCustomer.ReturnRequests.Add(rr); _customerService.UpdateCustomer(_workContext.CurrentCustomer); //notify store owner here (email) _workflowMessageService.SendNewReturnRequestStoreOwnerNotification(rr, opv, _localizationSettings.DefaultAdminLanguageId); _workflowMessageService.SendNewReturnRequestCustomerNotification(_workContext.CurrentCustomer.GetFullName(), _workContext.CurrentCustomer.Email, model.OrderId.ToString(), _workContext.WorkingLanguage.Id); count++; } } if (count > 0) { msg.Successful = true; msg.MessageList.Add(_localizationService.GetResource("ReturnRequests.Submitted", _workContext.WorkingLanguage.Id)); TempData["ReturnRequestSuccess"] = msg; return(RedirectToAction("Details", new { orderId = orderId })); } else { msg.Successful = false; msg.MessageList.Add(_localizationService.GetResource("ReturnRequests.NoItemsSubmitted", _workContext.WorkingLanguage.Id)); ViewBag.Msg = msg; } model = PrepareReturnRequestModel(new SubmitReturnRequestModel(), order); ViewBag.Msg = msg; return(View("ReturnRequest", model)); }
/// <summary> /// Prepare the customer navigation model /// </summary> /// <param name="selectedTabId">Identifier of the selected tab</param> /// <returns>Customer navigation model</returns> public virtual CustomerNavigationModel PrepareCustomerNavigationModel(int selectedTabId = 0) { var model = new CustomerNavigationModel(); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerInfo", Title = _localizationService.GetResource("Account.CustomerInfo"), Tab = CustomerNavigationEnum.Info, ItemClass = "customer-info" }); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerAddresses", Title = _localizationService.GetResource("Account.CustomerAddresses"), Tab = CustomerNavigationEnum.Addresses, ItemClass = "customer-addresses" }); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerChangePassword", Title = _localizationService.GetResource("Account.ChangePassword"), Tab = CustomerNavigationEnum.ChangePassword, ItemClass = "change-password" }); if (_customerSettings.AllowCustomersToUploadAvatars) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerAvatar", Title = _localizationService.GetResource("Account.Avatar"), Tab = CustomerNavigationEnum.Avatar, ItemClass = "customer-avatar" }); } if (_forumSettings.ForumsEnabled && _forumSettings.AllowCustomersToManageSubscriptions) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerForumSubscriptions", Title = _localizationService.GetResource("Account.ForumSubscriptions"), Tab = CustomerNavigationEnum.ForumSubscriptions, ItemClass = "forum-subscriptions" }); } if (_catalogSettings.ShowProductReviewsTabOnAccountPage) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerProductReviews", Title = _localizationService.GetResource("Account.CustomerProductReviews"), Tab = CustomerNavigationEnum.ProductReviews, ItemClass = "customer-reviews" }); } if (_vendorSettings.AllowVendorsToEditInfo && _workContext.CurrentVendor != null) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "CustomerVendorInfo", Title = _localizationService.GetResource("Account.VendorInfo"), Tab = CustomerNavigationEnum.VendorInfo, ItemClass = "customer-vendor-info" }); } if (_gdprSettings.GdprEnabled) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { RouteName = "GdprTools", Title = _localizationService.GetResource("Account.Gdpr"), Tab = CustomerNavigationEnum.GdprTools, ItemClass = "customer-gdpr" }); } model.SelectedTab = (CustomerNavigationEnum)selectedTabId; return(model); }
public ActionResult CustomerNavigation(int selectedTabId = 0) { var model = new CustomerNavigationModel(); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { Url = Url.Action("Info", "Customer"), Title = "会员中心", Tab = CustomerNavigationEnum.Info, ItemClass = "customer-info" }); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { Url = Url.Action("MyPost", "Post"), Title = "我的主题", Tab = CustomerNavigationEnum.Posts, ItemClass = "customer-post" }); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { Url = Url.Action("Reward", "Customer"), Title = "我的积分", Tab = CustomerNavigationEnum.RewardPoints, ItemClass = "customer-reward" }); model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { Url = Url.Action("Level", "Customer"), Title = "用户级别", Tab = CustomerNavigationEnum.Level, ItemClass = "customer-level" }); var mediaSetting = _settingService.GetMediaSettings(); if (mediaSetting.EnabledAvatar) { model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { Url = Url.Action("Avatar", "Customer"), Title = "我的头像", Tab = CustomerNavigationEnum.Avatar, ItemClass = "customer-avatar" }); } model.CustomerNavigationItems.Add(new CustomerNavigationItemModel { Url = Url.Action("ChangePassword", "Customer"), Title = "修改密码", Tab = CustomerNavigationEnum.ChangePassword, ItemClass = "change-password" }); model.SelectedTab = (CustomerNavigationEnum)selectedTabId; return(PartialView(model)); }