コード例 #1
0
        internal static string ReadMultiStoreItemFromPropertiesDictionary(string propertyAlias, ILocalization localization, IPropertyProvider fields)
        {
            var currencyCode    = localization.CurrencyCode;
            var storeAlias      = localization.StoreAlias;
            var multiStoreAlias = CreateMultiStorePropertyAlias(propertyAlias, storeAlias);

            if (!string.IsNullOrEmpty(currencyCode))
            {
                if (!string.IsNullOrEmpty(storeAlias))
                {
                    var multiStoreMultiCurrenyAlias = CreateFullLocalizedPropertyAlias(propertyAlias, localization);
                    if (fields.ContainsKey(multiStoreMultiCurrenyAlias))
                    {
                        var value = fields.GetStringValue(multiStoreMultiCurrenyAlias);

                        if (!string.IsNullOrEmpty(value))
                        {
                            return(value);
                        }
                    }
                }
                var multiCurrencyAlias = CreateMultiStorePropertyAlias(propertyAlias, currencyCode);
                if (fields.ContainsKey(multiCurrencyAlias))
                {
                    var value = fields.GetStringValue(multiCurrencyAlias);

                    if (!string.IsNullOrEmpty(value))
                    {
                        return(value);
                    }
                }
            }

            if (!string.IsNullOrEmpty(storeAlias))
            {
                if (fields.ContainsKey(multiStoreAlias))
                {
                    var value = fields.GetStringValue(multiStoreAlias);

                    if (!string.IsNullOrEmpty(value))
                    {
                        return(value);
                    }
                }
            }
            if (fields.ContainsKey(propertyAlias))
            {
                var value = fields.GetStringValue(propertyAlias);

                return(value ?? string.Empty);
            }
            return(string.Empty);
        }
コード例 #2
0
        public override void LoadDataFromPropertiesDictionary(ProductVariantGroup variantgroup, IPropertyProvider fields, ILocalization localization)
        {
            variantgroup.Localization = localization;
            var store = _storeService.GetByAlias(localization.StoreAlias);

            variantgroup.Variants        = Enumerable.Empty <IProductVariant>();
            variantgroup.ProductVariants = Enumerable.Empty <ProductVariant>();

            variantgroup.Title = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.title, localization, fields);

            var rteItem = "RTEItem" + _aliasses.description;

            variantgroup.Description = IO.Container.Resolve <ICMSApplication>().ParseInternalLinks(
                StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(fields.ContainsKey(rteItem) ? rteItem : _aliasses.description, localization, fields));

            variantgroup.Disabled = StoreHelper.GetMultiStoreDisableExamine(localization, fields);

            var value = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.required, localization, fields);

            variantgroup.Required = value == "1" || value == "true";

            //variantgroup.ProductVariantFactory = () => IO.Container.Resolve<IProductVariantService>().GetAll(localization).Where(productvariantgroup => productvariantgroup.ParentId == variantgroup.Id).Cast<IProductVariant>().ToList();

            variantgroup.Variants = IO.Container.Resolve <IProductVariantService>().GetAll(localization).Where(variant => variant.ParentId == variantgroup.Id).Cast <IProductVariant>().ToList();
        }
コード例 #3
0
 private string FieldsValueOrEmpty(string propertyAlias, IPropertyProvider fields)
 {
     if (fields.ContainsKey(propertyAlias))
     {
         return(fields.GetStringValue(propertyAlias));
     }
     return(string.Empty);
 }
コード例 #4
0
        internal static int GetLocalizedPrice(string propertyAlias, ILocalization localization, IPropertyProvider fields)
        {
            int price;
            var fullLocalizedPricePropetryAlias = CreateFullLocalizedPropertyAlias(propertyAlias, localization);

            if (fields.ContainsKey(fullLocalizedPricePropetryAlias) && int.TryParse(fields.GetStringValue(fullLocalizedPricePropetryAlias), out price))
            {
                return(price);
            }
            var localizedPricePropertyAlias = CreateMultiStorePropertyAlias(propertyAlias, localization.CurrencyCode);

            if (fields.ContainsKey(localizedPricePropertyAlias) && int.TryParse(fields.GetStringValue(localizedPricePropertyAlias), out price))
            {
                return(price);
            }
            price = GetMultiStoreIntValue(propertyAlias, localization, fields);
            return(LocalizePrice(price, localization));
        }
