private void UpdatePageIndex() { if (ReviewsGrid.Rows.Count > 0) { int startIndex = ((ReviewsGrid.PageIndex * ReviewsGrid.PageSize) + 1); int endIndex = startIndex + ReviewsGrid.Rows.Count - 1; int rowCount = ProductReviewDataSource.SearchCount(_ProductId, BitFieldState.True); ReviewsCaptionPanel.Visible = true; ReviewCount.Text = string.Format(ReviewCount.Text, rowCount, ((rowCount > 1) ? "s" : "")); if (rowCount > ReviewsGrid.PageSize) { ReviewsCaption.Visible = false; PagedReviewsCaption.Visible = true; int toIndex = startIndex + ReviewsGrid.PageSize - 1; if (toIndex > rowCount) { toIndex = rowCount; } PagedReviewsCaption.Text = string.Format(PagedReviewsCaption.Text, startIndex, toIndex, rowCount); } else { ReviewsCaption.Visible = true; PagedReviewsCaption.Visible = false; ReviewsCaption.Text = string.Format(ReviewsCaption.Text, rowCount, ((rowCount > 1) ? "s" : "")); } AverageRatingPanel.Visible = true; ProductRating.Rating = _Product.Rating; decimal rating = 0; if (_Product.Rating.HasValue) { rating = _Product.Rating.Value; } PHRichSnippets.Controls.Add(new LiteralControl(string.Format("<meta itemprop='ratingValue' content='{0}' />", rating))); PHRichSnippets.Controls.Add(new LiteralControl(string.Format("<meta itemprop='reviewCount' content='{0}' />", rowCount))); } else { ReviewsCaptionPanel.Visible = false; AverageRatingPanel.Visible = false; } }
protected void Page_PreRender(object sender, EventArgs e) { NoReviewsPanel.Visible = ProductReviewDataSource.SearchCount(_ProductId, BitFieldState.True) == 0; }
protected void Page_Init(object sender, EventArgs e) { if (_product != null) { Page.Title = string.IsNullOrEmpty(_product.Title) ? _product.Name : _product.Title; ProductName.Text = _product.Name; moreDetails.NavigateUrl = NavigationHelper.GetMobileStoreUrl("~/ProductDescription.aspx?ProductId=" + _product.Id); if (_settings.MobileStoreProductUseSummary) { ProductSummary.Text = _product.Summary; } else { ProductSummary.Text = _product.Description; if (string.IsNullOrEmpty(_product.ExtendedDescription)) { moreDetails.Visible = false; } descriptionHeader.Visible = !string.IsNullOrEmpty(_product.Description); moreDetails.Visible = !string.IsNullOrEmpty(_product.Description); } if (_settings.ProductReviewEnabled != CommerceBuilder.Users.UserAuthFilter.None) { RatingPanel.Visible = true; ProductRating.Rating = _product.Rating; } if (_product.Manufacturer != null && !string.IsNullOrEmpty(_product.Manufacturer.Name)) { phManufacturer.Visible = true; ManufLink.Text = _product.Manufacturer.Name; ManufLink.NavigateUrl = Page.ResolveUrl(NavigationHelper.GetMobileStoreUrl(string.Format("~/Search.aspx?m={0}", _product.Manufacturer.Id))); } // PRODUCT REVIEWS if (_settings.ProductReviewEnabled != UserAuthFilter.None) { int count = ProductReviewDataSource.SearchCount(_product.Id, BitFieldState.True); if (count > 0) { ProductReviewsPanel.Visible = true; ProductRatingStars1.Rating = _product.Rating; TotalReviews.Text = count.ToString(); MoreDetailsLink.NavigateUrl = string.Format("ProductReviews.aspx?ProductId={0}", _product.Id); } else { NoReviewsPanel.Visible = true; averageRating.Visible = false; reviewsTotal.Visible = false; MoreDetailsLink.Text = "Add Reviews"; MoreDetailsLink.NavigateUrl = string.Format("ProductReviews.aspx?ProductId={0}", _product.Id); } } else { ProductReviewsPanel.Visible = false; } //REGISTER THE PAGEVISIT AbleCommerce.Code.PageVisitHelper.RegisterPageVisit(_product.Id, CatalogNodeType.Product, _product.Name); AbleCommerce.Code.PageHelper.BindMetaTags(this, _product); } }