Example #1
0
        public static bool GetPropertyBooleanValue(this Product product, string propertyName)
        {
            var prop = product.GetProperty(propertyName);

            if (prop == null)
            {
                return(false);
            }
            var propValue = prop.Values.FirstOrDefault();

            return(propValue != null && (Convert.ToString(propValue.Value) == "1" || propValue.Value.Equals(true)));
        }
Example #2
0
        public static string GetPropertyStringLabel(this Product product, string propertyName)
        {
            var prop = product.GetProperty(propertyName);

            if (prop == null)
            {
                return(String.Empty);
            }
            var propValue = prop.Values.FirstOrDefault();

            return(propValue != null && propValue.AttributeVocabularyValueDetail != null?Convert.ToString(propValue.AttributeVocabularyValueDetail.Content.StringValue) : String.Empty);
        }
Example #3
0
        public static string GetPropertyValue(this Product product, string propertyName)
        {
            var prop = product.GetProperty(propertyName);

            if (prop == null)
            {
                return(String.Empty);
            }
            var propValue = prop.Values.FirstOrDefault();

            return(propValue != null?Convert.ToString(propValue.Value) : String.Empty);
        }
Example #4
0
        public static IList <string> GetPropertyListValue(this Product product, string propertyName)
        {
            var prop = product.GetProperty(propertyName);

            if (prop == null)
            {
                return(new List <string>());
            }
            var propValue = prop.Values;
            var vals      = propValue.Select(v => Convert.ToString(v.Value)).ToList();


            return(vals);
        }