Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution Update] Review Approval System


jonah

Recommended Posts

Just wondererd if any one else got errors like I am getting seems any reveiws I approve I am using a early 2003 release of osscommerce

 

http://www.consolesandgadgets.co.uk

 

When i approve a Review it seems to show the reivew 5 or so times on page yet it seems ok in the database

 

Any Ideas?

 

Also any suggestons on what contribution to use in order to arrange default.php i,e, move boxes etc, just taht there is so many to choose from ?

 

Regards

 

Charly

Charly

 

My fav site

 

Spend most my cash there dont tell the wife:-)

Link to comment
Share on other sites

BTW, here's a small modification I made to the catalog/product_info.php page to show only the number of "approved" reviews. Otherwise, it may be a bit confusing if they see there is a review, but can't read it and don't know the reason is that it hasn't been approved yet.

 

About line 165, find the following code:

 

$reviews_query = tep_db_query("select count(*) as count from " .  TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

 

Replace with

 

    $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and approved = '1'");

 

That simple!

 

Cheers, Rob

 

P.S. Another thing I intend to add is a note to the reviewer that their review won't be displayed until after it has been vetted. Unless someone beats me to it!

Link to comment
Share on other sites

  • 4 months later...
BTW, here's a small modification I made to the catalog/product_info.php page to show only the number of "approved" reviews. Otherwise, it may be a bit confusing if they see there is a review, but can't read it and don't know the reason is that it hasn't been approved yet.

 

About line 165, find the following code:

 

$reviews_query = tep_db_query("select count(*) as count from " . ?TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

 

Replace with

 

 ? ?$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and approved = '1'");

 

That simple!

 

Cheers, Rob

 

P.S. Another thing I intend to add is a note to the reviewer that their review won't be displayed until after it has been vetted. Unless someone beats me to it!

Thanks for the info, it works great.

 

P.S. Another thing I intend to add is a note to the reviewer that their review won't be displayed until after it has been vetted. Unless someone beats me to it!

 

I was also wondering about this.

Link to comment
Share on other sites

  • 3 weeks later...

Is there way to give the user a notification message, after they have submitted their review saying that their review is pending approval. I noticed with this contribution after the user submits his info it just goes back to the product_reviews_writes page

Link to comment
Share on other sites

http://www.oscommerce.com/community/contributions,1904 I believe this is the reviews notification.

 

Theres 2 downsides right now, that hopefully someone could improve on. So far this contribution gives you an email which is great. But to be more productive what would be great is if the email had the actual review a client wrote along with 2 links 1 for approve and 1 for disapprove, that would surely make this more streamlined and less work, by not having to go into the admin to approve or disapprove. Also one thing missing in the overall reviews approval system is that users who write reviews aren't given a notice that their review is pending approval after they write the review. All that popsup is a blank page as if they never wrote the review.

Link to comment
Share on other sites

HI there,

 

thanks for the link. And yes you are absolutely right it would be great to have those 2 functions you mentioned.

 

let me know if you do find this solution, like wise i will do the same..

 

thanks once again.

Link to comment
Share on other sites

  • 4 weeks later...
Hey,

 

Anyone got a manual installation documentation of this?

 

Not that fond of just copying files over.

 

/erik

I would prefer that also but in this case, it's unlikely you've ever modded those files before. Only thing is, are the files from MS2? Don't recall seeing a notation but I could have missed it.

Link to comment
Share on other sites

Unfortunately I have modded them. Using tempaltes and stuff...:/

 

EDIT: the files I downloaded didnt have notation, should be the latest.

Edited by Erik_DO
Link to comment
Share on other sites

Unfortunately I have modded them. Using tempaltes and stuff...:/

 

EDIT: the files I downloaded didnt have notation, should be the latest.

Noticed in the heading, MS2 ... works fine. :)

 

Now we could say the same to you ... you should have commented your changes. lol j/k Erik.

 

My best suggestion is this:

 

(1) Backup any file you'll be working with

 

(2) Overwrite the files you haven't changed first. If the file date matches the date you first created the store, probably unlikely you changed it, no?

 

(3) Move on to files you have changed. Grab the 30-day free trial of Beyond Compare from here It's a little time-consuming, but it works great.

 

I am now using the main contribution along with the "New Review Notification Email" and with my own personally coded redirect and message for the reviewer and it all works i 100% harmony on the latest osC.

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 months later...

MANUAL INSTALLATION

 

Unzip the file, copy the following files:

 

1) admin/includes/languages/images/buttons/review_approve.gif

2) admin/includes/languages/images/buttons/review_disapprove.gif

 

Make these two buttons for other languages if necessary.

 

Make changes to the following files

 

######################

 

1. admin/reviews.php

 

1.1

---find code---

 

      case 'deleteconfirm':
       $reviews_id = tep_db_prepare_input($HTTP_GET_VARS['rID']);

       tep_db_query("delete from " . TABLE_REVIEWS . " where reviews_id = '" . (int)$reviews_id . "'");
       tep_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int)$reviews_id . "'");

       tep_redirect(tep_href_link(FILENAME_REVIEWS, 'page=' . $HTTP_GET_VARS['page']));
       break;

 

