Esempio n. 1
0
 public ProductOverviewModel()
 {
     ProductPrice = new ProductPriceModel();
     DefaultPictureModel = new PictureModel();
     SpecificationAttributeModels = new List<ProductSpecificationModel>();
     ReviewOverviewModel = new ProductReviewOverviewModel();
 }
Esempio n. 2
0
 public ProductOverviewModel()
 {
     ProductPrice              = new ProductPriceModel();
     DefaultPictureModel       = new PictureModel();
     ProductSpecificationModel = new ProductSpecificationModel();
     ReviewOverviewModel       = new ProductReviewOverviewModel();
 }
 public ProductOverviewModel()
 {
     ProductPrice                 = new ProductPriceModel();
     DefaultPictureModel          = new PictureModel();
     SpecificationAttributeModels = new List <ProductSpecificationModel>();
     ReviewOverviewModel          = new ProductReviewOverviewModel();
 }
 public ProductDetailsModel()
 {
     DefaultPictureModel   = new PictureModel();
     PictureModels         = new List <PictureModel>();
     AssociatedProducts    = new List <ProductDetailsModel>();
     Breadcrumb            = new ProductBreadcrumbModel();
     ProductTags           = new List <ProductTagModel>();
     ProductReviewOverview = new ProductReviewOverviewModel();
 }
Esempio n. 5
0
 public ProductDetailsModel()
 {
     GiftCard              = new GiftCardModel();
     ProductPrice          = new ProductPriceModel();
     AddToCart             = new AddToCartModel();
     ProductAttributes     = new List <ProductAttributeModel>();
     AssociatedProducts    = new List <ProductDetailsModel>();
     VendorModel           = new VendorBriefInfoModel();
     Breadcrumb            = new ProductBreadcrumbModel();
     ProductTags           = new List <ProductTagModel>();
     ProductSpecifications = new List <ProductSpecificationModel>();
     ProductManufacturers  = new List <ManufacturerBriefInfoModel>();
     ProductReviewOverview = new ProductReviewOverviewModel();
     TierPrices            = new List <TierPriceModel>();
 }
 public ProductDetailsModel()
 {
     DefaultPictureModel = new PictureModel();
     PictureModels = new List<PictureModel>();
     GiftCard = new GiftCardModel();
     ProductPrice = new ProductPriceModel();
     AddToCart = new AddToCartModel();
     ProductAttributes = new List<ProductAttributeModel>();
     AssociatedProducts = new List<ProductDetailsModel>();
     VendorModel = new VendorBriefInfoModel();
     Breadcrumb = new ProductBreadcrumbModel();
     ProductTags = new List<ProductTagModel>();
     ProductSpecifications= new List<ProductSpecificationModel>();
     ProductManufacturers = new List<ManufacturerModel>();
     ProductReviewOverview = new ProductReviewOverviewModel();
     TierPrices = new List<TierPriceModel>();
 }
Esempio n. 7
0
        public ActionResult ProductReviewOverview(int productId)
        {
            var product = _productService.GetProductById(productId);
            if (product == null)
                throw new ArgumentException("No product found with the specified id");

            var model = new ProductReviewOverviewModel()
            {
                ProductId = product.Id,
                RatingSum = product.ApprovedRatingSum,
                TotalReviews = product.ApprovedTotalReviews,
                AllowCustomerReviews = product.AllowCustomerReviews
            };
            return PartialView(model);
        }
Esempio n. 8
0
        protected ProductReviewOverviewModel PrepareProductReviewOverviewModel(Product product)
        {
            if (product == null)
                throw new ArgumentNullException("product");

            var model = new ProductReviewOverviewModel()
            {
                ProductId = product.Id,
                RatingSum = product.ApprovedRatingSum,
                TotalReviews = product.ApprovedTotalReviews,
                AllowCustomerReviews = product.AllowCustomerReviews
            };
            return model;
        }
Esempio n. 9
0
        public static ProductReviewOverviewModel PrepareProductReviewOverviewModel(this Controller controller,
            IStoreContext storeContext,
            CatalogSettings catalogSettings,
            ICacheManager cacheManager,
            Product product)
        {
            ProductReviewOverviewModel productReview;

            if (catalogSettings.ShowProductReviewsPerStore)
            {
                string cacheKey = string.Format(ModelCacheEventConsumer.PRODUCT_REVIEWS_MODEL_KEY, product.Id, storeContext.CurrentStore.Id);

                productReview = cacheManager.Get(cacheKey, () =>
                {
                    return new ProductReviewOverviewModel
                    {
                        RatingSum = product.ProductReviews
                                .Where(pr => pr.IsApproved && pr.StoreId == storeContext.CurrentStore.Id)
                                .Sum(pr => pr.Rating),
                        TotalReviews = product
                                .ProductReviews
                                .Count(pr => pr.IsApproved && pr.StoreId == storeContext.CurrentStore.Id)
                    };
                });
            }
            else
            {
                productReview = new ProductReviewOverviewModel()
                {
                    RatingSum = product.ApprovedRatingSum,
                    TotalReviews = product.ApprovedTotalReviews
                };
            }
            if (productReview != null)
            {
                productReview.ProductId = product.Id;
                productReview.AllowCustomerReviews = product.AllowCustomerReviews;
            }
            return productReview;
        }
 public ProductOverviewModel()
 {
     DefaultPictureModel = new PictureModel();
     ReviewOverviewModel = new ProductReviewOverviewModel();
 }