// Get: /Policies/Faq public ActionResult Faq() { // Breadcrumbs BreadCrumbViewModel crumbs = new BreadCrumbViewModel(); crumbs.HomeName = SiteTerms.GetTerm(SiteTermIds.Home); crumbs.Items.Enqueue(new BreadCrumbItem() { Name = SiteTerms.GetTerm(SiteTermIds.CustomerService), Link = Url.Content("~/ContactUs") }); crumbs.Items.Enqueue(new BreadCrumbItem() { Name = SiteTerms.GetTerm(SiteTermIds.FAQ) }); ViewBag.BreadCrumbTrail = crumbs; // Titles ViewBag.Title = SiteTerms.GetTerm(SiteTermIds.FAQ); Policy p = MTApp.ContentServices.Policies.FindOrCreateByType(PolicyType.Faq); if (p == null) { p = new Policy(); } return(View(p)); }
private CheckoutViewModel IndexSetup() { ViewBag.Title = "Checkout"; ViewBag.BodyClass = "store-checkout-page"; CheckoutViewModel model = new CheckoutViewModel(); model.CurrentOrder = SessionManager.CurrentShoppingCart(MTApp.OrderServices, MTApp.CurrentStore); // Buttons ThemeManager themes = MTApp.ThemeManager(); model.ButtonCheckoutUrl = themes.ButtonUrl("PlaceOrder", Request.IsSecureConnection); model.ButtonCancelUrl = themes.ButtonUrl("keepshopping", Request.IsSecureConnection); model.ButtonLoginUrl = themes.ButtonUrl("edit", Request.IsSecureConnection); // Agree Checkbox if (MTApp.CurrentStore.Settings.ForceTermsAgreement) { model.ShowAgreeToTerms = true; model.AgreedToTerms = false; model.AgreedToTermsDescription = SiteTerms.GetTerm(SiteTermIds.TermsAndConditionsAgreement); model.LabelTerms = SiteTerms.GetTerm(SiteTermIds.TermsAndConditions); } else { model.ShowAgreeToTerms = false; model.AgreedToTerms = true; } // Populate Countries model.Countries = MTApp.CurrentStore.Settings.FindActiveCountries(); return(model); }
private void RenderPrices(ProductPageViewModel model) { string userId = MTApp.CurrentCustomerId; StringBuilder sb = new StringBuilder(); sb.Append("<div class=\"prices\">"); UserSpecificPrice productDisplay = MTApp.PriceProduct(model.LocalProduct, MTApp.CurrentCustomer, null, MTApp.CurrentlyActiveSales); if (productDisplay.ListPriceGreaterThanCurrentPrice) { sb.Append("<label>" + SiteTerms.GetTerm(SiteTermIds.ListPrice) + "</label>"); sb.Append("<span class=\"choice\"><strike>"); sb.Append(model.LocalProduct.ListPrice.ToString("C")); sb.Append("</strike></span>"); } sb.Append("<label>" + SiteTerms.GetTerm(SiteTermIds.SitePrice) + "</label>"); sb.Append("<span class=\"choice\">"); sb.Append(productDisplay.DisplayPrice()); sb.Append("</span>"); if ((productDisplay.BasePrice < productDisplay.ListPrice) && (productDisplay.OverrideText.Trim().Length < 1)) { sb.Append("<label>" + SiteTerms.GetTerm(SiteTermIds.YouSave) + "</label>"); sb.Append("<span class=\"choice\">"); sb.Append(productDisplay.Savings.ToString("c") + " - " + productDisplay.SavingsPercent + System.Threading.Thread.CurrentThread.CurrentUICulture.NumberFormat.PercentSymbol); sb.Append("</span>"); } sb.Append("<div class=\"clear\"></div></div>"); model.PreRenderedPrices = sb.ToString(); }
public ActionResult TopReviews(int howMany, List <ProductReview> reviews) { ProductReviewsViewModel model = new ProductReviewsViewModel(); // Trim List of reviews if (reviews != null) { if (reviews.Count > howMany) { model.Reviews = reviews.Take(howMany).ToList(); } else { model.Reviews = reviews; } } // Load ratings buttons ThemeManager tm = MTApp.ThemeManager(); ViewBag.Star0Url = tm.ButtonUrl("Stars0", Request.IsSecureConnection); ViewBag.Star1Url = tm.ButtonUrl("Stars1", Request.IsSecureConnection); ViewBag.Star2Url = tm.ButtonUrl("Stars2", Request.IsSecureConnection); ViewBag.Star3Url = tm.ButtonUrl("Stars3", Request.IsSecureConnection); ViewBag.Star4Url = tm.ButtonUrl("Stars4", Request.IsSecureConnection); ViewBag.Star5Url = tm.ButtonUrl("Stars5", Request.IsSecureConnection); ViewBag.AvgLabel = SiteTerms.GetTerm(SiteTermIds.AverageRating); int avg = CalculateAverageRating(reviews); ViewBag.Avg = avg; ViewBag.AvgImage = tm.ButtonUrl("Stars" + avg.ToString(), Request.IsSecureConnection); return(View(model)); }
private void DetermineQuantityToAdd(ProductPageViewModel model) { int quantity = 0; string formQuantity = Request.Form["qty"]; if (int.TryParse(formQuantity, out quantity)) { if (model.LocalProduct.MinimumQty > 0) { if (quantity < model.LocalProduct.MinimumQty) { FlashWarning(SiteTerms.ReplaceTermVariable(SiteTerms.GetTerm(SiteTermIds.ProductPageMinimumQuantityError), "quantity", model.LocalProduct.MinimumQty.ToString())); quantity = -1; } } } else { if (model.LocalProduct.MinimumQty > 0) { quantity = model.LocalProduct.MinimumQty; } else { quantity = 1; } } model.Quantity = quantity; }
private void ForgotPasswordSetup(string email, string returnmode) { ViewBag.Title = SiteTerms.GetTerm(SiteTermIds.ForgotPassword); List <BreadCrumbItem> extraCrumbs = new List <BreadCrumbItem>(); extraCrumbs.Add(new BreadCrumbItem() { Name = ViewBag.Title }); ViewBag.ExtraCrumbs = extraCrumbs; ViewBag.SendButtonUrl = MTApp.ThemeManager().ButtonUrl("Submit", Request.IsSecureConnection); if (returnmode.Trim().ToLowerInvariant() == "1") { ViewBag.CloseUrl = Url.Content("~/checkout"); } else { ViewBag.CloseUrl = Url.Content("~/signin"); } ViewBag.Email = email; ViewBag.PostBackUrl = Url.Action("ForgotPassword", new { email = email, returnmode = returnmode }); }
private void LoadShippingMethods(Order o) { SortableCollection <ShippingRateDisplay> Rates = new SortableCollection <ShippingRateDisplay>(); if (o.HasShippingItems == false) { ShippingRateDisplay r = new ShippingRateDisplay(); r.DisplayName = SiteTerms.GetTerm(SiteTermIds.NoShippingRequired); r.ProviderId = ""; r.ProviderServiceCode = ""; r.Rate = 0; r.ShippingMethodId = "NOSHIPPING"; Rates.Add(r); } else { // Shipping Methods Rates = MTApp.OrderServices.FindAvailableShippingRates(o); if ((Rates.Count < 1)) { ShippingRateDisplay result = new ShippingRateDisplay(); result.DisplayName = "Shipping can not be calculated at this time. We will contact you after receiving your order with the exact shipping charges."; result.ShippingMethodId = "TOBEDETERMINED"; result.Rate = 0; Rates.Add(result); } } this.litShippingMethods.Text = MerchantTribe.Commerce.Utilities.HtmlRendering.ShippingRatesToRadioButtons(Rates, 300, o.ShippingMethodUniqueKey); }
// Get: /Policies/Faq public ActionResult Faq() { // Breadcrumbs BreadCrumbViewModel crumbs = new BreadCrumbViewModel(); crumbs.HomeName = SiteTerms.GetTerm(SiteTermIds.Home); crumbs.Items.Enqueue(new BreadCrumbItem() { Name = SiteTerms.GetTerm(SiteTermIds.CustomerService), Link = Url.Content("~/ContactUs") }); crumbs.Items.Enqueue(new BreadCrumbItem() { Name = SiteTerms.GetTerm(SiteTermIds.FAQ) }); var breadRender = new code.TemplateEngine.TagHandlers.BreadCrumbs(); ViewBag.BreadCrumbsFinal = breadRender.Render(MTApp, crumbs); // Titles ViewBag.Title = SiteTerms.GetTerm(SiteTermIds.FAQ); Policy p = MTApp.ContentServices.Policies.FindOrCreateByType(PolicyType.Faq); if (p == null) { p = new Policy(); } return(View(p)); }
private ProductPageViewModel IndexSetup(string slug) { ViewBag.BodyClass = "store-product-page"; ProductPageViewModel model = new ProductPageViewModel(); model.LocalProduct = ParseProductFromSlug(slug); RenderOptionsJavascript(model); // Page Title if (model.LocalProduct.MetaTitle.Trim().Length > 0) { ViewBag.Title = model.LocalProduct.MetaTitle; } else { ViewBag.Title = model.LocalProduct.ProductName; } // Meta Keywords if (model.LocalProduct.MetaKeywords.Trim().Length > 0) { ViewBag.MetaKeywords = model.LocalProduct.MetaKeywords; } // Meta Description if (model.LocalProduct.MetaDescription.Trim().Length > 0) { ViewBag.MetaDescription = model.LocalProduct.MetaDescription; } ViewBag.RelatedItemsTitle = SiteTerms.GetTerm(SiteTermIds.RelatedItems); ViewBag.AddToCartButtonUrl = MTApp.ThemeManager().ButtonUrl("addtocart", Request.IsSecureConnection); ViewBag.SubmitButtonUrl = MTApp.ThemeManager().ButtonUrl("submit", Request.IsSecureConnection); ViewBag.SaveLaterButton = MTApp.ThemeManager().ButtonUrl("SaveForLater", Request.IsSecureConnection); CheckForBackOrder(model); model.MainImageUrl = MerchantTribe.Commerce.Storage.DiskStorage.ProductImageUrlMedium(MTApp, model.LocalProduct.Bvin, model.LocalProduct.ImageFileSmall, Request.IsSecureConnection); model.MainImageAltText = model.LocalProduct.ImageFileSmallAlternateText; // Prices RenderPrices(model); LoadRelatedItems(model); RenderAdditionalImages(model); if (Request.QueryString["LineItemId"] != null) { model.OrderId = Request.QueryString["OrderBvin"]; model.LineItemId = Request.QueryString["LineItemId"]; } if (SessionManager.IsUserAuthenticated(MTApp)) { model.IsAvailableForWishList = true; } return(model); }
public string Render(MerchantTribe.Commerce.MerchantTribeApplication app, dynamic viewBag, MerchantTribe.Commerce.Content.ContentBlock block) { ProductListViewModel model = new ProductListViewModel(); model.Title = SiteTerms.GetTerm(SiteTermIds.RecentlyViewedItems); model.Items = LoadItems(app); return(RenderModel(model, app)); }
// // GET: /ContentBlocks/LastProductsViewed/ public ActionResult Index(ContentBlock block) { ProductListViewModel model = new ProductListViewModel(); model.Title = SiteTerms.GetTerm(SiteTermIds.RecentlyViewedItems); model.Items = LoadItems(); return(View(model)); }
// // GET: /ProductReviews/ public ActionResult Index(string slug) { ProductReviewsViewModel model = new ProductReviewsViewModel(); Product p = GetProductFromSlug(slug); if (p == null) { return(Redirect("~/")); } model.ProductView = new SingleProductViewModel(p, MTApp); // Titles ViewBag.Title = p.MetaTitle; if (((string)ViewBag.Title).Trim().Length < 1) { ViewBag.Title = p.ProductName; } ViewBag.Title = "Reviews: " + ViewBag.Title; ViewBag.MetaTitle = "Reviews: " + p.MetaTitle; ViewBag.MetaDescription = "Reviews: " + p.MetaDescription; ViewBag.MetaKeywords = "reviews," + p.MetaKeywords; List <ProductReview> reviews = p.ReviewsApproved; if (reviews == null) { return(Redirect("~/")); } if (reviews.Count < 1) { return(Redirect("~/")); } model.Reviews = reviews; // Load ratings buttons ThemeManager tm = MTApp.ThemeManager(); ViewBag.Star0Url = tm.ButtonUrl("Stars0", Request.IsSecureConnection); ViewBag.Star1Url = tm.ButtonUrl("Stars1", Request.IsSecureConnection); ViewBag.Star2Url = tm.ButtonUrl("Stars2", Request.IsSecureConnection); ViewBag.Star3Url = tm.ButtonUrl("Stars3", Request.IsSecureConnection); ViewBag.Star4Url = tm.ButtonUrl("Stars4", Request.IsSecureConnection); ViewBag.Star5Url = tm.ButtonUrl("Stars5", Request.IsSecureConnection); ViewBag.AvgLabel = SiteTerms.GetTerm(SiteTermIds.AverageRating); int avg = CalculateAverageRating(reviews); ViewBag.Avg = avg; ViewBag.AvgImage = tm.ButtonUrl("Stars" + avg.ToString(), Request.IsSecureConnection); return(View(model)); }
private CartViewModel IndexSetup() { ViewBag.Title = SiteTerms.GetTerm(SiteTermIds.ShoppingCart); ViewBag.BodyClass = "store-cart-page"; CartViewModel model = new CartViewModel(); LoadButtonImages(model); model.KeepShoppingUrl = GetKeepShoppingLocation(); SetPayPalVisibility(model); return(model); }
public void LoadTrail(string categoryId) { this.TrailPlaceholder.Controls.Clear(); List <CategorySnapshot> trail = new List <CategorySnapshot>(); trail = Category.BuildTrailToRoot(categoryId, MyPage.MTApp.CurrentRequestContext); if (_DisplayLinks) { HyperLink m = new HyperLink(); m.CssClass = "root"; m.ToolTip = SiteTerms.GetTerm(SiteTermIds.Home); m.Text = SiteTerms.GetTerm(SiteTermIds.Home); m.NavigateUrl = this.Page.ResolveUrl("~/"); m.EnableViewState = false; this.TrailPlaceholder.Controls.Add(m); } else { this.TrailPlaceholder.Controls.Add(new System.Web.UI.LiteralControl("<span class=\"current\">Home</span>")); } this.TrailPlaceholder.Controls.Add(new System.Web.UI.LiteralControl("<span class=\"spacer\">" + _Spacer + "</span>")); if (trail != null) { // Walk list backwards for (int i = trail.Count - 1; i >= 0; i += -1) { if (i != trail.Count - 1) { this.TrailPlaceholder.Controls.Add(new System.Web.UI.LiteralControl("<span class=\"spacer\">" + _Spacer + "</span>")); } if (i != 0) { if (_DisplayLinks) { AddCategoryLink(trail[i]); } else { AddCategoryName(trail[i]); } } else { AddCategoryName(trail[i]); } } } }
public void LoadTrail(CategorySnapshot category) { this.TrailPlaceholder.Controls.Clear(); if ((category != null)) { List <CategorySnapshot> allCats = MyPage.MTApp.CatalogServices.Categories.FindAllPaged(1, int.MaxValue); if (!category.Hidden) { this.TrailPlaceholder.Controls.Add(new LiteralControl("<div class=\"singletrail\">")); List <CategorySnapshot> trail = new List <CategorySnapshot>(); if (category != null && category.Bvin != string.Empty) { trail = Category.BuildTrailToRoot(category.Bvin, MyPage.MTApp.CurrentRequestContext); } HyperLink m = new HyperLink(); m.CssClass = "home"; m.ToolTip = SiteTerms.GetTerm(SiteTermIds.Home); m.Text = SiteTerms.GetTerm(SiteTermIds.Home); m.NavigateUrl = this.Page.ResolveUrl("~/Default.aspx"); m.EnableViewState = false; this.TrailPlaceholder.Controls.Add(m); this.TrailPlaceholder.Controls.Add(new LiteralControl("<span class=\"spacer\">" + _Spacer + "</span>")); if (trail != null) { // Walk list backwards for (int j = trail.Count - 1; j >= 0; j += -1) { if (j != trail.Count - 1) { this.TrailPlaceholder.Controls.Add(new LiteralControl("<span class=\"spacer\">" + _Spacer + "</span>")); } if (j != 0) { AddCategoryLink(trail[j]); } else { AddCategoryLink(trail[j]); } } } this.TrailPlaceholder.Controls.Add(ExtrasLiteral); this.TrailPlaceholder.Controls.Add(new LiteralControl("</div>")); } } }
private CheckoutViewModel IndexSetup() { ViewBag.Title = "Checkout"; ViewBag.BodyClass = "store-checkout-page"; CheckoutViewModel model = new CheckoutViewModel(); LoadOrder(model); CheckForPoints(model); // Buttons ThemeManager themes = MTApp.ThemeManager(); model.ButtonCheckoutUrl = themes.ButtonUrl("PlaceOrder", Request.IsSecureConnection); model.ButtonLoginUrl = MTApp.ThemeManager().ButtonUrl("Login", Request.IsSecureConnection); // Labels model.LabelRewardPoints = MTApp.CurrentStore.Settings.RewardsPointsName; // Agree Checkbox if (MTApp.CurrentStore.Settings.ForceTermsAgreement) { model.ShowAgreeToTerms = true; model.AgreedToTerms = false; model.AgreedToTermsDescription = SiteTerms.GetTerm(SiteTermIds.TermsAndConditionsAgreement); model.LabelTerms = SiteTerms.GetTerm(SiteTermIds.TermsAndConditions); } else { model.ShowAgreeToTerms = false; model.AgreedToTerms = true; } // Populate Countries model.Countries = MTApp.CurrentStore.Settings.FindActiveCountries(); model.PaymentViewModel.AcceptedCardTypes = MTApp.CurrentStore.Settings.PaymentAcceptedCards; ViewData["PassedAnalyticsTop"] += "<script type=\"text/javascript\" src=\"" + Url.Content("~/js/checkout.js") + "\" ></script>"; // Render Side Column var columnRender = new code.TemplateEngine.TagHandlers.ContentColumn(); model.SideColumn = columnRender.RenderColumnToString("601", MTApp, ViewBag); return(model); }
private void SignInSetup() { ViewBag.Title = SiteTerms.GetTerm(SiteTermIds.Login); List <BreadCrumbItem> extraCrumbs = new List <BreadCrumbItem>(); extraCrumbs.Add(new BreadCrumbItem() { Name = ViewBag.Title }); ViewBag.ExtraCrumbs = extraCrumbs; ViewBag.IsPrivateStore = MTApp.CurrentStore.Settings.IsPrivateStore; ViewBag.PrivateStoreMessage = SiteTerms.GetTerm(SiteTermIds.PrivateStoreNewUser); ViewBag.LoginButtonUrl = MTApp.ThemeManager().ButtonUrl("Login", Request.IsSecureConnection); ViewBag.CreateButtonUrl = MTApp.ThemeManager().ButtonUrl("createaccount", Request.IsSecureConnection); }
public ActionResult Index(string q) { // Initial Setup ViewBag.Title = SiteTerms.GetTerm(SiteTermIds.Search); ViewBag.MetaTitle = ViewBag.Title + " | " + q; ViewBag.MetaDescription = ViewBag.MetaTitle; ViewBag.BodyClass = "store-search-page"; ViewBag.GoButtonUrl = MTApp.ThemeManager().ButtonUrl("Go", Request.IsSecureConnection); ViewBag.q = q; // Pager Vars int pageNumber = GetPageNumber(); int pageSize = 9; int totalItems = 0; // Do Search CategoryPageViewModel model = new CategoryPageViewModel(); SearchManager manager = new SearchManager(); List <SearchObject> objects = manager.DoSearch(MTApp.CurrentStore.Id, q, pageNumber, pageSize, ref totalItems); List <string> ids = new List <string>(); foreach (SearchObject o in objects) { switch (o.ObjectType) { case (int)SearchManagerObjectType.Product: ids.Add(o.ObjectId); break; } } List <Product> products = MTApp.CatalogServices.Products.FindMany(ids); // Save to Model model.Products = PrepProducts(products); model.PagerData.PageSize = pageSize; model.PagerData.TotalItems = totalItems; model.PagerData.CurrentPage = pageNumber; model.PagerData.PagerUrlFormat = Url.Content("~/search?q=" + HttpUtility.UrlEncode(q) + "&p={0}"); model.PagerData.PagerUrlFormatFirst = Url.Content("~/search?q=" + HttpUtility.UrlEncode(q)); return(View(model)); }
private void SignInSetup() { ViewBag.Title = SiteTerms.GetTerm(SiteTermIds.Login); List <BreadCrumbItem> extraCrumbs = new List <BreadCrumbItem>(); extraCrumbs.Add(new BreadCrumbItem() { Name = ViewBag.Title }); var breadRender = new code.TemplateEngine.TagHandlers.BreadCrumbs(); ViewBag.BreadCrumbsFinal = breadRender.RenderManual(this.MTApp, extraCrumbs); ViewBag.IsPrivateStore = MTApp.CurrentStore.Settings.IsPrivateStore; ViewBag.PrivateStoreMessage = SiteTerms.GetTerm(SiteTermIds.PrivateStoreNewUser); ViewBag.LoginButtonUrl = MTApp.ThemeManager().ButtonUrl("Login", Request.IsSecureConnection); ViewBag.CreateButtonUrl = MTApp.ThemeManager().ButtonUrl("createaccount", Request.IsSecureConnection); }
// // GET: /SiteMap/ public ActionResult Index() { List <CategorySnapshot> allCats = HccApp.CatalogServices.Categories.FindAllPaged(1, 5000); List <CategorySnapshot> displayCats = new List <CategorySnapshot>(); foreach (CategorySnapshot snap in allCats) { if (snap.SourceType == CategorySourceType.CustomLink) { if (snap.CustomPageUrl.ToLowerInvariant().StartsWith("http")) { continue; } } displayCats.Add(snap); } ViewBag.Title = SiteTerms.GetTerm(SiteTermIds.SiteMap); return(View(displayCats)); }
private CheckoutViewModel IndexSetup() { ViewBag.Title = "Checkout"; ViewBag.BodyClass = "store-checkout-page"; CheckoutViewModel model = new CheckoutViewModel(); LoadOrder(model); CheckForPoints(model); // Buttons ThemeManager themes = MTApp.ThemeManager(); model.ButtonCheckoutUrl = themes.ButtonUrl("PlaceOrder", Request.IsSecureConnection); model.ButtonLoginUrl = MTApp.ThemeManager().ButtonUrl("Login", Request.IsSecureConnection); // Labels model.LabelRewardPoints = MTApp.CurrentStore.Settings.RewardsPointsName; // Agree Checkbox if (MTApp.CurrentStore.Settings.ForceTermsAgreement) { model.ShowAgreeToTerms = true; model.AgreedToTerms = false; model.AgreedToTermsDescription = SiteTerms.GetTerm(SiteTermIds.TermsAndConditionsAgreement); model.LabelTerms = SiteTerms.GetTerm(SiteTermIds.TermsAndConditions); } else { model.ShowAgreeToTerms = false; model.AgreedToTerms = true; } // Populate Countries model.Countries = MTApp.CurrentStore.Settings.FindActiveCountries(); model.PaymentViewModel.AcceptedCardTypes = MTApp.CurrentStore.Settings.PaymentAcceptedCards; return(model); }
private bool ValidatePage(CheckoutViewModel model) { bool result = true; if (!MTApp.CurrentStore.Settings.PayPal.AllowUnconfirmedAddresses) { if (string.Compare(ViewBag.AddressStatus, "Unconfirmed", true) == 0) { model.Violations.Add(new RuleViolation() { ControlName = "", ErrorMessage = "Unconfirmed addresses are not allowed by this store.", PropertyName = "", PropertyValue = "" }); result = false; } } if (Request.Form["shippingrate"] == null) { model.Violations.Add(new RuleViolation() { ControlName = "", ErrorMessage = "Please select a shipping method.", PropertyName = "", PropertyValue = "" }); result = false; } if (model.AgreedToTerms == false && model.ShowAgreeToTerms == true) { model.Violations.Add(new MerchantTribe.Web.Validation.RuleViolation("Terms", "Terms", SiteTerms.GetTerm(SiteTermIds.SiteTermsAgreementError))); result = false; } return(result); }
private void SendReminder(string email) { if (!MerchantTribe.Web.Validation.EmailValidation.MeetsEmailFormatRequirements(email)) { FlashWarning("Please enter a valid email address"); return; } try { CustomerAccount thisUser = MTApp.MembershipServices.Customers.FindByEmail(email); string newPassword = string.Empty; if ((thisUser != null) && (thisUser.Bvin != string.Empty)) { newPassword = MTApp.MembershipServices.GeneratePasswordForCustomer(WebAppSettings.PasswordMinimumLength + 2); thisUser.Password = thisUser.EncryptPassword(newPassword); if (MTApp.MembershipServices.UpdateCustomer(thisUser)) { HtmlTemplate t = MTApp.ContentServices.GetHtmlTemplateOrDefault(HtmlTemplateType.ForgotPassword); if (t != null) { System.Net.Mail.MailMessage m; List <IReplaceable> tempList = new List <IReplaceable>(); tempList.Add(thisUser); tempList.Add(new Replaceable("[[NewPassword]]", newPassword)); t = t.ReplaceTagsInTemplate(MTApp, tempList); m = t.ConvertToMailMessage(thisUser.Email); if (MailServices.SendMail(m) == false) { FlashFailure("Error while sending mail!"); } } FlashSuccess("Your new password has been sent by email."); } else { FlashFailure("An error occurred while trying to update password."); } } else { FlashFailure(SiteTerms.GetTerm(SiteTermIds.Username) + " not found."); } } catch (SystemMembershipUserException CreateEx) { switch (CreateEx.Status) { case CreateUserStatus.UpdateFailed: FlashFailure("Update to user account failed."); break; default: FlashFailure(CreateEx.Message); break; } } }
protected override void OnLoad(System.EventArgs e) { base.OnLoad(e); this.LPVTitle.Text = SiteTerms.GetTerm(SiteTermIds.RecentlyViewedItems); LoadProductGrid(); }
public ActionResult Error() { ViewBag.Title = MTApp.CurrentStore.StoreName; Response.StatusCode = 404; string type = Request.QueryString["type"]; if (string.Compare(type, "product", true) == 0) { ViewBag.ErrorHeader = SiteTerms.GetTerm(SiteTermIds.ErrorPageHeaderTextProduct); ViewBag.ErrorContent = SiteTerms.GetTerm(SiteTermIds.ErrorPageContentTextProduct); if (ViewBag.ErrorHeader == string.Empty) { ViewBag.ErrorHeader = "Error finding product"; } if (ViewBag.ErrorContent == string.Empty) { ViewBag.ErrorContent = "An error occurred while trying to find the specified product."; } Response.StatusDescription = "Product Not Found"; } else if (string.Compare(type, "category", true) == 0) { ViewBag.ErrorHeader = SiteTerms.GetTerm(SiteTermIds.ErrorPageHeaderTextCategory); ViewBag.ErrorContent = SiteTerms.GetTerm(SiteTermIds.ErrorPageContentTextCategory); if (ViewBag.ErrorHeader == string.Empty) { ViewBag.ErrorHeader = "Error finding category"; } if (ViewBag.ErrorContent == string.Empty) { ViewBag.ErrorContent = "An error occurred while trying to find the specified category."; } Response.StatusDescription = "Category Not Found"; } else { string requested = string.Empty; if (Request.QueryString["aspxerrorpath"] != null) { requested = Request.QueryString["aspxerrorpath"]; } else { requested = Request.RawUrl; } MerchantTribe.Commerce.Content.CustomUrl url = MTApp.ContentServices.CustomUrls.FindByRequestedUrl(requested); if (url != null) { if (url.Bvin != string.Empty) { if (url.IsPermanentRedirect) { Response.RedirectPermanent(url.RedirectToUrl); } else { Response.Redirect(url.RedirectToUrl); } } } ViewBag.ErrorHeader = SiteTerms.GetTerm(SiteTermIds.ErrorPageHeaderTextGeneric); ViewBag.ErrorContent = SiteTerms.GetTerm(SiteTermIds.ErrorPageContentTextGeneric); if (ViewBag.ErrorHeader == string.Empty) { ViewBag.ErrorHeader = "Error finding page"; } if (ViewBag.ErrorContent == string.Empty) { ViewBag.ErrorContent = "An error occurred while processing your request."; } } return(View()); }
private bool ValidateOrder(CheckoutViewModel model) { bool result = true; if (model.AgreedToTerms == false && model.ShowAgreeToTerms == true) { model.Violations.Add(new MerchantTribe.Web.Validation.RuleViolation("Terms", "Terms", SiteTerms.GetTerm(SiteTermIds.SiteTermsAgreementError))); result = false; } // Validate Email MerchantTribe.Web.Validation.ValidationHelper.ValidEmail("Email Address", model.CurrentOrder.UserEmail, model.Violations, "customeremail"); // Validate Shipping Address model.Violations.AddRange(ValidateAddress(model.CurrentOrder.ShippingAddress, "Shipping")); // Validate Billing Address if (model.BillShipSame == false) { model.Violations.AddRange(ValidateAddress(model.CurrentOrder.BillingAddress, "Billing")); } Order Basket = SessionManager.CurrentShoppingCart(MTApp.OrderServices, MTApp.CurrentStore); //Collection<GiftCertificate> gcs = Basket.GetGiftCertificates(); //decimal totalValue = 0m; //foreach (GiftCertificate item in gcs) { // totalValue += item.CurrentAmount; //} // If Gift Certs are Included in the order, we may not need // additional payment information bool paymentFound = false; //Basket.CalculateGrandTotalOnly(false, false); //if ((totalValue >= Basket.TotalGrand)) { // paymentFound = true; //} // Make sure a shipping method is selected // Basket validation checks for shipping method unique key if (!Basket.IsValid()) { model.Violations.AddRange(Basket.GetRuleViolations()); } // Payment Validation model.Violations.AddRange(ValidatePayment(model)); if ((model.Violations.Count > 0)) { result = false; } return(result); }
private ProductPageViewModel IndexSetup(string slug) { ViewBag.BodyClass = "store-product-page"; ProductPageViewModel model = new ProductPageViewModel(); model.LocalProduct = ParseProductFromSlug(slug); RenderOptionsJavascript(model); // Page Title ViewBag.Title = model.LocalProduct.MetaTitle.Trim(); if (model.LocalProduct.MetaTitle.Trim().Length > 0) { ViewBag.Title = model.LocalProduct.MetaTitle; } else { ViewBag.Title = model.LocalProduct.ProductName; } // Meta Keywords ViewBag.MetaKeywords = model.LocalProduct.MetaKeywords.Trim(); if (model.LocalProduct.MetaKeywords.Trim().Length > 0) { ViewBag.MetaKeywords = model.LocalProduct.MetaKeywords; } // Meta Description ViewBag.MetaDescription = model.LocalProduct.MetaDescription.Trim(); if (model.LocalProduct.MetaDescription.Trim().Length > 0) { ViewBag.MetaDescription = model.LocalProduct.MetaDescription; } ViewBag.RelatedItemsTitle = SiteTerms.GetTerm(SiteTermIds.RelatedItems); ViewBag.AddToCartButtonUrl = MTApp.ThemeManager().ButtonUrl("addtocart", Request.IsSecureConnection); ViewBag.SubmitButtonUrl = MTApp.ThemeManager().ButtonUrl("submit", Request.IsSecureConnection); ViewBag.SaveLaterButton = MTApp.ThemeManager().ButtonUrl("SaveForLater", Request.IsSecureConnection); CheckForBackOrder(model); // Allow custom image names instead of the auto-generated ones string imageName = model.LocalProduct.ImageFileMedium; if (imageName.Trim().Length < 3) { imageName = model.LocalProduct.ImageFileSmall; } model.MainImageUrl = MerchantTribe.Commerce.Storage.DiskStorage.ProductImageUrlMedium(MTApp, model.LocalProduct.Bvin, imageName, Request.IsSecureConnection); model.MainImageAltText = model.LocalProduct.ImageFileMediumAlternateText; if (model.MainImageAltText.Trim().Length < 1) { model.MainImageAltText = model.LocalProduct.ImageFileSmallAlternateText; } model.PreRenderedTypeValues = model.LocalProduct.GetTypeProperties(this.MTApp); // Prices RenderPrices(model); LoadRelatedItems(model); RenderAdditionalImages(model); if (Request.QueryString["LineItemId"] != null) { model.OrderId = Request.QueryString["OrderBvin"]; model.LineItemId = Request.QueryString["LineItemId"]; } if (SessionManager.IsUserAuthenticated(MTApp)) { model.IsAvailableForWishList = true; } StringBuilder sb = new StringBuilder(); sb.Append("<script src=\"" + Url.Content("~/scripts/tabs.js") + "\" type=\"text/javascript\"></script>"); sb.Append("<script src=\"" + Url.Content("~/scripts/ProductPage.js") + "\" type=\"text/javascript\"></script>"); sb.Append(model.JavaScripts); if (ViewBag.UseFaceBook == true) { sb.Append("<!-- FaceBook OpenGraph Tags -->"); sb.Append("<meta property=\"og:title\" content=\"" + ViewBag.Title + "\"/>"); sb.Append("<meta property=\"og:type\" content=\"product\"/>"); sb.Append("<meta property=\"og:url\" content=\"" + ViewBag.CurrentUrl + "\"/>"); sb.Append("<meta property=\"og:image\" content=\"" + model.MainImageUrl + "\"/>"); sb.Append("<meta property=\"og:site_name\" content=\"" + ViewBag.StoreName + "\" />"); sb.Append("<meta property=\"fb:admins\" content=\"" + ViewBag.FaceBookAdmins + "\" />"); sb.Append("<meta property=\"fb:app_id\" content=\"" + ViewBag.FaceBookAppId + "\" />"); } ViewData["AnalyticsTop"] += sb.ToString(); StringBuilder sbb = new StringBuilder(); sbb.Append("<div id=\"fb-root\"></div>"); sbb.Append("<script> (function (d, s, id) {"); sbb.Append("var js, fjs = d.getElementsByTagName(s)[0];"); sbb.Append("if (d.getElementById(id)) { return; }"); sbb.Append("js = d.createElement(s); js.id = id;"); sbb.Append("js.src = \"//connect.facebook.net/en_US/all.js#xfbml=1\";"); sbb.Append("fjs.parentNode.insertBefore(js, fjs);"); sbb.Append("} (document, 'script', 'facebook-jssdk'));</script>"); ViewData["AnalyticsBottom"] += sbb.ToString(); // Bread Crumbs var breadRender = new code.TemplateEngine.TagHandlers.BreadCrumbs(); model.BreadCrumbsFinal = breadRender.RenderProduct(MTApp, new List <BreadCrumbItem>(), model.LocalProduct); // Columns var columnRender = new code.TemplateEngine.TagHandlers.ContentColumn(); model.PreColumn = columnRender.RenderColumnToString(model.LocalProduct.PreContentColumnId, MTApp, ViewBag); model.PostColumn = columnRender.RenderColumnToString(model.LocalProduct.PostContentColumnId, MTApp, ViewBag); model.SwatchHtml = MerchantTribe.Commerce.Utilities.ImageHelper.GenerateSwatchHtmlForProduct(model.LocalProduct, this.MTApp); MTApp.CurrentRequestContext.CurrentProduct = model.LocalProduct; return(model); }