private void LoadSettings() { siteSettings = CacheHelper.GetCurrentSiteSettings(); store = new Store(siteSettings.SiteGuid, ModuleId); config = new WebStoreConfiguration(Settings); //enableRatingsInProductList = WebUtils.ParseBoolFromHashtable( // Settings, "EnableContentRatingInProductListSetting", enableRatingsInProductList); //enableRatingComments = WebUtils.ParseBoolFromHashtable( // Settings, "EnableRatingCommentsSetting", enableRatingComments); //if (Settings.Contains("ProductListGroupingSetting")) //{ // groupingMode = Settings["ProductListGroupingSetting"].ToString(); //} switch (config.GroupingMode) { case GroupByOffer: this.offerList1.Visible = true; this.productList1.Visible = false; break; default: this.offerList1.Visible = false; this.productList1.Visible = true; break; } //pageNumber = WebUtils.ParseInt32FromQueryString("pagenumber", 1); //if (store == null) { return; } //currencyCulture = ResourceHelper.GetCurrencyCulture(store.DefaultCurrency); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); if (Page is mojoBasePage) { mojoBasePage basePage = Page as mojoBasePage; if (basePage.AnalyticsSection.Length == 0) { basePage.AnalyticsSection = ConfigHelper.GetStringProperty("AnalyticsWebStoreSection", "store"); } } }
private void LoadSettings() { AddClassToBody("webstore webstorecart"); SiteUtils.AddNoIndexMeta(Page); commerceConfig = SiteUtils.GetCommerceConfig(); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); moduleSettings = ModuleSettings.GetModuleSettings(moduleId); if (moduleSettings != null) { config = new WebStoreConfiguration(moduleSettings); } litCartFooter.Text = config.CartPageFooter; if (Request.IsAuthenticated) { siteUser = SiteUtils.GetCurrentSiteUser(); } store = StoreHelper.GetStore(); if (store == null) { return; } if ( (StoreHelper.UserHasCartCookie(store.Guid)) || (Request.IsAuthenticated) ) { cart = StoreHelper.GetCart(); } //if we can't process cards internally there is no reason (except a free order) to go to the ConfirmOrder.aspx page //and the order can be processed wtithout the user signing in or if the user is already signed in if ( ((!commerceConfig.CanProcessStandardCards) && (commerceConfig.WorldPayInstallationId.Length == 0)) && ((Request.IsAuthenticated) || (canCheckoutWithoutAuthentication)) ) { lnkCheckout.Visible = false; } if (cart == null) { pnlDiscountCode.Visible = false; lnkCheckout.Visible = false; return; } if ((cart.LastModified < DateTime.UtcNow.AddDays(-1)) && (cart.DiscountCodesCsv.Length > 0)) { StoreHelper.EnsureValidDiscounts(store, cart); } if (store != null) { canCheckoutWithoutAuthentication = store.CanCheckoutWithoutAuthentication(cart); } cartList.Store = store; cartList.ShoppingCart = cart; cartList.CurrencyCulture = currencyCulture; cartListAlt.Store = store; cartListAlt.ShoppingCart = cart; cartListAlt.CurrencyCulture = currencyCulture; if (displaySettings.UseAltCartList) { cartList.Visible = false; cartListAlt.Visible = true; } // disable till I finish //canCheckoutWithoutAuthentication = false; ConfigureCheckoutButtons(); int countOfDiscountCodes = Discount.GetCountOfActiveDiscountCodes(store.ModuleGuid); pnlDiscountCode.Visible = (countOfDiscountCodes > 0); // don't show the discount code panel if the cart is empty if (cart.SubTotal == 0) { // allow checkout if cart has items (support checkout with free items) if (cart.CartOffers.Count == 0) { lnkCheckout.Visible = false; } else { //cart has free items lnkCheckout.Visible = true; } //litOr.Visible = false; //btnPayPal.Visible = false; //btnGoogleCheckout.Visible = false; pnlDiscountCode.Visible = false; } // kill switch to disable discount codes (doesn't prevent use of ones already in the cart but prevents new uses bool disableDiscounts = false; ConfigHelper.GetBoolProperty("WebStoreDisabledDiscounts", disableDiscounts); if (disableDiscounts) { pnlDiscountCode.Visible = false; } //if (!Page.IsPostBack) //{ // if ((commerceConfig.PayPalIsEnabled) && (commerceConfig.PayPalUsePayPalStandard)) // { // if (Request.IsAuthenticated) // { // siteUser = SiteUtils.GetCurrentSiteUser(); // SetupPayPalStandardForm(); // } // else // { // //TODO: if the cart has no download items allow checkout without registration/sign in // // we need the user to be signed in before we send them to paypal if using PayPal Standard // // because we want to return them to their order summary and that requires login // // so we need to know who the user is before sending them to PayPal // litOr.Visible = false; // btnPayPal.Visible = false; // btnGoogleCheckout.Visible = false; // } // } //} //if (!Request.IsAuthenticated) //{ // if (commerceConfig.GoogleCheckoutIsEnabled) // { // if ( // (!commerceConfig.Is503TaxExempt) // && (cart != null) // && (cart.HasDonations()) // ) // { // lblGoogleMessage.Text = WebStoreResources.GoogleCheckoutDisabledForDonationsMessage; // lblGoogleMessage.Visible = true; // PaymentAcceptanceMark mark = (PaymentAcceptanceMark)pam1; // mark.SuppressGoogleCheckout = true; // btnGoogleCheckout.Visible = true; // btnGoogleCheckout.Enabled = false; // } // } //} //else //{ // if ( // (!commerceConfig.Is503TaxExempt) // && (cart != null) // && (cart.HasDonations()) // && (commerceConfig.GoogleCheckoutIsEnabled) // ) // { // btnGoogleCheckout.Visible = true; // btnGoogleCheckout.Enabled = false; // lblGoogleMessage.Text = WebStoreResources.GoogleCheckoutDisabledForDonationsMessage; // lblGoogleMessage.Visible = true; // } //} }
private void LoadSettings() { ScriptConfig.IncludeColorBox = true; currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); store = StoreHelper.GetStore(); if (store == null) { return; } Hashtable moduleSettings = ModuleSettings.GetModuleSettings(moduleId); config = new WebStoreConfiguration(moduleSettings); try { // this keeps the action from changing during ajax postback in folder based sites SiteUtils.SetFormAction(Page, Request.RawUrl); } catch (MissingMethodException) { //this method was introduced in .NET 3.5 SP1 } siteUser = SiteUtils.GetCurrentSiteUser(); offerGuid = WebUtils.ParseGuidFromQueryString("offer", offerGuid); if (offerGuid == Guid.Empty) { lnkProductsAdd.Visible = false; } else { SetupProductAddScript(); } virtualRoot = WebUtils.GetApplicationRoot(); timeOffset = SiteUtils.GetUserTimeOffset(); timeZone = SiteUtils.GetUserTimeZone(); if (store == null) { return; } AddClassToBody("webstore adminofferedit"); //currencyCulture = ResourceHelper.GetCurrencyCulture(store.DefaultCurrency); }
private void LoadSettings() { AddClassToBody("webstore webstorecart"); SiteUtils.AddNoIndexMeta(Page); commerceConfig = SiteUtils.GetCommerceConfig(); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); moduleSettings = ModuleSettings.GetModuleSettings(moduleId); if (moduleSettings != null) { config = new WebStoreConfiguration(moduleSettings); } litCartFooter.Text = config.CartPageFooter; if (Request.IsAuthenticated) { siteUser = SiteUtils.GetCurrentSiteUser(); } store = StoreHelper.GetStore(); if (store == null) { return; } if ( (StoreHelper.UserHasCartCookie(store.Guid)) || (Request.IsAuthenticated) ) { cart = StoreHelper.GetCart(); } //if we can't process cards internally there is no reason (except a free order) to go to the ConfirmOrder.aspx page //and the order can be processed wtithout the user signing in or if the user is already signed in if ( ((!commerceConfig.CanProcessStandardCards)&&(commerceConfig.WorldPayInstallationId.Length == 0)) && ((Request.IsAuthenticated) || (canCheckoutWithoutAuthentication)) ) { lnkCheckout.Visible = false; } if (cart == null) { pnlDiscountCode.Visible = false; lnkCheckout.Visible = false; return; } if ((cart.LastModified < DateTime.UtcNow.AddDays(-1)) && (cart.DiscountCodesCsv.Length > 0)) { StoreHelper.EnsureValidDiscounts(store, cart); } if (store != null) { canCheckoutWithoutAuthentication = store.CanCheckoutWithoutAuthentication(cart); } cartList.Store = store; cartList.ShoppingCart = cart; cartList.CurrencyCulture = currencyCulture; cartListAlt.Store = store; cartListAlt.ShoppingCart = cart; cartListAlt.CurrencyCulture = currencyCulture; if (displaySettings.UseAltCartList) { cartList.Visible = false; cartListAlt.Visible = true; } // disable till I finish //canCheckoutWithoutAuthentication = false; ConfigureCheckoutButtons(); int countOfDiscountCodes = Discount.GetCountOfActiveDiscountCodes(store.ModuleGuid); pnlDiscountCode.Visible = (countOfDiscountCodes > 0); // don't show the discount code panel if the cart is empty if (cart.SubTotal == 0) { // allow checkout if cart has items (support checkout with free items) if (cart.CartOffers.Count == 0) { lnkCheckout.Visible = false; } else { //cart has free items lnkCheckout.Visible = true; } //litOr.Visible = false; //btnPayPal.Visible = false; //btnGoogleCheckout.Visible = false; pnlDiscountCode.Visible = false; } // kill switch to disable discount codes (doesn't prevent use of ones already in the cart but prevents new uses bool disableDiscounts = false; ConfigHelper.GetBoolProperty("WebStoreDisabledDiscounts", disableDiscounts); if (disableDiscounts) { pnlDiscountCode.Visible = false; } //if (!Page.IsPostBack) //{ // if ((commerceConfig.PayPalIsEnabled) && (commerceConfig.PayPalUsePayPalStandard)) // { // if (Request.IsAuthenticated) // { // siteUser = SiteUtils.GetCurrentSiteUser(); // SetupPayPalStandardForm(); // } // else // { // //TODO: if the cart has no download items allow checkout without registration/sign in // // we need the user to be signed in before we send them to paypal if using PayPal Standard // // because we want to return them to their order summary and that requires login // // so we need to know who the user is before sending them to PayPal // litOr.Visible = false; // btnPayPal.Visible = false; // btnGoogleCheckout.Visible = false; // } // } //} //if (!Request.IsAuthenticated) //{ // if (commerceConfig.GoogleCheckoutIsEnabled) // { // if ( // (!commerceConfig.Is503TaxExempt) // && (cart != null) // && (cart.HasDonations()) // ) // { // lblGoogleMessage.Text = WebStoreResources.GoogleCheckoutDisabledForDonationsMessage; // lblGoogleMessage.Visible = true; // PaymentAcceptanceMark mark = (PaymentAcceptanceMark)pam1; // mark.SuppressGoogleCheckout = true; // btnGoogleCheckout.Visible = true; // btnGoogleCheckout.Enabled = false; // } // } //} //else //{ // if ( // (!commerceConfig.Is503TaxExempt) // && (cart != null) // && (cart.HasDonations()) // && (commerceConfig.GoogleCheckoutIsEnabled) // ) // { // btnGoogleCheckout.Visible = true; // btnGoogleCheckout.Enabled = false; // lblGoogleMessage.Text = WebStoreResources.GoogleCheckoutDisabledForDonationsMessage; // lblGoogleMessage.Visible = true; // } //} }
private void LoadSettings() { AddClassToBody($"webstore webstorecart {displaySettings.AdditionalBodyClass}"); SiteUtils.AddNoIndexMeta(Page); commerceConfig = SiteUtils.GetCommerceConfig(); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); moduleSettings = ModuleSettings.GetModuleSettings(moduleId); if (moduleSettings != null) { config = new WebStoreConfiguration(moduleSettings); } litCartFooter.Text = config.CartPageFooter; if (Request.IsAuthenticated) { siteUser = SiteUtils.GetCurrentSiteUser(); } store = StoreHelper.GetStore(); if (store == null) { return; } if ( (StoreHelper.UserHasCartCookie(store.Guid)) || (Request.IsAuthenticated) ) { cart = StoreHelper.GetCart(); } //if we can't process cards internally there is no reason (except a free order) to go to the ConfirmOrder.aspx page //and the order can be processed wtithout the user signing in or if the user is already signed in if ( ((!commerceConfig.CanProcessStandardCards) && (commerceConfig.WorldPayInstallationId.Length == 0)) //&& ((Request.IsAuthenticated) || (canCheckoutWithoutAuthentication)) //moved login prompt to cart so we don't need to have a link to the confirmorder page ) { //lnkConfirmOrder.Visible = false; litConfirmOrder.Visible = false; } if (cart == null) { pnlDiscountCode.Visible = false; //lnkConfirmOrder.Visible = false; litConfirmOrder.Visible = false; return; } if ((cart.LastModified < DateTime.UtcNow.AddDays(-1)) && (cart.DiscountCodesCsv.Length > 0)) { StoreHelper.EnsureValidDiscounts(store, cart); } if (store != null) { canCheckoutWithoutAuthentication = store.CanCheckoutWithoutAuthentication(cart); } cartList.Store = store; cartList.ShoppingCart = cart; cartList.CurrencyCulture = currencyCulture; cartList.DisplaySettings = displaySettings; cartListAlt.Store = store; cartListAlt.ShoppingCart = cart; cartListAlt.CurrencyCulture = currencyCulture; if (displaySettings.UseAltCartList) { cartList.Visible = false; cartListAlt.Visible = true; } ConfigureCheckoutButtons(); int countOfDiscountCodes = Discount.GetCountOfActiveDiscountCodes(store.ModuleGuid); pnlDiscountCode.Visible = (countOfDiscountCodes > 0); // don't show the discount code panel if the cart is empty if (cart.SubTotal == 0) { // allow checkout if cart has items (support checkout with free items) if (cart.CartOffers.Count == 0) { //lnkConfirmOrder.Visible = false; litConfirmOrder.Visible = false; } else { //cart has free items //lnkConfirmOrder.Visible = true; } //litOr.Visible = false; //btnPayPal.Visible = false; pnlDiscountCode.Visible = false; } // kill switch to disable discount codes (doesn't prevent use of ones already in the cart but prevents new uses bool disableDiscounts = false; ConfigHelper.GetBoolProperty("WebStoreDisabledDiscounts", disableDiscounts); if (disableDiscounts) { pnlDiscountCode.Visible = false; } }
private void LoadSettings() { pageId = WebUtils.ParseInt32FromQueryString("pageid", -1); moduleId = WebUtils.ParseInt32FromQueryString("mid", true, -1); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); store = StoreHelper.GetStore(); if (store == null) { return; } config = new WebStoreConfiguration(ModuleSettings.GetModuleSettings(store.ModuleId)); siteUser = SiteUtils.GetCurrentSiteUser(); productGuid = WebUtils.ParseGuidFromQueryString("prod", productGuid); if (productGuid == Guid.Empty) { return; } grdImages.Config = config; grdImages.ReferenceGuid = productGuid; virtualRoot = WebUtils.GetApplicationRoot(); upLoadPath = $"~/Data/Sites/{siteSettings.SiteId.ToInvariantString()}/webstoreproductfiles/"; teaserFileBasePath = $"~/Data/Sites/{siteSettings.SiteId.ToInvariantString()}/webstoreproductpreviewfiles/"; AddClassToBody("webstore webstoreproductedit"); FileSystemProvider p = FileSystemManager.Providers[WebConfigSettings.FileSystemProvider]; if (p == null) { log.Error($"Could not load file system provider {WebConfigSettings.FileSystemProvider}"); return; } fileSystem = p.GetFileSystem(); if (fileSystem == null) { log.Error($"Could not load file system from provider {WebConfigSettings.FileSystemProvider}"); return; } if (!fileSystem.FolderExists(upLoadPath)) { fileSystem.CreateFolder(upLoadPath); } if (!fileSystem.FolderExists(teaserFileBasePath)) { fileSystem.CreateFolder(teaserFileBasePath); } productUploader.ServiceUrl = SiteRoot + "/WebStore/upload.ashx?pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString() + "&prod=" + productGuid.ToString(); productUploader.UploadButtonClientId = btnUpload.ClientID; productUploader.FormFieldClientId = hdnState.ClientID; // not really used but prevents submitting all the form string refreshFunction = "function refresh" + moduleId.ToInvariantString() + " (data, errorsOccurred) { if(errorsOccurred === false) { $('#" + btnSave.ClientID + "').click(); } } "; productUploader.UploadCompleteCallback = "refresh" + moduleId.ToInvariantString(); ScriptManager.RegisterClientScriptBlock( this, this.GetType(), "refresh" + moduleId.ToInvariantString(), refreshFunction, true); teaserUploader.ServiceUrl = SiteRoot + "/WebStore/upload.ashx?type=teaser&pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString() + "&prod=" + productGuid.ToString(); teaserUploader.UploadButtonClientId = btnUploadTeaser.ClientID; teaserUploader.FormFieldClientId = hdnState.ClientID; // not really used but prevents submitting all the form teaserUploader.UploadCompleteCallback = "refresh" + moduleId.ToInvariantString(); ScriptConfig.IncludeColorBox = true; }