Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

how do i make a review display out of the infobox??


Kristofor

Recommended Posts

Posted

hey everyone,

 

this is what i would like to do,

i want to display in my featured products infobox, i want to have a random review for that product display itself, but only a tiny bit of it as in the review box, then underneath i would like to the number of stars that person gave, and that persons review needs to be clickable, then under both of those have the text all reviews and then have all the reviews for that product display,

 

im not sure how to do this so can someone help me??

 

thanks

 

kristfoor

Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Posted

try this:

 

<?php

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

   $reviews_values = tep_db_fetch_array($reviews);

?>

     <tr>

       <td class="main" valign="top"><b>Reviews:</b></td>

 <td class="main">

 <?php

 

 if ($reviews_values['count'] > 0)

	 {

	 echo '<a class="main" href="';

	 echo tep_href_link(FILENAME_PRODUCT_REVIEWS, substr(tep_get_all_get_params(), 0, -1)) .'">';

	 echo 'Reviews:' . ' ' . $reviews_values['count'];

	 echo '</a> | ';



	 echo '<a class="main" href="';

	 echo tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, substr(tep_get_all_get_params(), 0, -1)) . '">';

	 echo  'Write a review';

	 echo '</a>';



	 $random_product = tep_random_select("select r.reviews_id, substring(rd.reviews_text, 1, 150) as reviews_text, r.reviews_rating, p.products_id, r.date_added, r.customers_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and r.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and rd.languages_id = '" . $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and r.approved = 1 order by r.reviews_id DESC limit " . MAX_RANDOM_SELECT_REVIEWS);

   if ($random_product) {

   // display random review box

   echo '<br><br>Rated:' . tep_image(DIR_WS_IMAGES . 'stars_' . $random_product['reviews_rating'] . '.gif' , sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating']));

    	 echo 'by ' . $random_product['customers_name'];

   $review = htmlspecialchars($random_product['reviews_text']);

   echo '<br><i><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id'], 'NONSSL') . '">' . $review . '....</a></i>';

   }

	 }

 

 ?>

	 </td>

     </tr>

 

then you can use the same select to print out the rest of the reviews on the product

Posted

ummm.. im not sure if that works, because i all that i see is Reviews:

so i thought maybe it needed a review, so i went and added a review, but it still would not show any reviews there, what it should do is if there is no reviews, it should say, There are no reviews on this product, write a review or something,

but at th emoment it wont show any reviews

what should i do?

Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...