Пример #1
0
        private bool SaveInfo()
        {
            MTApp.CurrentStore.Settings.RewardsPointsName              = this.RewardsNameField.Text.Trim();
            MTApp.CurrentStore.Settings.RewardsPointsOnProductsActive  = this.chkPointsForProducts.Checked;
            MTApp.CurrentStore.Settings.RewardsPointsOnPurchasesActive = this.chkPointForDollars.Checked;
            int pointPerDollar = 1;

            if (int.TryParse(this.PointsPerDollarField.Text, out pointPerDollar))
            {
                MTApp.CurrentStore.Settings.RewardsPointsIssuedPerDollarSpent = pointPerDollar;
            }
            else
            {
                this.MessageBox1.ShowWarning("Please enter a valid point about issued");
                return(false);
            }
            int pointsPerCredit = 100;

            if (int.TryParse(this.PointsCreditField.Text, out pointsPerCredit))
            {
                MTApp.CurrentStore.Settings.RewardsPointsNeededPerDollarCredit = pointsPerCredit;
            }
            else
            {
                this.MessageBox1.ShowWarning("Please enter a valid point amount for redemption");
                return(false);
            }

            return(MTApp.UpdateCurrentStore());
        }
Пример #2
0
        public override string DeleteAction(string parameters, System.Collections.Specialized.NameValueCollection querystring, string postdata)
        {
            string data = string.Empty;
            string bvin = FirstParameter(parameters);


            if (bvin == string.Empty)
            {
                string howManyString = querystring["howmany"];
                int    howMany       = 0;
                int.TryParse(howManyString, out howMany);

                // Clear All Products Requested
                ApiResponse <ClearProductsData> response = new ApiResponse <ClearProductsData>();
                response.Content = MTApp.ClearProducts(howMany);
                data             = MerchantTribe.Web.Json.ObjectToJson(response);
            }
            else
            {
                // Single Item Delete
                ApiResponse <bool> response = new ApiResponse <bool>();
                response.Content = MTApp.DestroyProduct(bvin);
                data             = MerchantTribe.Web.Json.ObjectToJson(response);
            }

            return(data);
        }
Пример #3
0
 private void LoadSamples()
 {
     if (MTApp.CatalogServices.Products.FindAllCount() == 0)
     {
         MTApp.AddSampleProductsToStore();
     }
 }
Пример #4
0
        private CheckoutViewModel PaymentErrorSetup()
        {
            ViewBag.Title     = "Checkout Payment Error";
            ViewBag.BodyClass = "store-checkout-page";

            CheckoutViewModel model = new CheckoutViewModel();

            LoadPendingOrder(model);

            // Buttons
            ThemeManager themes = MTApp.ThemeManager();

            model.ButtonCheckoutUrl = themes.ButtonUrl("PlaceOrder", Request.IsSecureConnection);
            model.ButtonCancelUrl   = themes.ButtonUrl("Cancel", Request.IsSecureConnection);

            // Populate Countries
            model.Countries = MTApp.CurrentStore.Settings.FindActiveCountries();
            model.PaymentViewModel.AcceptedCardTypes = MTApp.CurrentStore.Settings.PaymentAcceptedCards;

            // Render Side Column
            var columnRender = new code.TemplateEngine.TagHandlers.ContentColumn();

            model.SideColumn = columnRender.RenderColumnToString("601", MTApp, ViewBag);

            ViewData["PassedAnalyticsTop"] += "<script type=\"text/javascript\" src=\"" + Url.Content("~/js/checkout.js") + "\" ></script>";
            return(model);
        }