コード例 #5
0
        public override void LoadDataFromPropertiesDictionary(ProductVariant variant, IPropertyProvider fields, ILocalization localization)
        {
            variant.Localization = localization;
            var store = _storeService.GetByAlias(localization.StoreAlias);

            variant.Disabled = StoreHelper.GetMultiStoreDisableExamine(localization, fields);
            variant.Title    = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.title, localization, fields);

            var rteItem = "RTEItem" + _aliasses.description;

            variant.Description = IO.Container.Resolve <ICMSApplication>().ParseInternalLinks(
                StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(fields.ContainsKey(rteItem) ? rteItem : _aliasses.description, localization, fields));

            variant.SKU = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.sku, localization, fields);

            variant.OriginalPriceInCents = StoreHelper.GetLocalizedPrice(_aliasses.price, localization, fields);

            variant.Weight = StoreHelper.GetMultiStoreDoubleValue(_aliasses.weight, localization, fields);
            variant.Width  = StoreHelper.GetMultiStoreDoubleValue(_aliasses.width, localization, fields);
            variant.Length = StoreHelper.GetMultiStoreDoubleValue(_aliasses.length, localization, fields);
            variant.Height = StoreHelper.GetMultiStoreDoubleValue(_aliasses.height, localization, fields);

            var stockStatus = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.stockStatus, localization, fields);

            if (stockStatus == "default" || stockStatus == string.Empty)
            {
                variant.StockStatus = store.UseStock;
            }
            else
            {
                variant.StockStatus = stockStatus == "enable" || stockStatus == "1" || stockStatus == "true";
            }
            var backorderStatus = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.backorderStatus, localization, fields);

            if (backorderStatus == "default" || backorderStatus == string.Empty)
            {
                variant.BackorderStatus = store.UseBackorders;
            }
            else
            {
                variant.BackorderStatus = backorderStatus == "enable" || backorderStatus == "1" || backorderStatus == "true";
            }

            variant.Group = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary("group", localization, fields);

            var value = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary("requiredVariant", localization, fields);

            variant.Required = value == "1" || value == "true";

            var rangesString = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.ranges, localization, fields);

            variant.Ranges = StoreHelper.LocalizeRanges(Range.CreateFromString(rangesString), localization);
        }
コード例 #6
0
        internal static bool GetMultiStoreDisableExamine(ILocalization localization, IPropertyProvider fields)
        {
            const string        propertyAlias = "disable";
            Func <string, bool> valueCheck    = value => value == "1" || value == "true";

            if (fields.ContainsKey(propertyAlias) && valueCheck(fields.GetStringValue(propertyAlias)))
            {
                return(true);
            }

            var val = ReadMultiStoreItemFromPropertiesDictionary(propertyAlias, localization, fields);

            return(valueCheck(val));
        }
