Code for Alert when there are reviews to approve
Posted: Thu Jan 31, 2008 4:14 pm
I would like to get a alert for when there are reviews to approve.
http://forums.ablecommerce.com/
Code: Select all
if (store.Settings.ProductReviewEnabled != CommerceBuilder.Users.UserAuthFilter.None)
{
ProductReviewCollection unaprovedReviews = ProductReviewDataSource.LoadUnApprovedReviews();
if (unaprovedReviews.Count > 0)
{
string alertText = "You have ({0}) unaproved review{1}.";
string tempValue = (unaprovedReviews.Count > 1) ? "s" : string.Empty;
alertList.Add(string.Format(alertText, unaprovedReviews.Count,tempValue));
}
}
I put this code in correctly - only to get the front page to error.mazhar_plugables wrote:place the above code in Admin/Dashboard/AdminAlerts.ascx file just above the following commentCode: Select all
if (store.Settings.ProductReviewEnabled != CommerceBuilder.Users.UserAuthFilter.None) { ProductReviewCollection unaprovedReviews = ProductReviewDataSource.LoadUnApprovedReviews(); if (unaprovedReviews.Count > 0) { string alertText = "You have ({0}) unaproved review{1}."; string tempValue = (unaprovedReviews.Count > 1) ? "s" : string.Empty; alertList.Add(string.Format(alertText, unaprovedReviews.Count,tempValue)); } }
//UPDATE CACHE
for example the code will be placed at location like
// customized code provided in this post will be here just before the update cache code
//UPDATE CACHE
Code: Select all
// LOOK FOR UNAPPROVED REVIEWS
if (store.Settings.ProductReviewEnabled != CommerceBuilder.Users.UserAuthFilter.None)
{
ProductReviewCollection unaprovedReviews = ProductReviewDataSource.LoadUnApprovedReviews();
if (unaprovedReviews.Count > 0)
{
string alertText = "You have ({0}) <a href='/Admin/Products/Reviews/Default.aspx'>unapproved review{1}</a>.";
string tempValue = (unaprovedReviews.Count > 1) ? "s" : string.Empty;
alertList.Add(string.Format(alertText, unaprovedReviews.Count,tempValue));
}
}
Code: Select all
// LOOK FOR UNAPPROVED REVIEWS
if (AbleContext.Current.Store.Settings.ProductReviewEnabled != CommerceBuilder.Users.UserAuthFilter.None)
{
IList<ProductReview> unaprovedReviews = ProductReviewDataSource.Search(0, BitFieldState.False);
if (unaprovedReviews.Count > 0)
{
string alertText = "You have ({0}) <a href='/Admin/Products/Reviews/Default.aspx'>unapproved review{1}</a>.";
string tempValue = (unaprovedReviews.Count > 1) ? "s" : string.Empty;
alertList.Add(string.Format(alertText, unaprovedReviews.Count, tempValue));
}
}