Пример #5
0
        protected void btnSave_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            MTApp.CurrentStore.Settings.Analytics.DisableMerchantTribeAnalytics = !this.chkUseMerchantTribeAnalytics.Checked;

            MTApp.CurrentStore.Settings.Analytics.UseGoogleAdWords     = this.chkGoogleAdwords.Checked;
            MTApp.CurrentStore.Settings.Analytics.GoogleAdWordsId      = this.GoogleAdwordsConversionIdField.Text;
            MTApp.CurrentStore.Settings.Analytics.GoogleAdWordsLabel   = this.GoogleAdwordsLabelField.Text;
            MTApp.CurrentStore.Settings.Analytics.GoogleAdWordsBgColor = this.GoogleAdwordsBackgroundColorField.Text;

            MTApp.CurrentStore.Settings.Analytics.UseGoogleEcommerce       = this.chkGoogleEcommerce.Checked;
            MTApp.CurrentStore.Settings.Analytics.GoogleEcommerceCategory  = this.GoogleEcommerceCategoryNameField.Text;
            MTApp.CurrentStore.Settings.Analytics.GoogleEcommerceStoreName = this.GoogleEcommerceStoreNameField.Text;

            MTApp.CurrentStore.Settings.Analytics.UseGoogleTracker = this.chkGoogleTracker.Checked;
            MTApp.CurrentStore.Settings.Analytics.GoogleTrackerId  = this.GoogleTrackingIdField.Text;

            MTApp.CurrentStore.Settings.Analytics.UseYahooTracker = this.chkYahoo.Checked;
            MTApp.CurrentStore.Settings.Analytics.YahooAccountId  = this.YahooAccountIdField.Text;

            MTApp.CurrentStore.Settings.Analytics.AdditionalMetaTags = this.AdditionalMetaTagsField.Text;
            MTApp.CurrentStore.Settings.Analytics.BottomAnalytics    = this.BottomAnalyticsField.Text;

            MTApp.UpdateCurrentStore();

            this.MessageBox1.ShowOk("Settings Saved!");
        }
Пример #6
0
        private void SaveData()
        {
            MTApp.CurrentStore.Settings.MailServer.HostAddress       = MailServerField.Text.Trim();
            MTApp.CurrentStore.Settings.MailServer.UseAuthentication = this.chkMailServerAuthentication.Checked;
            MTApp.CurrentStore.Settings.MailServer.Username          = this.UsernameField.Text.Trim();
            if (this.PasswordField.Text.Trim().Length > 0)
            {
                if (this.PasswordField.Text != "****************")
                {
                    MTApp.CurrentStore.Settings.MailServer.Password = this.PasswordField.Text.Trim();
                    this.PasswordField.Text = "****************";
                }
            }

            MTApp.CurrentStore.Settings.MailServer.UseSsl = this.chkSSL.Checked;
            MTApp.CurrentStore.Settings.MailServer.Port   = this.SmtpPortField.Text.Trim();
            if (this.lstMailServerChoice.SelectedItem.Value == "1")
            {
                MTApp.CurrentStore.Settings.MailServer.UseCustomMailServer = true;
            }
            else
            {
                MTApp.CurrentStore.Settings.MailServer.UseCustomMailServer = false;
            }
            MTApp.UpdateCurrentStore();
        }
Пример #7
0
        public ActionResult RemoveLineItem()
        {
            string ids = Request["lineitemid"] ?? string.Empty;
            long   Id  = 0;

            long.TryParse(ids, out Id);

            string orderBvin = Request["orderbvin"] ?? string.Empty;

            Order Basket = SessionManager.CurrentShoppingCart(MTApp.OrderServices, MTApp.CurrentStore);

            if (Basket != null)
            {
                if (Basket.bvin == orderBvin)
                {
                    var li = Basket.Items.Where(y => y.Id == Id).SingleOrDefault();
                    if (li != null)
                    {
                        Basket.Items.Remove(li);
                        MTApp.CalculateOrderAndSave(Basket);
                        SessionManager.SaveOrderCookies(Basket, MTApp.CurrentStore);
                    }
                }
            }
            return(Redirect("~/cart"));
        }
Пример #8
0
        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);
        }
