Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

adding review rating icons to product_listing.php?


kingsnake

Recommended Posts

Hello -

 

I wanted to show review ratings for the products on my store's site. Right now I have the thumbnail, product name, manufacturer and "buy now" displayed -- easily set up via the admin panel.

 

After the product name would be the review ratings. I've added this code:

 

$list_box_contents = array();

 

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$lc_text = TABLE_HEADING_MODEL;

$lc_align = '';

break;

case 'PRODUCT_LIST_NAME':

$lc_text = TABLE_HEADING_PRODUCTS;

$lc_align = '';

break;

case 'PRODUCT_LIST_REVIEW':

$lc_text = TABLE_HEADING_REVIEW;

$lc_align = '';

break;

case 'PRODUCT_LIST_MANUFACTURER':

$lc_text = TABLE_HEADING_MANUFACTURER;

$lc_align = '';

break;

case 'PRODUCT_LIST_PRICE':

$lc_text = TABLE_HEADING_PRICE;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_QUANTITY':

$lc_text = TABLE_HEADING_QUANTITY;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_WEIGHT':

$lc_text = TABLE_HEADING_WEIGHT;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_IMAGE':

$lc_text = TABLE_HEADING_IMAGE;

$lc_align = 'center';

break;

case 'PRODUCT_LIST_BUY_NOW':

$lc_text = TABLE_HEADING_BUY_NOW;

$lc_align = 'center';

break;

}

 

and

 

 

case 'PRODUCT_LIST_NAME':

$lc_align = '';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';

} else {

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';

}

break;

case 'PRODUCT_LIST_REVIEW':

$lc_align = '';

$lc_text = ' ' . tep_image(DIR_WS_IMAGES . 'stars_' . $reviews['reviews_rating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating']));

 

break;

case 'PRODUCT_LIST_MANUFACTURER':

$lc_align = '';

$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';

break;

 

 

The additions are in red. Outside of adding something to this page, would I need to make any other modifications? I looked around at the various base pages and didn't see anything.

 

I yanked the code for the review ratings icon from reviews.php:

 

. sprintf(TEXT_REVIEW_RATING, tep_image(DIR_WS_IMAGES . 'stars_' . $reviews['reviews_rating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])), sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating']))

 

but got rid of some of the code so it wouldn't display the "of five" text.

 

I threw this up and...no ratings. The good thing was that there wasn't an error so at least the code is somewhat correct -- just not displaying the review icons.

 

Am I missing something? Is it even possible to get the review ratings to show?

 

Thanks!

 

King Snake

Link to comment
Share on other sites

need to define 'PRODUCT_LIST_REVIEW' in index.php also need to add it to configuration table - see how the others are done in these two places for guidance.

Your online success is Paramount.

Link to comment
Share on other sites

  • 2 years later...
need to define 'PRODUCT_LIST_REVIEW' in index.php also need to add it to configuration table - see how the others are done in these two places for guidance.

 

what info do i need to add to the index.php and configuration table

Link to comment
Share on other sites

  • 2 weeks later...

Archived

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

×
×
  • Create New...