/// <summary> /// Indicates if exchange rate from global main currency is needed. /// </summary> protected bool IsFromGlobalRateNeeded() { string siteName = SiteInfoProvider.GetSiteName(ConfiguredSiteID); if ((ConfiguredSiteID == 0) || (ECommerceSettings.UseGlobalCurrencies(siteName))) { return(false); } string globalMainCode = CurrencyInfoProvider.GetMainCurrencyCode(0); string siteMainCode = CurrencyInfoProvider.GetMainCurrencyCode(ConfiguredSiteID); // Check whether main currencies are defined if (string.IsNullOrEmpty(siteMainCode) || string.IsNullOrEmpty(globalMainCode)) { return(false); } // Check whether global and site main currency are the same if (globalMainCode.ToLowerCSafe() == siteMainCode.ToLowerCSafe()) { return(false); } return(ECommerceSettings.AllowGlobalDiscountCoupons(siteName) || ECommerceSettings.AllowGlobalProductOptions(siteName) || ECommerceSettings.AllowGlobalProducts(siteName) || ECommerceSettings.AllowGlobalShippingOptions(siteName) || ECommerceSettings.UseGlobalCredit(siteName) || ECommerceSettings.UseGlobalTaxClasses(siteName)); }
/// <summary> /// Indicates if exchange rate from global main currency is needed. /// </summary> protected bool IsFromGlobalRateNeeded() { var siteId = ConfiguredSiteID; if ((siteId == 0) || (ECommerceSettings.UseGlobalCurrencies(siteId))) { return(false); } string globalMainCode = CurrencyInfoProvider.GetMainCurrencyCode(0); string siteMainCode = CurrencyInfoProvider.GetMainCurrencyCode(siteId); // Check whether main currencies are defined if (string.IsNullOrEmpty(siteMainCode) || string.IsNullOrEmpty(globalMainCode)) { return(false); } // Check whether global and site main currency are the same if (string.Equals(globalMainCode, siteMainCode, StringComparison.InvariantCultureIgnoreCase)) { return(false); } // Check if site has currency with same code as global main -> no need for global rate if (CurrencyInfoProvider.GetCurrenciesByCode(siteId).ContainsKey(globalMainCode)) { return(false); } return(ECommerceSettings.AllowGlobalProductOptions(siteId) || ECommerceSettings.AllowGlobalProducts(siteId) || ECommerceSettings.UseGlobalCredit(siteId) || ECommerceSettings.UseGlobalTaxClasses(siteId)); }
/// <summary> /// Returns Where condition according to global object settings. /// </summary> /// <param name="values"></param> protected string GetWhereCondition(string values) { string where = ""; if (Product != null) { // Offer global product options classes for global products or when using global tax classes if (Product.IsGlobal) { where = "CategorySiteID IS NULL"; } else { where = "CategorySiteID = " + Product.SKUSiteID; if (ECommerceSettings.AllowGlobalProductOptions(CMSContext.CurrentSiteName)) { where = SqlHelperClass.AddWhereCondition(where, "CategorySiteID IS NULL", "OR"); } } } if (DisplayOnlyEnabled) { where = SqlHelperClass.AddWhereCondition(where, "CategoryEnabled = 1"); } // Include selected values if (!string.IsNullOrEmpty(currentValues)) { where = SqlHelperClass.AddWhereCondition(where, "CategoryID IN (" + currentValues.Replace(';', ',') + ")", "OR"); } return(where); }
protected void Page_Load(object sender, EventArgs e) { // Setup help object options = new { helpName = "lnkProductEditHelp", helpUrl = DocumentationHelper.GetDocumentationTopicUrl(HELP_TOPIC_LINK) }; ScriptHelper.RegisterModule(this, "CMS/DialogContextHelpChange", options); if (ProductID > 0) { sku = SKUInfoProvider.GetSKUInfo(ProductID); EditedObject = sku; if (sku != null) { // Check site ID CheckEditedObjectSiteID(sku.SKUSiteID); ucOptions.ProductID = ProductID; // Add new category button in HeaderAction CurrentMaster.HeaderActions.ActionsList.Add(new HeaderAction { Text = GetString("com.productoptions.general.select"), OnClientClick = ucOptions.GetAddCategoryJavaScript(), Enabled = ECommerceContext.IsUserAuthorizedToModifySKU(sku.IsGlobal) }); // New button is active in editing of global product only if global option categories are allowed and user has GlobalModifyPermission permission bool enabledButton = (sku.IsGlobal) ? ECommerceSettings.AllowGlobalProductOptions(CurrentSiteName) && ECommerceContext.IsUserAuthorizedToModifyOptionCategory(true) : ECommerceContext.IsUserAuthorizedToModifyOptionCategory(false); // Create new enabled/disabled category button in HeaderAction var dialogUrl = UrlResolver.ResolveUrl("~/CMSModules/Ecommerce/Pages/Tools/ProductOptions/OptionCategory_New.aspx?ProductID=" + sku.SKUID + "&dialog=1"); dialogUrl = ApplicationUrlHelper.AppendDialogHash(dialogUrl); CurrentMaster.HeaderActions.ActionsList.Add(new HeaderAction { Text = GetString("com.productoptions.new"), Enabled = enabledButton, ButtonStyle = ButtonStyle.Default, OnClientClick = "modalDialog('" + dialogUrl + "','NewOptionCategoryDialog', 1000, 800);" }); } } }
protected override void OnInit(EventArgs e) { allowedGlobalCat = ECommerceSettings.AllowGlobalProductOptions(SiteContext.CurrentSiteName); // Attach Event Handlers for uniGrid & uniSelector categoryGrid.OnExternalDataBound += categoryGrid_OnExternalDataBound; categoryGrid.OnAction += categoryGrid_OnAction; uniSelector.OnItemsSelected += (sender, args) => SaveItems(); countsDataProvider = new ObjectTransformationDataProvider(); countsDataProvider.SetDefaultDataHandler(GetCountsDataHandler); // Hide AddSharedCategoryButton if (!DisplayAddSharedCategoryButton) { uniSelector.DialogButton.Visible = false; } base.OnInit(e); }