public ActionResult Index(MyProduct currentContent, string variationCode = "")
        {
            ProductService ps         = new ProductService();
            var            variations = ps.GetVariations(currentContent);

            MyVariantion variation;

            if (!TryGetFashionVariant(variations, variationCode, out variation))
            {
                return(HttpNotFound());
            }
            var _currentMarket = ServiceLocator.Current.GetInstance <ICurrentMarket>();

            var market       = _currentMarket.GetCurrentMarket();
            var curency      = market.Currencies.Where(x => x.CurrencyCode == market.DefaultCurrency).Cast <Currency>().FirstOrDefault();
            var defaultPrice = GetDefaultPrice(variation, market, curency);

            MyProductVM model = new MyProductVM();

            model.Product     = currentContent;
            model.VariantName = variation.Name;
            model.Price       = defaultPrice.UnitPrice;
            model.VariantCode = variationCode;
            model.Image       = AssetHelper.GetAssetUrl(variation.CommerceMediaCollection);

            var _cartService = new CartService();

            model.CartItemNumber = _cartService.GetLineItemsTotalQuantity();

            var _contentLoader = ServiceLocator.Current.GetInstance <IContentLoader>();

            model.CheckoutPage = _contentLoader.Get <StartPage>(ContentReference.StartPage).CheckoutPage;

            return(View(model));
        }
Beispiel #2
0
        protected void entriesList_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            var image1 = ((System.Web.UI.WebControls.Image)e.Item.FindControl("Image1"));

            using (var listViewDataItem = (ListViewDataItem)e.Item)
            {
                if (listViewDataItem == null)
                {
                    return;
                }

                var content = (EntryContentBase)listViewDataItem.DataItem;
                image1.ImageUrl = AssetHelper.GetAssetUrl(content.CommerceMediaCollection);

                if (content == null)
                {
                    return;
                }

                var variationContent = GetVariationContent(content);
                if (variationContent != null)
                {
                    // we need to use Variations responsegroup to get prices
                    var entry = variationContent.LoadEntry(CatalogEntryResponseGroup.ResponseGroup.Variations);

                    AssignEntryToCommonButtons(entry, listViewDataItem);
                    SetInStockLiteralText(variationContent, listViewDataItem);

                    AssignEntryToPriceInfo(entry, listViewDataItem);
                    GetPromotions(e, entry);
                }
            }
        }
Beispiel #3
0
        public override ActionResult Index(ProductContent currentContent)
        {
            var model = new MyProductVM()
            {
                Name  = currentContent.Name,
                Image = AssetHelper.GetAssetUrl(currentContent.CommerceMediaCollection)
            };
            ProductService ps             = new ProductService();
            var            variantProduct = ps.GetProductViewModel(currentContent);

            model.Link = variantProduct.Link;
            return(PartialView("_Product", model));
        }
Beispiel #4
0
 private string GetImageUrl()
 {
     if (FilterAction != null)
     {
         Entry entrySKU = Entry.Entries.Entry.FirstOrDefault(FilterAction);
         if (entrySKU != null)
         {
             return(AssetHelper.GetAssetUrl(entrySKU));
         }
         return(string.Empty);
     }
     return(AssetHelper.GetAssetUrl(Entry));
 }
Beispiel #5
0
 /// <summary>
 /// Gets the item image.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns></returns>
 protected string GetItemImage(LineItem item)
 {
     return(AssetHelper.GetAssetUrl(item.GetCommerceMediaCollection()) ?? string.Empty);
 }