コード例 #7
0
        public override void LoadDataFromPropertiesDictionary(Category category, IPropertyProvider fields, ILocalization localization)
        {
            category.Localization = localization;
            category.ClearCachedValues();             // (hack to reload relations)

            category.Disabled = StoreHelper.GetMultiStoreDisableExamine(localization, fields);

            category.Title           = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.title, localization, fields);
            category.URL             = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.url, localization, fields);
            category.MetaDescription = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.metaDescription, localization, fields);

            var rteItem = "RTEItem" + _aliasses.description;

            category.Description = IO.Container.Resolve <ICMSApplication>().ParseInternalLinks(
                StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(fields.ContainsKey(rteItem) ? rteItem : _aliasses.description, localization, fields));

            category.SetTemplate(StoreHelper.GetMultiStoreIntValue("template", localization, fields));

            // todo: refactor below to set simpel properties on Category instead of internal fields that are used by product to make the actual properties

            Category.ImageFactory = InternalHelpers.LoadImageWithId;
            var imagesProperty = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.images, localization, fields);

            category.ImageIds = DomainHelper.ParseIntegersFromUwebshopProperty(imagesProperty).ToArray();            //.Select(InternalHelpers.LoadImageWithId).ToList();

            // todo: load categories from service (using stubs???)
            var values = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.categories, localization, fields);

            category._categoryIds  = DomainHelper.ParseIntegersFromUwebshopProperty(values).ToList();
            category.HasCategories = !string.IsNullOrEmpty(values);

            var tagsValue = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.metaTags, localization, fields);

            category.Tags = InternalHelpers.ParseTagsString(tagsValue);

            // todo: inefficient
            category.ProductsFactory = () => IO.Container.Resolve <IProductService>().GetAll(localization).Where(product => product.ParentId == category.Id || product.HasCategories && product.Categories.Any(cat => cat.Id == category.Id)).Cast <API.IProduct>().ToList();
        }
コード例 #8
0
        public override void LoadDataFromPropertiesDictionary(Product product, IPropertyProvider fields, ILocalization localization)
        {
            if (product == null)
            {
                throw new ArgumentNullException("product");
            }
            if (fields == null)
            {
                throw new ArgumentNullException("fields");
            }
            if (localization == null)
            {
                throw new ArgumentNullException("localization");
            }
            if (_aliasses == null)
            {
                throw new NullReferenceException("_aliasses");
            }
            if (_settingsService == null)
            {
                throw new NullReferenceException("_settingsService");
            }
            if (_storeService == null)
            {
                throw new NullReferenceException("_storeService");
            }

            product.Localization = localization;

            var store = _storeService.GetByAlias(localization.StoreAlias);

            if (store == null)
            {
                throw new NullReferenceException("Store with alias " + localization.StoreAlias + " not found! Please rebuild examine index");
            }

            product.ClearCachedValues();             // (hack to reload relations)

            product.PricesIncludingVat = _settingsService.IncludingVat;

            product.SetTemplate(StoreHelper.GetMultiStoreIntValue("template", localization, fields));

            product.Title           = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.title, localization, fields);
            product.URL             = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.url, localization, fields);
            product.MetaDescription = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.metaDescription, localization, fields);

            var rteItem = "RTEItem" + _aliasses.description;

            product.Description = IO.Container.Resolve <ICMSApplication>().ParseInternalLinks(
                StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(fields.ContainsKey(rteItem) ? rteItem : _aliasses.description, localization, fields));

            product.SKU          = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.sku, localization, fields);
            Product.ImageFactory = InternalHelpers.LoadImageWithId;

            var imagesProperty = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.images, localization, fields);

            product.ImageIds = DomainHelper.ParseIntegersFromUwebshopProperty(imagesProperty).ToArray();

            var filesProperty = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.files, localization, fields);

            Product.FileFactory = InternalHelpers.LoadFileWithId;
            product.FileIds     = DomainHelper.ParseIntegersFromUwebshopProperty(filesProperty).ToArray();        //.Select(InternalHelpers.LoadFileWithId).Where(x => x !=null).ToList();

            // todo: load categories from service
            var values = StoreHelper.ReadMultiStoreItemFromPropertiesDictionary(_aliasses.categories, localization, fields);

            product.CategoryIds = DomainHelper.ParseIntegersFromUwebshopProperty(values).ToList();
            if (!product.CategoryIds.Contains(product.ParentId) /* todo: and parent is not ProductRepo */)
            {
                product.CategoryIds = new List <int> {
                    product.ParentId
                }
            }
