protected ProductCollection GetProducts() { ViewedItemsCollection collection = ViewedItemManager.GetCurrentViewedItem(pageSize, CurrentPageIndex, out totalItemCount); List <int> productsIDs = collection.Select(x => x.ProductVariantID).ToList(); ProductCollection productCollection = new ProductCollection(); foreach (var productID in productsIDs) { ProductVariant product = ProductManager.GetProductVariantByID(productID); productCollection.Add(product.Product); } return(productCollection); }
private ProductCollection GetProducts() { int totalItems = 0; ProductCollection productCollection = new ProductCollection(); try { ViewedItemsCollection collection = ViewedItemManager.GetCurrentViewedItem(10, 0, out totalItems); List <int> productsIDs = collection.Select(x => x.ProductVariantID).ToList(); foreach (var productID in productsIDs) { ProductVariant product = ProductManager.GetProductVariantByID(productID); productCollection.Add(product.Product); } } catch { } return(productCollection); }