Пример #9
0
        public void ForwardToCheckout(CartViewModel model)
        {
            if (Request["paypalexpress"] != null && Request["paypalexpress"] == "true")
            {
                ForwardToPayPalExpress(model);
            }

            OrderTaskContext c = new OrderTaskContext(MTApp);

            c.UserId = SessionManager.GetCurrentUserId(MTApp.CurrentStore);
            c.Order  = model.CurrentOrder;
            if (Workflow.RunByName(c, WorkflowNames.CheckoutSelected))
            {
                Response.Redirect(MTApp.StoreUrl(true, false) + "checkout");
            }
            else
            {
                bool customerMessageFound = false;
                foreach (WorkflowMessage msg in c.Errors)
                {
                    EventLog.LogEvent(msg.Name, msg.Description, EventLogSeverity.Error);
                    if (msg.CustomerVisible)
                    {
                        customerMessageFound = true;
                        this.FlashFailure(msg.Description);
                    }
                }
                if (!customerMessageFound)
                {
                    EventLog.LogEvent("Checkout Selected Workflow", "Checkout failed but no errors were recorded.", EventLogSeverity.Error);
                    this.FlashFailure("Checkout Failed. If problem continues, please contact customer support.");
                }
            }
        }
Пример #10
0
        private bool Save()
        {
            MTApp.CurrentStore.Settings.MetaKeywords    = this.MetaKeywordsField.Text.Trim();
            MTApp.CurrentStore.Settings.MetaDescription = this.MetaDescriptionField.Text.Trim();

            return(MTApp.UpdateCurrentStore());
        }
Пример #11
0
        private void LoadOrder()
        {
            if (Request.Params["id"] != null)
            {
                Order o = MTApp.OrderServices.Orders.FindForCurrentStore(Request.Params["id"]);
                if (o == null)
                {
                    FlashFailure("Order could not be found. Please contact store for assistance.");
                    return;
                }

                if (o.CustomProperties.Where(y => (y.DeveloperId == "bvsoftware") &&
                                             (y.Key == "allowpasswordreset") &&
                                             (y.Value == "1")
                                             ).Count() > 0)
                {
                    ViewBag.AllowPasswordReset = true;
                    ViewBag.Email           = o.UserEmail;
                    ViewBag.OrderBvin       = o.bvin;
                    ViewBag.SubmitButtonUrl = MTApp.ThemeManager().ButtonUrl("Submit", Request.IsSecureConnection);
                }
                else
                {
                    ViewBag.AllowPasswordReset = false;
                }


                ViewBag.Order          = o;
                ViewBag.AcumaticaOrder = null;

                OrderPaymentSummary paySummary = MTApp.OrderServices.PaymentSummary(o);
                ViewBag.OrderPaymentSummary = paySummary;

                // File Downloads
                List <ProductFile> fileDownloads = new List <ProductFile>();
                if ((o.PaymentStatus == OrderPaymentStatus.Paid) && (o.StatusCode != OrderStatusCode.OnHold))
                {
                    foreach (LineItem item in o.Items)
                    {
                        if (item.ProductId != string.Empty)
                        {
                            List <ProductFile> productFiles = MTApp.CatalogServices.ProductFiles.FindByProductId(item.ProductId);
                            foreach (ProductFile file in productFiles)
                            {
                                fileDownloads.Add(file);
                            }
                        }
                    }
                }
                ViewBag.FileDownloads          = fileDownloads;
                ViewBag.FileDownloadsButtonUrl = MTApp.ThemeManager().ButtonUrl("download", Request.IsSecureConnection);

                RenderAnalytics(o);
            }
            else
            {
                FlashFailure("Order Number missing. Please contact an administrator.");
                return;
            }
        }