===add after===

 

      case 'approve_review':
       $reviews_id = tep_db_prepare_input($HTTP_GET_VARS['rID']);
       tep_db_query("update " . TABLE_REVIEWS . " set approved=1 where reviews_id = " . $reviews_id);
       tep_redirect(tep_href_link(FILENAME_REVIEWS, 'page=' . $HTTP_GET_VARS['page'] . '&rID=' . $reviews_id));
       break;
     case 'disapprove_review':
       $reviews_id = tep_db_prepare_input($HTTP_GET_VARS['rID']);
       tep_db_query("update " . TABLE_REVIEWS . " set approved=0 where reviews_id = " . $reviews_id);
       tep_redirect(tep_href_link(FILENAME_REVIEWS, 'page=' . $HTTP_GET_VARS['page'] . '&rID=' . $reviews_id));
       break;

 

1.2

---find code---

 

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_DATE_ADDED; ?></td>

 

===add after===

 

                <td class="dataTableHeadingContent" align="center"><?php echo TEXT_APPROVED; ?></td>

 

1.3

---find code---

 

$reviews_query_raw = "select reviews_id, products_id, date_added, last_modified, reviews_rating from " . TABLE_REVIEWS . " order by date_added DESC";

 

===REPLACE with===

 

$reviews_query_raw = "select reviews_id, products_id, date_added, last_modified, reviews_rating, approved from " . TABLE_REVIEWS . " order by date_added DESC";

 

1.4

---find code---

 

<td class="dataTableContent" align="right"><?php echo tep_date_short($reviews['date_added']); ?></td>

 

===add after===

 

                <td class="dataTableContent" align="center"><?php echo $reviews['approved']==1?tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10):tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10); ?></td>

 

1.5

---find code---

 

$contents[] = array('text' => '<br>' . TEXT_INFO_PRODUCTS_AVERAGE_RATING . ' ' . number_format($rInfo->average_rating, 2) . '%');

 

===add after===

 

        if($rInfo->approved==0){
         $contents[] = array('align' => 'left', 'text' => '<br> ' . TEXT_APPROVED . ': ' . TEXT_NO );        
         $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_REVIEWS, tep_get_all_get_params(array('action', 'info')) . 'action=approve_review&rID=' . $rInfo->reviews_id, 'NONSSL') . '">' . tep_image_button('review_approve.gif', TEXT_APPROVE) . '</a>');
         }
       elseif($rInfo->approved==1) {
         $contents[] = array('align' => 'left', 'text' => '<br> ' . TEXT_APPROVED . ': ' . TEXT_YES );        
         $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_REVIEWS, tep_get_all_get_params(array('action', 'info')) . 'action=disapprove_review&rID=' . $rInfo->reviews_id, 'NONSSL') . '">' . tep_image_button('review_disapprove.gif', TEXT_DISAPPROVE) . '</a>');
         }
       else{  
         $contents[] = array('align' => 'left', 'text' => '<br> ' . TEXT_APPROVED . ': ' . "Unknown" );        
         }

     }
       break;

 

######################

 

2. admin/includes/languages/english/reviews.php (other languages likewise)

 

===add before the ending ?>===

 

/* <Mav was here!> */ 
define('TEXT_APPROVED', 'Approved');
define('TEXT_APPROVE', 'Approve');
define('TEXT_DISAPPROVE', 'Disapprove');
define('TEXT_YES', 'Yes');
define('TEXT_NO', 'No');
/* </Mav was here!> */

 

######################

 

3. catalog/reviews.php

 

---find code---

 

  $reviews_query_raw = "select r.reviews_id, left(rd.reviews_text, 100) as reviews_text, r.reviews_rating, r.date_added, p.products_id, pd.products_name, p.products_image, r.customers_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and rd.languages_id = '" . (int)$languages_id . "' order by r.reviews_id DESC";

 

===REPLACE with===

 

  $reviews_query_raw = "select r.reviews_id, left(rd.reviews_text, 100) as reviews_text, r.reviews_rating, r.date_added, p.products_id, pd.products_name, p.products_image, r.customers_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and rd.languages_id = '" . (int)$languages_id . "' and r.approved = '1' order by r.reviews_id DESC";

 

######################

 

4. catalog/product_reviews.php

 

---find code---

 

  $reviews_query_raw = "select r.reviews_id, left(rd.reviews_text, 100) as reviews_text, r.reviews_rating, r.date_added, r.customers_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$product_info['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' order by r.reviews_id desc";

 

===REPLACE with===

 

  $reviews_query_raw = "select r.reviews_id, left(rd.reviews_text, 100) as reviews_text, r.reviews_rating, r.date_added, r.customers_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$product_info['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and r.approved = '1' order by r.reviews_id desc";

 

######################

 

5. catalog/includes/boxes/reviews.php

 

---find code---

 

  $random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'";

 

===REPLACE with===

 

  $random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and r.approved = '1'";

 

######################

 

6. catalog/product_info.php

 

---find code---

 

$reviews_query = tep_db_query("select count(*) as count from " .  TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

 

===REPLACE with===

 

$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and approved = '1'");

 

######################

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...