Guest Posted November 18, 2009 Posted November 18, 2009 Hi I'm trying to get this contribution - Review Rating In Product Listing 1.0 to work on my site but I'm having problems as my product listing is already heavily modified. I have tired to follow the install instructions but I don’t get any results (don't get any error messages either). Below is the instructions for the contribution and my product_listing.php after following them. Review Rating in product listing 1.0 This mod is inspired of amazon product listing. It will show in your categories the rating given by your customers under product name and add an extra link to the product_reviews.php. -Installation : about 1 minute -Files to edit : 2 or more if your shop runs in more than 1 language. -ScreenShot included Install In /YOUR_SHOP/includes/modules/product_listing.php Approx line 96 Find : case 'PRODUCT_LIST_MODEL': $lc_align = ''; $lc_text = ' ' . $listing['products_model'] . ' '; break; case 'PRODUCT_LIST_NAME': Add after : // BO Review Rating in Product Listing 1.0 $reviews_query_raw = "select r.reviews_id, left(rd.reviews_id,100) as reviews_id, r.reviews_rating 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 p.products_id = ". (int)$listing['products_id'] ." order by r.reviews_id DESC"; $reviews_split = new splitPageResults($reviews_query_raw, MAX_DISPLAY_NEW_REVIEWS); $compteurReview = 0; $noteReview = 0; $reviews_query = tep_db_query($reviews_split->sql_query); while ($reviews = tep_db_fetch_array($reviews_query)) { $compteurReview +=1; $noteReview += (int)$reviews['reviews_rating']; } // EO Review Rating in Product Listing 1.0 Approx line 113 Find : $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>'; Add after : // BO Review Rating in Product Listing 1.0 if ($compteurReview >0) { $noteReview = $noteReview/$compteurReview; $lc_text .= '<br><i><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS . '?products_id=' . $listing['products_id']) . '">' . sprintf(TEXT_REVIEW_RATING_ALG, tep_image(DIR_WS_IMAGES . 'stars_' . (int)$noteReview . '.gif', $noteReview .'/5'), $compteurReview) . '</a></i>'; } // EO Review Rating in Product Listing 1.0 Approx line 121 Find : } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> '; Add after : // BO Review Rating in Product Listing 1.0 if ($compteurReview >0) { $noteReview = $noteReview/$compteurReview; $lc_text .= '<br><i><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS . '?products_id=' . $listing['products_id']) . '">' . sprintf(TEXT_REVIEW_RATING_ALG, tep_image(DIR_WS_IMAGES . 'stars_' . (int)$noteReview . '.gif', $noteReview .'/5'), $compteurReview) . '</a></i>'; } // EO Review Rating in Product Listing 1.0 In /YOUR_SHOP/includes/languages/english.php add define('TEXT_REVIEW_RATING_ALG', '%s %s Review(s)'); In /YOUR_SHOP/includes/languages/french.php add define('TEXT_REVIEW_RATING_ALG', '%s %s Avis'); Thats'it My product_listing.php: <form name="cart_multi" method="post" action="<?php echo tep_href_link(FILENAME_SHOPPING_CART, tep_get_all_get_params(array('action')) . 'action=add_multi', 'NONSSL'); ?>"> <script language=javascript> function changeValue(textObject,delta){ var myVal = parseInt(textObject.value); if (myVal == NaN) { myVal = 0; } else { myVal = myVal + delta; } /* check that it is not negetive */ if (myVal < 0) { myVal = 0; } textObject.value = myVal; return; } </script> <?php /* $Id: product_listing.php,v 2 2008/06/30 22:49:59 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ if (PRODUCTS_PER_ROW == 'PRODUCTS_PER_ROW' || PRODUCTS_PER_ROW == 0 || LISTING_SWITCH == 'LISTING_SWITCH') { $to = 'Setup Error!\nPlease ensure you have run the\nProduct Listing Setup File.' ; print "<script>alert('$to');</script>"; } $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id'); if ( ($listing_split->number_of_rows > (int)MAX_DISPLAY_SEARCH_RESULTS) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table> <?php } function thumbnail($products,$manufacturer = NULL,$column_list,$border,$borderend,$PHP_SELF) { $currencies = new currencies(); $image = $products['products_image']; $addimages = (file_exists(DIR_WS_CLASSES . 'displayimages.php')); // Additional Images Present if ($addimages) { $image_query = tep_db_query( "SELECT ai.medium_images, ai.images_description, ai.popup_images, p.products_image_med, p.products_image_description FROM " . TABLE_ADDITIONAL_IMAGES . " ai, " . TABLE_PRODUCTS . " p WHERE ai.products_id=p.products_id and ai.products_id = '".(int)$products['products_id']."'"); $selected_image = tep_db_fetch_array($image_query); $image = ($selected_image['medium_images'] ? $selected_image['medium_images'] : ($selected_image['products_image_med'] ? $selected_image['products_image_med'] : ($selected_image['popup_images'] ? $selected_image['popup_images'] : $products['products_image']))); } $image = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $image, ($addimages ? ($selected_image['images_description'] ? $selected_image['images_description'] : ($selected_image['products_image_description'] ? $selected_image['products_image_description'] : $products['products_name'])) : $products['products_name']), PRODUCT_IMAGE_WIDTH, '') . '</a>' . '<br><br>'; $buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif'); $button = (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW ? (LISTING_BUTTON == 'buy now & details' ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']) . '">' . tep_image_button($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"') . '</a> <span class="buy_now">|</span> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image_button('button_details_small.gif', IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a><br><br>' : (strstr(LISTING_BUTTON, 'buy now') ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']) . '">' . tep_image_button($buypic, IMAGE_BUTTON_BUY_NOW) . '</a><br><br>' : '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS) . '</a><br><br>' )) : ' '); $name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">'. '<b>' . $products['products_name'] . '</b>' . '</a><br>'. ($products['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br>' . $products['short_desc'] . '<br>' : ''); $price = (function_exists(display_short_price)) ? $currencies->display_short_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])) : $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])); $show_price = '<br><font size="'.PRODUCT_PRICE_SIZE.'">' . ($products['products_price'] > 0 ? $price : 'P.O.A') . '<br></font>'; $quantity = ($products['products_quantity'] ? 'Stock = '.$products['products_quantity'] : 'Out of Stock').'<br />'; $weight = 'Weight = '.$products['products_weight'].'Kg<br />'; $model = $products['products_model'] . '<br>'; $manfact = $products['manufacturers_name'].'<br />'.(MANU_DESCRIPTION == 'true' && $products['manufacturers_description'] ? $manufacturer['manufacturers_description'].'<br />' : ''); $display = $border; for ($disp=0, $n=sizeof($column_list); $disp<$n; $disp++) { switch ($column_list[$disp]) { case 'PRODUCT_LIST_IMAGE': $display .= $image; break; case 'PRODUCT_LIST_NAME': $display .= $name; break; case 'PRODUCT_LIST_MODEL': $display .= $model; break; case 'PRODUCT_LIST_MANUFACTURER': $display .= $manfact; break; case 'PRODUCT_LIST_PRICE': $display .= $show_price; break; case 'PRODUCT_LIST_QUANTITY': $display .= $quantity; break; case 'PRODUCT_LIST_WEIGHT': $display .= $weight; break; } } $display .= $borderend . $button; return($display); }// thumb function end function list_box_head($column_list) { 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 = 'center'; break; // BO Review Rating in Product Listing 1.0 $reviews_query_raw = "select r.reviews_id, left(rd.reviews_id,100) as reviews_id, r.reviews_rating 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 p.products_id = ". (int)$listing['products_id'] ." order by r.reviews_id DESC"; $reviews_split = new splitPageResults($reviews_query_raw, MAX_DISPLAY_NEW_REVIEWS); $compteurReview = 0; $noteReview = 0; $reviews_query = tep_db_query($reviews_split->sql_query); while ($reviews = tep_db_fetch_array($reviews_query)) { $compteurReview +=1; $noteReview += (int)$reviews['reviews_rating']; } // EO Review Rating in Product Listing 1.0 case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $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_PRICE_EX': $lc_text = TABLE_HEADING_PRICE_EX; $lc_align = 'center'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text = TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; // START: display min. order. qty. mod case 'PRODUCT_LIST_MIN_ORDER_QTY': $lc_align = 'center'; $lc_text = ' ' . TABLE_HEADING_MIN_ORDER_QTY . ' '; break; // END: display min. order. qty. mod 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 = (strstr(LISTING_BUTTON, 'buy now')? TABLE_HEADING_BUY_NOW : TABLE_HEADING_DETAIL); $lc_align = 'center'; break; } if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { $lc_text = tep_create_sort_heading($_GET['sort'], $col+1, $lc_text); } $list_box_contents[] = array('align' => $lc_align,'params' => 'class="productListing-heading"','text' => ' ' . $lc_text . ' '); } return ($list_box_contents); } // function list_head end function list_box_data($listing, $column_list,$PHP_SELF) { $currencies = new currencies(); if (!strstr(PRODUCT_THUMBNAIL_VIEW, 'block')) { for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { $lc_align = ''; switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_align = 'center'; $lc_text = ' ' . $listing['products_model'] . ' '; break; 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']) . '"></a>'; // BO Review Rating in Product Listing 1.0 if ($compteurReview >0) { $noteReview = $noteReview/$compteurReview; $lc_text .= '<br><i><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS . '?products_id=' . $listing['products_id']) . '">' . sprintf(TEXT_REVIEW_RATING_ALG, tep_image(DIR_WS_IMAGES . 'stars_' . (int)$noteReview . '.gif', $noteReview .'/5'), $compteurReview) . '</a></i>'; } // EO Review Rating in Product Listing 1.0 } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $category['categories_product_title'] . '</a> '; } if (PRODUCT_LIST_DESCRIPTION && $listing['products_description'] && PRODUCT_LIST_DESCRIPTION_MAX_LENGTH) $lc_text .= '<table border="0" cellpadding="0" cellspacing="0" width="90%"><tr><td class="productDesc">' . tep_flatten_product_description($listing['products_description'], ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . TEXT_MORE . '</a>') . '</td></tr></table>'; if ($listing['products_high_capacity'] == true) { $lc_text .= '<span class="productPriceEX">' . HIGH_CAPACITY_PRODUCT . '</span>'; } else { } if ($listing['products_multi_pack'] == true) { $lc_text .= '<span class="productPriceEX">' . MULTI_PACK_PRODUCT . '</span>'; } else { } 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; case 'PRODUCT_LIST_PRICE': $lc_align = 'right'; if (tep_not_null($listing['specials_new_products_price'])) { $lc_text = '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span><BR><span class="productSpecialPriceEX">(' . $currencies->display_price_ex($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ex.vat)</span><br>'; $lc_align = 'right'; $lc_text .= '<Table><td class="main" valign="center">QTY:<input type="text" STYLE="text-align:center" name="add_id['.$number_of_products.']" id="add_id_'.$listing['products_id'].'" value="0" size="1"><td><img src="images/btn-up.gif" border="0" width=21 height=10 onclick="javascript:changeValue(document.getElementById(\'add_id_'.$listing['products_id'].'\'),1);return false;"><br><img src="images/btn-dn.gif" border="0" width=21 height=10 onclick="javascript:changeValue(document.getElementById(\'add_id_'.$listing['products_id'].'\'),-1);return false; "></td></Table>'; $lc_text .= '<input type="hidden" name="products_id['.$number_of_products.']" value="'.$listing['products_id'].'">'; } else { $lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' <br><span class="productPriceEX">(' . $currencies->display_price_ex($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ex.vat)</span><br>'; $lc_align = 'right'; $lc_text .= '<Table><td class="main" valign="center">QTY:<input type="text" STYLE="text-align:center" name="add_id['.$number_of_products.']" id="add_id_'.$listing['products_id'].'" value="0" size="1"><td><img src="images/btn-up.gif" border="0" width=21 height=10 onclick="javascript:changeValue(document.getElementById(\'add_id_'.$listing['products_id'].'\'),1);return false;"><br><img src="images/btn-dn.gif" border="0" width=21 height=10 onclick="javascript:changeValue(document.getElementById(\'add_id_'.$listing['products_id'].'\'),-1);return false; "></td></Table>'; $lc_text .= '<input type="hidden" name="products_id['.$number_of_products.']" value="'.$listing['products_id'].'">'; } if ($listing['products_free_shipping'] == true) { $lc_text .= '<BR>' . FREE_SHIPPING_FOR_THIS_PRODUCT2 . ''; } else { $lc_text .= '<BR>' . FREE_SHIPPING_FOR_THIS_PRODUCT3 . ''; } break; case 'PRODUCT_LIST_QUANTITY': $lc_align = 'right'; $lc_text = ' ' . $listing['products_quantity'] . ' '; break; // START: display min. order. qty. mod case 'PRODUCT_LIST_MIN_ORDER_QTY': $lc_align = ''; $lc_text = ' ' . $listing['products_min_order_qty'] . ' '; break; // END: display min. order. qty. mod case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $lc_text = ' ' . $listing['products_weight'] . ' '; break; case 'PRODUCT_LIST_IMAGE': $lc_align = 'center'; if (isset($_GET['manufacturers_id'])) { $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> '; // BO Review Rating in Product Listing 1.0 if ($compteurReview >0) { $noteReview = $noteReview/$compteurReview; $lc_text .= '<br><i><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS . '?products_id=' . $listing['products_id']) . '">' . sprintf(TEXT_REVIEW_RATING_ALG, tep_image(DIR_WS_IMAGES . 'stars_' . (int)$noteReview . '.gif', $noteReview .'/5'), $compteurReview) . '</a></i>'; } // EO Review Rating in Product Listing 1.0 } break; case 'PRODUCT_LIST_BUY_NOW': $lc_align = 'center'; $lc_text = ''; break; } $list_box_temp[] = array('align' => $lc_align, 'params' => 'class="productListing-data" valign="top"', 'text' => $lc_text); } } else { // block listing $list_box_temp = array(); if (PRODUCT_LIST_IMAGE) { $list_box_temp[] = array('align' => 'center', 'params' => 'class="productListing-data" ', 'text' => (isset($_GET['manufacturers_id']) ? '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>' : '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>' )); } $display =''; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $display .= $listing['products_model'] . '<br>'; break; case 'PRODUCT_LIST_NAME': if (isset($_GET['manufacturers_id'])) { $display .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '"><b><u>' . $listing['products_name'] . '</u></b></a><br>' . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<span class="short">' . $listing['short_desc'] . '</span><br>' : ''); } else { $display .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '"><b><u>' . $listing['products_name'] . '</u></b></a><br>' . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<span class="short">' . $listing['short_desc'] . '</span><br>' : '');} break; case 'PRODUCT_LIST_MANUFACTURER': $display .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a><br>'; break; case 'PRODUCT_LIST_PRICE': $display .= '<br>Price: '; $price = (function_exists(display_short_price)) ? $currencies->display_short_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) : $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])); if (tep_not_null($listing['specials_new_products_price'])) { $display .= '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span><br>'; } else { $display .= ($listing['products_price'] > 0 ? '' . $price : '' . TEXT_POA); if (function_exists(tep_get_att_price)) $display .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : ' ') ; $display .= '<br>'; $lc_align = 'center'; $lc_text = '<input type="text" name="add_id['.$number_of_products.']" value="0" size="1">'; $lc_text = '<Table><td><input type="text" STYLE="text-align:center" name="add_id['.$number_of_products.']" id="add_id_'.$listing['products_id'].'" value="0" size="1"><td><img src="images/btn-up.gif" border="0" width=21 height=11 onclick="javascript:changeValue(document.getElementById(\'add_id_'.$listing['products_id'].'\'),1);return false;"><br><img src="images/btn-dn.gif" border="0" width=21 height=11 onclick="javascript:changeValue(document.getElementById(\'add_id_'.$listing['products_id'].'\'),-1);return false; "></td></Table>'; $lc_text .= '<input type="hidden" name="products_id['.$number_of_products.']" value="'.$listing['products_id'].'">'; } break; case 'PRODUCT_LIST_QUANTITY': $display .= ($listing['products_quantity'] ? 'Stock = ' . $listing['products_quantity'] : 'Out of Stock') . '<br>'; break; case 'PRODUCT_LIST_WEIGHT': $display .= 'Weight = ' . $listing['products_weight'] . '<br>'; break; } } $list_box_temp[] = array('align' => 'left', 'params' => 'class="main" valign="top"', 'text' => $display); if (PRODUCT_LIST_BUY_NOW) { $buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif'); $button = (LISTING_BUTTON == 'buy now & details' ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"') . '</a> <span class="buy_now">|</span> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image_button('button_details_small.gif', IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a><br><br>' : (strstr(LISTING_BUTTON, 'buy now') ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button($buypic, IMAGE_BUTTON_BUY_NOW) . '</a><br><br>' : '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS) . '</a><br><br>' )) ; $list_box_temp[] = array('align' => 'left', 'params' => 'class="productListing-data" width="'.(100/4).'%" ', 'text' => $button); } } return ($list_box_temp); } // function list_box_data end // set initial values $thumbnail_view = (isset($HTTP_GET_VARS['list']) ? $HTTP_GET_VARS['list'] : PRODUCT_THUMBNAIL_VIEW); $empty_list=false; $grid = strstr(PRODUCT_THUMBNAIL_VIEW, 'grid'); $gborders = function_exists(mws_boxHeader); $Tborder = (!$gborders ? '<table class="infoBoxList" width="100%"><tr><td>' : mws_boxHeader ()); $Tborderend = (!$gborders ? '</td></tr></table>' : mws_boxFooter ()); $border2 = (!$gborders ? '<table class="infoBoxList" width="100%"><tr><td>' : ($graphic_bord == 'yes' ? mws_boxHeader() : '')); $border2end = (!$gborders ? '</td></tr></table>' : ($graphic_bord == 'yes' ? mws_boxFooter() : '')); // output selected display if (strstr($thumbnail_view, 'thumbnails')) { //thumbnail $row = 0; $col = 0; $border = (!$grid ? '<table class="infoBoxProducts" cellpadding="4" width="'.PRODUCT_LIST_WIDTH.'" height="'.PRODUCT_LIST_HEIGHT.'"><tr><td>' : '<br>'); $borderend = (!$grid ? '</td></tr></table>' : ''); $style = (!$grid ? 'class="smallText"' : 'class="infoBoxGrid"'); $info_box_contents = array(); if ($listing_split->number_of_rows > 0) { $listing_query = tep_db_query($listing_split->sql_query);} else { $listing_query = tep_db_query($listing_sql); } if (tep_db_num_rows($listing_query)) { while ($products = tep_db_fetch_array($listing_query)) { if ($row == 0) { if (!$gborders && !$grid) $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="'.(PRODUCTS_PER_ROW ? (100/PRODUCTS_PER_ROW) : '').'%" valign="top"', 'text' => ' '); echo $Tborder;$row ++; } $info_box_contents[$row][$col] = array('align' => 'center', 'params' => $style . ' width="'.(PRODUCTS_PER_ROW ? (100/PRODUCTS_PER_ROW) : '').'%" valign="top"', 'text' => thumbnail($products, '',$column_list,$border,$borderend,$PHP_SELF)); $col ++; if ($col > PRODUCTS_PER_ROW-1) { $col = 0; $row ++; } } // prod loop } else {$empty_list=true; }// no products!! // got display if ($row) { $col = 0;$row ++;$info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="'.(PRODUCTS_PER_ROW ? (100/PRODUCTS_PER_ROW) : '').'%" ', 'text' => ' '); if ($gborders && class_exists(noborderBox)) new noborderBox($info_box_contents); else new contentBox($info_box_contents); echo $Tborderend; } else {$empty_list=true; } } elseif (strstr($thumbnail_view, 'manufacturer')) { //manufacturer $row = 0;$col = 0; if (!isset($_GET['manufacturers_id'])) { $filterlist_sql= tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name, mi.manufacturers_description from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' and mi.languages_id = '" . (int)$languages_id . "' order by m.manufacturers_name"); }else{$filterlist_sql= tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name, mi.manufacturers_description from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' and mi.languages_id = '" . (int)$languages_id . "'");} if (tep_db_num_rows($filterlist_sql)) { echo tep_image_submit('button_in_cart2.gif', IMAGE_BUTTON_IN_CART, 'align="right"'); while ($manufacturer = tep_db_fetch_array($filterlist_sql)) { $info_box_heading = array(); echo $border2; $info_box_heading[0] = array('text' => ''.$manufacturer['manufacturers_name'].' • '.$category['categories_name'].' <br />'.(MANU_DESCRIPTION == 'true' ? $manufacturer['manufacturers_description'].'<br />' : '')); new infoBoxHeading($info_box_heading, false, false); echo tep_draw_separator('pixel_trans.gif', '100%', '20'); $list_box_contents = array(); $list_box_contents[0] = (LISTING_HEADINGS == 'true' && !strstr(PRODUCT_THUMBNAIL_VIEW, 'block') ? list_box_head($column_list) : ''); if ($listing_split->number_of_rows > 0) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query);} else { $listing_query = tep_db_query($listing_sql); } while ($listing = tep_db_fetch_array($listing_query)) { if ($listing['manufacturers_id'] != $manufacturer['manufacturers_id']) continue; $rows++; $cur_row = sizeof($list_box_contents); $list_box_contents[$cur_row][] = array('align' => 'left', 'params' => 'colspan="'.sizeof($column_list).'" class="productListing-title"', '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>'); $list_box_contents[$cur_row+1] = list_box_data($listing, $column_list,$PHP_SELF); } if (!$rows && isset($_GET['manufacturers_id'])) { $list_box_contents = array(); $list_box_contents[0] = array('params' => 'class="productListing-odd"'); $list_box_contents[0][] = array('params' => 'class="productListing-data"', 'text' => TEXT_NO_PRODUCTS); $rows++; } if ($rows) new productListingBox($list_box_contents); echo $border2end . tep_draw_separator('pixel_trans.gif', '100%', '4'); echo tep_image_submit('button_in_cart2.gif', IMAGE_BUTTON_IN_CART,'align="right"'); } // man loop; $col = 0;$row ++;$info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => ' '); } else {$empty_list=true; } // no manufacturers!! } if ((!strstr($thumbnail_view, 'thumbnails') && !strstr($thumbnail_view, 'manufacturer')) || $empty_list) { //default listing $list_box_contents = array(); $list_box_contents[0] = (LISTING_HEADINGS == 'true' && !strstr(PRODUCT_THUMBNAIL_VIEW, 'block') ? list_box_head($column_list) : ''); if ($listing_split->number_of_rows > 0) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query); while ($listing = tep_db_fetch_array($listing_query)) { $rows++; $cur_row = sizeof($list_box_contents); $list_box_contents[$cur_row] = array('align' => 'left', 'params' => 'colspan="'.sizeof($column_list).'" class="productListing-title"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . ' ' . $category['categories_keyword'] . '</a>'); $list_box_contents[$cur_row+1] = list_box_data($listing, $column_list,$PHP_SELF); } new productListingBox($list_box_contents); } else { $list_box_contents = array(); $list_box_contents[0] = array('params' => 'class="productListing-odd"'); $list_box_contents[0][] = array('params' => 'class="productListing-data"', 'text' => TEXT_NO_PRODUCTS); new productListingBox($list_box_contents); } } if ( ($listing_split->number_of_rows > (int)MAX_DISPLAY_SEARCH_RESULTS) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td align="right" class="main"><?php echo tep_image_submit('button_in_cart2.gif', IMAGE_BUTTON_IN_CART); ?></td> </tr> </table> <?php echo tep_draw_separator('pixel_trans.gif', '100%', '20');?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table> <?php } echo tep_draw_separator('pixel_trans.gif', '100%', '100'); if (!strstr(PRODUCT_THUMBNAIL_VIEW, 'list') && LISTING_SWITCH != 'false') echo '<br><span class="smalltext"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('list')). 'list='.($thumbnail_view == 'thumbnails' ? 'manufacturer' : 'thumbnails')) . '">' . ($thumbnail_view == 'thumbnails' ? 'List View' : 'Thumbnail View').'</a></span><br /><br />'; ?> </form> Some guidance would be appreciated.
darrenultra Posted December 20, 2009 Posted December 20, 2009 Anyone? Hi, I had exactly the same problem (no results returned ...but also no error messages). After playing around for a little while I discovered that if a product has 3 reviews then the oldest of those results will be returned. If a product has 4 reveiws then the 2 oldest will be returned, if it has 5 reviews then the oldest 3 will be returned (and so on). It appears that the 2 newest reviews are always being ignored. Therefore a product with 2 or less reviews will be treated as if it has no reviews. If anyone can work out why this is happenning they will be doing me a massive favour. Nick
Recommended Posts
Archived
This topic is now archived and is closed to further replies.