Пример #12
0
        private void LoadRelatedItems(ProductPageViewModel model)
        {
            int  MaxItemsToShow         = 3;
            bool IncludeAutoSuggestions = true;

            List <ProductRelationship> relatedItems
                = MTApp.CatalogServices.ProductRelationships.FindForProduct(model.LocalProduct.Bvin);

            if (relatedItems == null)
            {
                return;
            }

            int maxItems = MaxItemsToShow;

            // we have fewer available than max to show
            if (relatedItems.Count < MaxItemsToShow)
            {
                if (IncludeAutoSuggestions)
                {
                    // try to fill in auto suggestions
                    int toAuto = MaxItemsToShow - relatedItems.Count;
                    List <ProductRelationship> autos = MTApp.GetAutoSuggestedRelatedItems(model.LocalProduct.Bvin, toAuto);
                    if (autos != null)
                    {
                        foreach (ProductRelationship r in autos)
                        {
                            relatedItems.Add(r);
                        }
                    }
                }

                maxItems = relatedItems.Count;
            }


            if (relatedItems.Count < 1)
            {
                return;
            }

            for (int i = 0; i < maxItems; i++)
            {
                string  relatedBvin = relatedItems[i].RelatedProductId;
                Product related     = MTApp.CatalogServices.Products.Find(relatedBvin);
                if (related != null)
                {
                    SingleProductViewModel item = new SingleProductViewModel(related, MTApp);
                    if (i == 0)
                    {
                        item.IsFirstItem = true;
                    }
                    if (i == (maxItems - 1))
                    {
                        item.IsLastItem = true;
                    }
                    model.RelatedItems.Add(item);
                }
            }
        }
        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));
        }
Пример #14
0
        private void LoadValuesFromForm(CheckoutViewModel model)
        {
            // Email
            model.CurrentOrder.UserEmail = Request.Form["customeremail"];

            // Addresses
            model.BillShipSame = (Request.Form["chkbillsame"] != null);

            LoadAddressFromForm("shipping", model.CurrentOrder.ShippingAddress);
            if (model.BillShipSame)
            {
                model.CurrentOrder.ShippingAddress.CopyTo(model.CurrentOrder.BillingAddress);
            }
            else
            {
                LoadAddressFromForm("billing", model.CurrentOrder.BillingAddress);
            }
            // Save addresses to customer account
            if (model.IsLoggedIn)
            {
                model.CurrentOrder.ShippingAddress.CopyTo(model.CurrentOrder.ShippingAddress);
                if (model.BillShipSame == false)
                {
                    model.CurrentOrder.BillingAddress.CopyTo(model.CurrentCustomer.BillingAddress);
                }
                MTApp.MembershipServices.Customers.Update(model.CurrentCustomer);
            }

            //Shipping
            string shippingRateKey = Request.Form["shippingrate"];

            MTApp.OrderServices.OrdersRequestShippingMethodByUniqueKey(shippingRateKey, model.CurrentOrder, MTApp.CurrentStore);

            // Save Values so far in case of later errors
            MTApp.CalculateOrder(model.CurrentOrder);

            // Save Payment Information
            model.UseRewardsPoints = Request.Form["userewardspoints"] == "1";
            ApplyRewardsPoints(model);

            // Payment Methods
            LoadPaymentFromForm(model);
            SavePaymentSelections(model);

            // Instructions
            model.CurrentOrder.Instructions = Request.Form["specialinstructions"];

            // Agree to Terms
            var agreedValue = Request.Form["agreed"];

            if (!String.IsNullOrEmpty(agreedValue))
            {
                model.AgreedToTerms = true;
            }


            // Save all the changes to the order
            MTApp.OrderServices.Orders.Update(model.CurrentOrder);
            SessionManager.SaveOrderCookies(model.CurrentOrder, MTApp.CurrentStore);
        }