コード例 #9
0
		///// <summary>
		///// Loads the data from examine.
		///// </summary>
		///// <param name="storeAlias">The store alias.</param>
		///// <param name="examineNode">The examine node.</param>
		///// <returns></returns>
		//protected virtual bool LoadDataFromExamine(string storeAlias, SearchResult examineNode = null)
		//{
		//	//Log.Instance.LogDebug( DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt") + "LoadDataFromExamine::NodeBase start"); 
		//	bool logAtEnd = false;
		//	if (examineNode == null)
		//	{
		//		logAtEnd = true;
		//		examineNode = StoreHelper.GetNodeFromExamine(_nodeId);
		//	}
		//	if (examineNode == null)
		//	{
		//		return false;
		//	}

		//	LoadFieldsFromExamine(new DictionaryPropertyProvider(examineNode));

		//	//if (logAtEnd)
		//	//    Log.Instance.LogDebug(DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt") + "END LoadDataFromExamine::NodeBase typealias:" + _nodeTypeAlias);
		//	return true;
		//}

		internal virtual void LoadFieldsFromExamine(IPropertyProvider fields)
		{
			string stringValue = null;
			if (_nodeId == 0 && fields.UpdateValueIfPropertyPresent("id", ref stringValue))
			{
				int.TryParse(stringValue, out _nodeId);
			}

			if (fields.UpdateValueIfPropertyPresent("parentID", ref stringValue))
			{
				int intVal;
				if (int.TryParse(stringValue, out intVal))
					_parentId = intVal;
			}

			if (fields.ContainsKey("sortOrder"))
			{
				string value = fields.GetStringValue("sortOrder");
				int sortOrder;
				if (Int32.TryParse(value, out sortOrder))
					_sortOrder = sortOrder;
			}
			//if (_nodeId == 0)
			//	_nodeId = GetIntValue("id", examineNode).GetValueOrDefault(); can't use multistore here!!!! -> vanwege Store (will cause endless loop)
			//_parentId = GetIntValue("parentID", examineNode);  can't use multistore here!!!! -> vanwege Store
			//_sortOrder = GetIntValue("sortOrder", examineNode); can't use multistore here!!!! -> vanwege Store

			if (fields.ContainsKey("nodeTypeAlias"))
			{
				_nodeTypeAlias = fields.GetStringValue("nodeTypeAlias");
			}
			if (fields.ContainsKey("nodeName"))
			{
				_nodeName = fields.GetStringValue("nodeName");
				if (_nodeName == string.Empty) throw new Exception("Node with empty name");
			}
			if (fields.ContainsKey("path"))
			{
				_path = fields.GetStringValue("path");
			}
			if (fields.ContainsKey("createDate"))
			{
				string value = fields.GetStringValue("createDate");
				DateTime date;
				if (DateTime.TryParse(value, out date)) // todo: use the right culture!
					_createDate = date;
			}
			if (fields.ContainsKey("updateDate"))
			{
				string value = fields.GetStringValue("updateDate");
				DateTime date;
				if (DateTime.TryParse(value, out date)) // todo: use the right culture!
					_updateDate = date;
			}
			if (fields.ContainsKey("urlName"))
			{
				_urlName = fields.GetStringValue("urlName");
			}
		}
