Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cieto Featured Products - help


Davee

Recommended Posts

Hi

 

I'm using this contribution but I wanted to add an average review on each item

 

I've used this code for the query

 

$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
   $reviews = tep_db_fetch_array($reviews_query);
$reviews_query_average = tep_db_query("select (avg(reviews_rating)) as average_rating from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
   $reviews_average = tep_db_fetch_array($reviews_query_average);
$reveiws_stars = $reviews_average['average_rating'];
$reveiws_rating = number_format($reveiws_stars,0);
   if ($reviews['count'] > 0) {



<tr>
       <td class="main"><?php echo TEXT_REVIEW_AVERAGE . ' ' . '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image(DIR_WS_IMAGES . 'stars_' . $reveiws_rating . '.gif') .   '' . ''. $reviews['count'] . ' ' . TEXT_CURRENT_REVIEWS .''. '</a>'; ?>
  </td>

 

can't seem to get it to display on featured products?

 

I also wanted to add stock status too but all that I get is Ships in 2-3 Days on every item :(

 

<?php $prod_quantity = tep_get_products_stock($products_id);
     switch ($prod_quantity) { 
     case 0: 
     print '<font color="#ff0000" size="2">Ships in 2-3 Days'; 
     break; 
     case 1: 
     print '<font color="#006600" size="2">Limited Stock'; 
     break; 
	 case 2: 
     print '<font color="#006600" size="2">Limited Stock'; 
     break; 
	 case 3: 
     print '<font color="#006600" size="2">Limited Stock'; 
     break; 
	 case 4: 
     print '<font color="#009900" size="2">In Stock'; 
     break; 
     default: 
     print '<font color="#009900" size="2">In Stock'; 
 }

 

Anyone know where i'm going wrong?

Link to comment
Share on other sites

  • 2 weeks later...

Archived

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

×
×
  • Create New...