Пример #15
0
        private void LoadProducts()
        {
            TimeZoneInfo tz         = MTApp.CurrentStore.Settings.TimeZone;
            DateTime     localStart = this.DateRangeField.StartDateForZone(tz);
            DateTime     localEnd   = this.DateRangeField.EndDateForZone(tz);

            DateTime utcStart = TimeZoneInfo.ConvertTimeToUtc(localStart, tz);
            DateTime utcEnd   = TimeZoneInfo.ConvertTimeToUtc(localEnd, tz);

            List <Product> t = MTApp.ReportingTopSellersByDate(utcStart, utcEnd, 10);

            if (t.Count == 0)
            {
                this.lblResults.Text = "No Products Found";
            }
            else if (t.Count == 1)
            {
                this.lblResults.Text = "1 product found";
            }
            else if (t.Count > 1)
            {
                this.lblResults.Text = t.Count + " products found";
            }

            this.GridView1.DataSource = t;
            this.GridView1.DataBind();
        }
Пример #16
0
        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 PrepBVOrder(string bvin)
        {
            Order o = MTApp.OrderServices.Orders.FindForCurrentStore(bvin);

            ViewBag.Order          = o;
            ViewBag.AcumaticaOrder = null;

            OrderPaymentSummary paySummary = MTApp.OrderServices.PaymentSummary(o);

            ViewBag.OrderPaymentSummary = paySummary;

            // File Downloads
            List <ProductFile> fileDownloads = new List <ProductFile>();

            if ((o.PaymentStatus == OrderPaymentStatus.Paid) && (o.StatusCode != OrderStatusCode.OnHold))
            {
                foreach (LineItem item in o.Items)
                {
                    if (item.ProductId != string.Empty)
                    {
                        List <ProductFile> productFiles = MTApp.CatalogServices.ProductFiles.FindByProductId(item.ProductId);
                        foreach (ProductFile file in productFiles)
                        {
                            fileDownloads.Add(file);
                        }
                    }
                }
            }
            ViewBag.FileDownloads          = fileDownloads;
            ViewBag.FileDownloadsButtonUrl = MTApp.ThemeManager().ButtonUrl("download", Request.IsSecureConnection);
        }
Пример #18
0
        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();
        }
Пример #19
0
        public ActionResult AddToCart(long itemid)
        {
            string       customerId = SessionManager.GetCurrentUserId(MTApp.CurrentStore);
            WishListItem wi         = MTApp.CatalogServices.WishListItems.Find(itemid);

            if (wi != null)
            {
                if (wi.CustomerId == customerId)
                {
                    // Add to Cart
                    Product p = MTApp.CatalogServices.Products.Find(wi.ProductId);

                    bool IsPurchasable = ValidateSelections(p, wi);
                    if ((IsPurchasable))
                    {
                        LineItem li = MTApp.CatalogServices.ConvertProductToLineItem(p,
                                                                                     wi.SelectionData,
                                                                                     1,
                                                                                     MTApp);
                        Order Basket = SessionManager.CurrentShoppingCart(MTApp.OrderServices, MTApp.CurrentStore);
                        if (Basket.UserID != SessionManager.GetCurrentUserId(MTApp.CurrentStore))
                        {
                            Basket.UserID = SessionManager.GetCurrentUserId(MTApp.CurrentStore);
                        }

                        MTApp.AddToOrderWithCalculateAndSave(Basket, li);
                        SessionManager.SaveOrderCookies(Basket, MTApp.CurrentStore);

                        return(Redirect("~/cart"));
                    }
                }
            }
            return(RedirectToAction("index"));
        }
Пример #20
0
        [HttpPost] // POST: /checkout/applyshipping
        public ActionResult ApplyShipping()
        {
            ApplyShippingResponse result = new ApplyShippingResponse();

            string rateKey = Request.Form["MethodId"];
            string orderid = Request.Form["OrderId"];

            if (rateKey == null)
            {
                rateKey = "";
            }
            if (orderid == null)
            {
                orderid = "";
            }


            Order o = MTApp.OrderServices.Orders.FindForCurrentStore(orderid);

            MTApp.OrderServices.OrdersRequestShippingMethodByUniqueKey(rateKey, o, MTApp.CurrentStore);
            MTApp.CalculateOrderAndSave(o);
            SessionManager.SaveOrderCookies(o, MTApp.CurrentStore);

            result.totalsastable = o.TotalsAsTable();

            return(new PreJsonResult(MerchantTribe.Web.Json.ObjectToJson(result)));
        }