コード例 #10
0
        ///// <summary>
        ///// Loads the data from examine.
        ///// </summary>
        ///// <param name="storeAlias">The store alias.</param>
        ///// <param name="examineNode">The examine node.</param>
        ///// <returns></returns>
        //protected virtual bool LoadDataFromExamine(string storeAlias, SearchResult examineNode = null)
        //{
        //	//Log.Instance.LogDebug( DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt") + "LoadDataFromExamine::NodeBase start");
        //	bool logAtEnd = false;
        //	if (examineNode == null)
        //	{
        //		logAtEnd = true;
        //		examineNode = StoreHelper.GetNodeFromExamine(_nodeId);
        //	}
        //	if (examineNode == null)
        //	{
        //		return false;
        //	}

        //	LoadFieldsFromExamine(new DictionaryPropertyProvider(examineNode));

        //	//if (logAtEnd)
        //	//    Log.Instance.LogDebug(DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt") + "END LoadDataFromExamine::NodeBase typealias:" + _nodeTypeAlias);
        //	return true;
        //}

        internal virtual void LoadFieldsFromExamine(IPropertyProvider fields)
        {
            string stringValue = null;

            if (_nodeId == 0 && fields.UpdateValueIfPropertyPresent("id", ref stringValue))
            {
                int.TryParse(stringValue, out _nodeId);
            }

            if (fields.UpdateValueIfPropertyPresent("parentID", ref stringValue))
            {
                int intVal;
                if (int.TryParse(stringValue, out intVal))
                {
                    _parentId = intVal;
                }
            }

            if (fields.ContainsKey("sortOrder"))
            {
                string value = fields.GetStringValue("sortOrder");
                int    sortOrder;
                if (Int32.TryParse(value, out sortOrder))
                {
                    _sortOrder = sortOrder;
                }
            }
            //if (_nodeId == 0)
            //	_nodeId = GetIntValue("id", examineNode).GetValueOrDefault(); can't use multistore here!!!! -> vanwege Store (will cause endless loop)
            //_parentId = GetIntValue("parentID", examineNode);  can't use multistore here!!!! -> vanwege Store
            //_sortOrder = GetIntValue("sortOrder", examineNode); can't use multistore here!!!! -> vanwege Store

            if (fields.ContainsKey("nodeTypeAlias"))
            {
                _nodeTypeAlias = fields.GetStringValue("nodeTypeAlias");
            }
            if (fields.ContainsKey("nodeName"))
            {
                _nodeName = fields.GetStringValue("nodeName");
                if (_nodeName == string.Empty)
                {
                    throw new Exception("Node with empty name");
                }
            }
            if (fields.ContainsKey("path"))
            {
                _path = fields.GetStringValue("path");
            }
            if (fields.ContainsKey("createDate"))
            {
                string   value = fields.GetStringValue("createDate");
                DateTime date;
                if (DateTime.TryParse(value, out date))                 // todo: use the right culture!
                {
                    _createDate = date;
                }
            }
            if (fields.ContainsKey("updateDate"))
            {
                string   value = fields.GetStringValue("updateDate");
                DateTime date;
                if (DateTime.TryParse(value, out date))                 // todo: use the right culture!
                {
                    _updateDate = date;
                }
            }
            if (fields.ContainsKey("urlName"))
            {
                _urlName = fields.GetStringValue("urlName");
            }
        }
