예제 #1
0
 private bool IsRecurringOrderLine(OrderLineReadOnly orderLine)
 {
     return(orderLine.Properties.ContainsKey(Constants.Properties.Product.IsRecurringPropertyAlias) &&
            !string.IsNullOrWhiteSpace(orderLine.Properties[Constants.Properties.Product.IsRecurringPropertyAlias]) &&
            (orderLine.Properties[Constants.Properties.Product.IsRecurringPropertyAlias] == "1" ||
             orderLine.Properties[Constants.Properties.Product.IsRecurringPropertyAlias].Value.Equals("true", StringComparison.OrdinalIgnoreCase)));
 }
예제 #2
0
        private static string GetItemDescriptionByOrderPropertyDescriptionAlias(OrderLineReadOnly lineItem, string alias)
        {
            var defaultItemDescription = $"{lineItem.Name} ({lineItem.Sku})";

            if (string.IsNullOrEmpty(alias))
            {
                return(defaultItemDescription);
            }

            var itemDescription = lineItem.Properties[alias];

            return(!string.IsNullOrWhiteSpace(itemDescription) ? itemDescription : defaultItemDescription);
        }
        public CartItemViewModel(OrderLineReadOnly orderLine, int index)
        {
            Index     = index;
            OrderLine = orderLine;

            var umbracoContextFactory = DependencyResolver.Current.GetService <IUmbracoContextFactory>();

            if (umbracoContextFactory != null)
            {
                using (var cref = umbracoContextFactory.EnsureUmbracoContext())
                {
                    Node = cref.UmbracoContext?.Content?.GetById(orderLine.ProductReference.As <Guid>());
                    Url  = Node.ContentType.Alias == ProductVariant.ModelTypeAlias ? Node.Parent.Url : Node.Url;
                }
            }
        }
 private bool IsRecurringOrderLine(OrderLineReadOnly orderLine)
 {
     return(PropertyIsTrue(orderLine.Properties, Constants.Properties.Product.IsRecurringPropertyAlias));
 }