Code for Alert when there are reviews to approve
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Code for Alert when there are reviews to approve
I would like to get a alert for when there are reviews to approve.
definately
I agree, this really should be there. An email would be great. A notice or alert on the Dashboard might work fine too.
- m_plugables
- Commander (CMDR)
- Posts: 149
- Joined: Tue Mar 11, 2008 12:44 am
- Contact:
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));
}
}
//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
very nice
Sweet! That worked like a charm. Thank you for that.
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
-
- Commodore (COMO)
- Posts: 433
- Joined: Wed May 28, 2008 9:42 am
- Location: Concord, NC
- Contact:
Re:
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
I'm on the final release. This would be a good feature for me. Any code need to change?
-
- Commodore (COMO)
- Posts: 433
- Joined: Wed May 28, 2008 9:42 am
- Location: Concord, NC
- Contact:
Re: Code for Alert when there are reviews to approve
I must have been doing something wrong. I retried this today.
Flawless.
Flawless.
- efficiondave
- Commander (CMDR)
- Posts: 151
- Joined: Tue Dec 02, 2008 10:20 am
- Location: St. Louis Missouri
- Contact:
Re: Code for Alert when there are reviews to approve
Huge help. Thanks! A couple minor tweaks in the code below:
1. Fixed typo "unaproved"
2. Made "Unapproved Review" a link to the Reviews page
3. Added a Comment
I also put the code higher up in the alert list so it's seen more easily. I put it above the "//CHECK FOR LOW INVENTORY PRODUCTS" section but it's easy to move it to wherever you like in the list.
1. Fixed typo "unaproved"
2. Made "Unapproved Review" a link to the Reviews page
3. Added a Comment
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));
}
}
David O'Leary
http://www.EfficionConsulting.com
http://www.EfficionConsulting.com
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Re: Code for Alert when there are reviews to approve
Anyone know how to make this work for GOLD?
Re: Code for Alert when there are reviews to approve
Just two small changes and it should work great on Gold. The updated version of Daveid's code should be like this
We have tried to keep it easy to upgrade AC7 codes to gold and I have posted some tips here viewtopic.php?f=47&t=17108 You can read the common things you may need to update in any AC7 script.
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));
}
}
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Re: Code for Alert when there are reviews to approve
Works great thanks