Пример #21
0
        private void LoadThemes()
        {
            ThemeManager     tm        = MTApp.ThemeManager();
            List <ThemeView> available = tm.FindAvailableThemes(true);

            this.litThemes.Text = RenderThemes(available);
        }
Пример #22
0
        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);
        }
 private void ChangeEmailSetup()
 {
     ViewBag.Title           = "Change Email";
     ViewBag.MetaDescription = "Change Email | " + MTApp.CurrentStore.Settings.MetaDescription;
     ViewBag.MetaKeywords    = MTApp.CurrentStore.Settings.MetaKeywords;
     ViewBag.BodyClass       = "myaccountchangeemailpage";
     ViewBag.SaveButtonUrl   = MTApp.ThemeManager().ButtonUrl("submit", Request.IsSecureConnection);
 }
 private void EditSetup()
 {
     ViewBag.Title           = "Edit Address";
     ViewBag.MetaDescription = "Edit Address | " + MTApp.CurrentStore.Settings.MetaDescription;
     ViewBag.MetaKeywords    = MTApp.CurrentStore.Settings.MetaKeywords;
     ViewBag.BodyClass       = "myaccountaddresseditpage";
     ViewBag.SaveButtonUrl   = MTApp.ThemeManager().ButtonUrl("savechanges", Request.IsSecureConnection);
 }
Пример #25
0
        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);
            string themeId = Request.QueryString["id"];

            this.MTApp.ThemeManager().InstallTheme(themeId);
            MTApp.UpdateCurrentStore();
            Response.Redirect("WizardPayment.aspx");
        }
Пример #26
0
        private void LoadShippingMethodsForOrder(CheckoutViewModel model)
        {
            Order o = model.CurrentOrder;

            o.ShippingAddress.CopyTo(o.BillingAddress);
            MTApp.CalculateOrderAndSave(o);
            SessionManager.SaveOrderCookies(o, MTApp.CurrentStore);
            LoadShippingMethodsForOrder(o);
        }
Пример #27
0
        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);
            string themeId = Request.QueryString["id"];

            this.MTApp.SwitchTheme(themeId);
            MTApp.UpdateCurrentStore();
            Response.Redirect("Themes.aspx");
        }
Пример #28
0
 private void UpdateLogoImage()
 {
     LogoImage = MTApp.CurrentStore.Settings.LogoImageFullUrl(MTApp, Page.Request.IsSecureConnection);
     if (MTApp.CurrentStore.Settings.LogoImage.Trim() == string.Empty)
     {
         LogoImage = "../../content/admin/images/MissingImage.png";
     }
     MTApp.UpdateCurrentStore();
 }
        protected void SaveImageButton_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            MTApp.CurrentStore.Settings.HandlingAmount      = decimal.Parse(this.HandlingFeeAmountTextBox.Text, System.Globalization.NumberStyles.Currency);
            MTApp.CurrentStore.Settings.HandlingType        = this.HandlingRadioButtonList.SelectedIndex;
            MTApp.CurrentStore.Settings.HandlingNonShipping = this.NonShippingCheckBox.Checked;
            MTApp.UpdateCurrentStore();

            this.MessageBox1.ShowOk("Settings saved successfully.");
        }
Пример #30
0
        private void LoadThemes()
        {
            ThemeManager tm = MTApp.ThemeManager();

            List <ThemeView> installed = tm.FindInstalledThemes();
            List <ThemeView> available = tm.FindAvailableThemes();

            this.litInstalled.Text = RenderInstalled(installed);
            this.litAvailable.Text = RenderAvailable(available);
        }