コード例 #11
0
            public override void LoadDataFromPropertiesDictionary(Store store, IPropertyProvider fields, ILocalization localization)
            {
                // note: it's impossible to use StoreHelper.GetMultiStoreItemExamine here (or any multi store)

                if (fields.ContainsKey("incompleteOrderLifetime"))
                {
                    double incompleteOrderLifetime;
                    if (double.TryParse(fields.GetStringValue("incompleteOrderLifetime"), out incompleteOrderLifetime))
                    {
                        store.IncompleOrderLifetime = incompleteOrderLifetime;
                    }
                }
                if (fields.ContainsKey("globalVat"))
                {
                    var vatProperty = fields.GetStringValue("globalVat");
                    if (!string.IsNullOrEmpty(vatProperty))
                    {
                        if (vatProperty.ToLowerInvariant() != "default")
                        {
                            vatProperty = vatProperty.Replace(',', '.');

                            var vat = Convert.ToDecimal(vatProperty, CultureInfo.InvariantCulture);

                            store.GlobalVat = vat;
                        }
                        else
                        {
                            store.GlobalVat = 0;
                        }
                    }
                }
                if (fields.ContainsKey("storeCulture"))
                {
                    var culture    = fields.GetStringValue("storeCulture");
                    int languageId = 0;

                    if (culture != null)
                    {
                        int.TryParse(culture, out languageId);
                    }

                    if (languageId != 0)
                    {
                        var matchedLanguage = Language.GetAllAsList().FirstOrDefault(x => x.id == languageId);
                        if (matchedLanguage != null)
                        {
                            store.Culture = new Language(languageId).CultureAlias;
                        }
                        else
                        {
                            var firstOrDefault = Language.GetAllAsList().FirstOrDefault();
                            if (firstOrDefault != null)
                            {
                                store.Culture = firstOrDefault.CultureAlias;
                            }
                            else
                            {
                                store.Culture = string.Empty;
                            }
                        }
                    }
                    else
                    {
                        store.Culture = string.Empty;
                    }
                }
                if (fields.ContainsKey("countryCode"))
                {
                    store.CountryCode = fields.GetStringValue("countryCode");
                }
                if (fields.ContainsKey("defaultCountryCode"))
                {
                    store.DefaultCountryCode = fields.GetStringValue("defaultCountryCode");
                }
                if (fields.ContainsKey("currencyCulture"))
                {
                    // this is for backwards compatiblity
                    var culture    = fields.GetStringValue("currencyCulture");
                    var languageId = 0;

                    if (culture != null)
                    {
                        int.TryParse(culture, out languageId);
                    }

                    store.CurrencyCulture = languageId != 0 ? new Language(languageId).CultureAlias : string.Empty;
                }
                RegionInfo currencyRegion;

                if (fields.ContainsKey("currencyCulture"))
                {
                    var currencyCulture = new CultureInfo(store.CurrencyCulture);
                    currencyRegion = new RegionInfo(currencyCulture.LCID);
                }
                else
                {
                    currencyRegion = new RegionInfo(store.CultureInfo.LCID);
                }
                var cultureCurrency = currencyRegion.ISOCurrencySymbol;

                if (fields.ContainsKey("currencies"))
                {
                    // "EUR|1.1#USD|0.7#JPY|1"
                    var currenciesfromfield = fields.GetStringValue("currencies").Split('#').Select(x => new Currency(x)).ToList();

                    if (!currenciesfromfield.Any(c => c.ISOCurrencySymbol == cultureCurrency))
                    {
                        currenciesfromfield.Add(new Currency {
                            ISOCurrencySymbol = cultureCurrency, Ratio = 1, CurrencySymbol = currencyRegion.CurrencySymbol
                        });
                    }

                    store.Currencies    = currenciesfromfield;
                    store.CurrencyCodes = store.Currencies.Select(c => c.ISOCurrencySymbol).ToList();
                }
                else
                {
                    store.Currencies = new[] { new Currency {
                                                   ISOCurrencySymbol = cultureCurrency, Ratio = 1, CurrencySymbol = currencyRegion.CurrencySymbol
                                               } };
                    store.CurrencyCodes = new[] { cultureCurrency };
                }
                if (fields.ContainsKey("orderNumberPrefix"))
                {
                    store.OrderNumberPrefix = fields.GetStringValue("orderNumberPrefix");
                }
                if (fields.ContainsKey("orderNumberTemplate"))
                {
                    store.OrderNumberTemplate = fields.GetStringValue("orderNumberTemplate");
                }
                if (fields.ContainsKey("orderNumberStartNumber"))
                {
                    int orderNumberStartNumber;
                    if (int.TryParse(fields.GetStringValue("orderNumberStartNumber"), out orderNumberStartNumber))
                    {
                        store.OrderNumberStartNumber = orderNumberStartNumber;
                    }
                }
                if (fields.ContainsKey("enableStock"))
                {
                    var enableStockValue = fields.GetStringValue("enableStock");
                    store.UseStock = enableStockValue == "enable" || enableStockValue == "1" || enableStockValue == "true";
                }
                if (fields.ContainsKey("defaultUseVariantStock"))
                {
                    var enableStockValue = fields.GetStringValue("defaultUseVariantStock");
                    store.UseVariantStock = enableStockValue == "enable" || enableStockValue == "1" || enableStockValue == "true";
                }

                if (fields.ContainsKey("defaultCountdownEnabled"))
                {
                    var enableCountdownValue = fields.GetStringValue("defaultCountdownEnabled");
                    store.UseCountdown = enableCountdownValue == "enable" || enableCountdownValue == "1" || enableCountdownValue == "true";
                }

                if (fields.ContainsKey("storeStock"))
                {
                    var storeStockValue = fields.GetStringValue("storeStock");
                    var value           = storeStockValue == "enable" || storeStockValue == "1" || storeStockValue == "true";
                    if (value)
                    {
                        var productDt = DocumentType.GetByAlias(Product.NodeAlias);
                        if (!productDt.PropertyTypes.Any(x => x.Alias.ToLower() == "stock_" + store.Alias.ToLower()))
                        {
                            value = false;
                        }
                    }
                    store.UseStoreSpecificStock = value;
                }

                if (fields.ContainsKey("useBackorders"))
                {
                    string useBackorders = fields.GetStringValue("useBackorders");

                    store.UseBackorders = useBackorders == "enable" || useBackorders == "1" || useBackorders == "true";
                }

                if (fields.ContainsKey("enableTestmode"))
                {
                    string enableTestmode = fields.GetStringValue("enableTestmode");

                    store.EnableTestmode = enableTestmode == "enable" || enableTestmode == "1" || enableTestmode == "true";
                }

                store.EmailAddressFrom                 = FieldsValueOrEmpty("storeEmailFrom", fields);
                store.EmailAddressFromName             = FieldsValueOrEmpty("storeEmailFromName", fields);
                store.EmailAddressTo                   = FieldsValueOrEmpty("storeEmailTo", fields);
                store.AccountCreatedEmail              = FieldsValueOrEmpty("accountEmailCreated", fields);
                store.AccountForgotPasswordEmail       = FieldsValueOrEmpty("accountForgotPassword", fields);
                store.ConfirmationEmailStore           = FieldsValueOrEmpty("confirmationEmailStore", fields);
                store.ConfirmationEmailCustomer        = FieldsValueOrEmpty("confirmationEmailCustomer", fields);
                store.OnlinePaymentEmailStore          = FieldsValueOrEmpty("onlinePaymentEmailStore", fields);
                store.OnlinePaymentEmailCustomer       = FieldsValueOrEmpty("onlinePaymentEmailCustomer", fields);
                store.OfflinePaymentEmailStore         = FieldsValueOrEmpty("offlinePaymentEmailStore", fields);
                store.OfflinePaymentEmailCustomer      = FieldsValueOrEmpty("offlinePaymentEmailCustomer", fields);
                store.PaymentFailedEmailStore          = FieldsValueOrEmpty("paymentFailedEmailStore", fields);
                store.PaymentFailedEmailCustomer       = FieldsValueOrEmpty("paymentFailedEmailCustomer", fields);
                store.DispatchedEmailStore             = FieldsValueOrEmpty("dispatchedEmailStore", fields);
                store.DispatchEmailCustomer            = FieldsValueOrEmpty("dispatchedEmailCustomer", fields);
                store.CancelEmailStore                 = FieldsValueOrEmpty("cancelEmailStore", fields);
                store.CancelEmailCustomer              = FieldsValueOrEmpty("cancelEmailCustomer", fields);
                store.ClosedEmailStore                 = FieldsValueOrEmpty("closedEmailStore", fields);
                store.ClosedEmailCustomer              = FieldsValueOrEmpty("closedEmailCustomer", fields);
                store.PendingEmailStore                = FieldsValueOrEmpty("pendingEmailStore", fields);
                store.PendingEmailCustomer             = FieldsValueOrEmpty("pendingEmailCustomer", fields);
                store.TemporaryOutOfStockEmailStore    = FieldsValueOrEmpty("temporaryOutOfStockEmailStore", fields);
                store.TemporaryOutOfStockEmailCustomer = FieldsValueOrEmpty("temporaryOutOfStockEmailCustomer", fields);
                store.UndeliverableEmailStore          = FieldsValueOrEmpty("undeliverableEmailStore", fields);
                store.UndeliverableEmailCustomer       = FieldsValueOrEmpty("undeliverableEmailCustomer", fields);
                store.ReturnedEmailStore               = FieldsValueOrEmpty("returnEmailStore", fields);
                store.ReturnedEmailCustomer            = FieldsValueOrEmpty("returnEmailCustomer", fields);
            }