Well, I'm putting some products up for sale (30% off) on a website.
On the invidual product pages, the special prices show up as expected.
Example 1:
But on the category product listing pages, the price only shows up as the original price.
Example 2:
$10.00
My question is: How do I fix the product listing page so the special prices are also displayed (as in Example 1)?
There have been some mods done to the product_listing page, particularly this contrib:
http://addons.oscommerce.com/info/8102
This is the current code I'm working with on the product_listing page:
<?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
*/
$debug = 'no'; // set to 'yes' if there are any problems & report alert message in the forum.
$show_ratings = false; // set to true to show the products average review rating
if ($debug == 'yes') {
if (PRODUCT_THUMBNAIL_VIEW == 'PRODUCT_THUMBNAIL_VIEW') $to = 'PRODUCT_THUMBNAIL_VIEW not set\n' ;
if (PRODUCT_SHORT_DESC == 'PRODUCT_SHORT_DESC') $to .= 'PRODUCT_SHORT_DESC not set\n' ;
if (MANU_DESCRIPTION == 'MANU_DESCRIPTION') $to .= 'MANU_DESCRIPTION not set\n' ;
if (PRODUCT_IMAGE_WIDTH == 'PRODUCT_IMAGE_WIDTH') $to .= 'PRODUCT_IMAGE_WIDTH not set\n' ;
if (PRODUCT_LIST_WIDTH == 'PRODUCT_LIST_WIDTH') $to .= 'PRODUCT_LIST_WIDTH not set\n' ;
if (PRODUCT_LIST_HEIGHT == 'PRODUCT_LIST_HEIGHT') $to .= 'PRODUCT_IMAGE_WIDTH not set\n' ;
if (PRODUCT_PRICE_SIZE == 'PRODUCT_PRICE_SIZE') $to .= 'PRODUCT_PRICE_SIZE not set\n' ;
if (PRODUCTS_PER_ROW == 'PRODUCTS_PER_ROW') $to .= 'PRODUCTS_PER_ROW not set\n' ;
if (LISTING_BUTTON == 'LISTING_BUTTON') $to .= 'LISTING_BUTTON not set\n' ;
if (LISTING_HEADINGS == 'LISTING_HEADINGS') $to .= 'LISTING_HEADINGS not set\n' ;
$to .= 'PRODUCT_IMAGE_WIDTH set to: '.PRODUCT_IMAGE_WIDTH;
if ($to) print "<script>alert('$to');</script>";
}
$thumbnail_view = (isset($HTTP_GET_VARS['list']) ? $HTTP_GET_VARS['list'] : PRODUCT_THUMBNAIL_VIEW);
$empty_list=false;
$gborders = function_exists(mws_boxHeader);
$Tborder = (!$gborders ? '<table class="infoBoxList" width="100%"><tr><td>' : mws_boxHeader ());
$Tborderend = (!$gborders ? '</td></tr></table>' : mws_boxFooter ());
$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');
if ( ($listing_split->number_of_rows > 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
}
///////ossdescription and rating
$data_ok = ($listing_split->number_of_rows > 0);
if ((PRODUCT_LIST_DESCRIPTION ) && $data_ok) {
$listing_query = tep_db_query($listing_split->sql_query);
while ($products = tep_db_fetch_array($listing_query)) $id_array[] = $products['products_id'];
$pid_string = implode(',', array_unique($id_array));
$product_query = tep_db_query("select products_id, products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id in (" . $pid_string . ") and language_id = '" . (int)$languages_id . "'");
while ($products = tep_db_fetch_array($product_query)) {
$t_desc[$products['products_id']] = substr(strip_tags($products['products_description']), 0, PRODUCT_LIST_DESCRIPTION_MAX_LENGTH);
}
}
if ($show_ratings && $data_ok) {
$rating_query = tep_db_query("select count(*) as count, products_id, sum(reviews_rating) as total from " . TABLE_REVIEWS . " where products_id in (" . $pid_string . ") group by products_id");
while ($rating = tep_db_fetch_array($rating_query)) {
$review[$rating['products_id']] = ceil($rating['total'] / $rating['count']);
}
}
function product_description($product_id,$link,$thumb=false) {
global $head_title, $t_desc, $review;
if ($review[$product_id]) $rating = '<span class="smallText"><br />' . sprintf(tep_image(DIR_WS_IMAGES . 'stars_' . $review[$product_id] . '.gif',sprintf(TEXT_AVERAGE_REVIEW,$review[$product_id]))) . '</span>';
if (PRODUCT_LIST_DESCRIPTION) {
return ($head_title || $thumb ? '' : '<br />') . '<span class="productListing-short">' . $t_desc[$product_id] . $link . '<b>...' . TEXT_VIEW . '</b></a></span>' . $rating;
} else {
return $rating;
}
}
///////eof ossdescription
if ($thumbnail_view == 'thumbnails') { //thumbnail
$row = 0;
$col = 0;
$border = '<table class="infoBoxProducts" cellpadding="4" width="'.PRODUCT_LIST_WIDTH.'" height="'.PRODUCT_LIST_HEIGHT.'"><tr><td>';
$borderend = '</td></tr></table>';
$info_box_contents = array();
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 ($products = tep_db_fetch_array($listing_query)) {
if ($row == 0) {
if (!$gborders) $info_box_contents[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="'.(100/PRODUCTS_PER_ROW).'%" valign="top"',
'text' => ' ');
echo $Tborder;$row ++;
}
$image = $products['products_image'];
if (file_exists(DIR_WS_CLASSES . 'displayimages.php')) { // Additional Images Present
$image_query = tep_db_query( "SELECT medium_images FROM " . TABLE_ADDITIONAL_IMAGES . " WHERE 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'] : $products['products_image'])); }
$button = (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW ? (LISTING_BUTTON == 'buy now' ? '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']) . '">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', null, 'primary') . '</a><br><br>' : (LISTING_BUTTON == 'small 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_draw_button(ICON_ARROW_RIGHT, 'cart', null, 'primary') . '</a><br><br>' : (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_draw_button(ICON_ARROW_RIGHT, 'cart', null, 'primary') . '</a> <span class="buy_now">|</span> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_draw_button(SMALL_IMAGE_BUTTON_VIEW, 'cart', null, 'primary') . '</a><br><br>' : '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_draw_button(SMALL_IMAGE_BUTTON_VIEW, 'cart', null, 'primary') . '</a><br><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']));
///////ossdescription
$name = '<div class="productListing-name">' . $link . $products['products_name'] . '</a></div>'. ($products['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '' . $products['short_desc'] . '<br />' : '') . product_description($products['products_id'],$link, true);
///////eof ossdescription
$show_price = '<font size="'.PRODUCT_PRICE_SIZE.'">' . ($products['products_price'] > 0 ? $price : 'P.O.A') . '</font>';
if (!PRODUCT_LIST_PRICE) $show_price = '';
$model=(PRODUCT_LIST_MODEL ? $products['products_model'] . '<br><br>' :'');
$info_box_contents[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="'.(100/PRODUCTS_PER_ROW).'%" valign="top"',
'text' => $border . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $image, $products['products_name'], PRODUCT_IMAGE_WIDTH, '') . '</a>' . '<br><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">'. ($products['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? $products['short_desc'] . '<br><br>' : '') . $model . $show_price . $name . $borderend . $button);
$col ++;
if ($col > PRODUCTS_PER_ROW-1) {
$col = 0;
$row ++;
}
}
$col = 0;$row ++;$info_box_contents[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="'.(100/PRODUCTS_PER_ROW).'%" ',
'text' => ' ');
if ($gborders) new noborderBox($info_box_contents); else new contentBox($info_box_contents);
echo $Tborderend;
} else {$empty_list=true; } // no manufacturers!!
if (($thumbnail_view == 'empty_list') || $empty_list) { //default
$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 = 'center';
break;
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 = '';
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 = '';
break;
case 'PRODUCT_LIST_BUY_NOW':
$lc_text = TABLE_HEADING_BUY_NOW;
$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); }
if (LISTING_HEADINGS == 'true') $list_box_contents[0][] = array('align' => $lc_align, 'params' => '<div class="ui-widget-header ui-corner-top infoBoxHeading">', 'text' => ' ' . $lc_text . ' ');
}
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++;
if (($rows/2) == floor($rows/2)) {
$list_box_contents[] = array('params' => 'class="productListing-even"');
} else {
$list_box_contents[] = array('params' => 'class="productListing-odd"');
}
$cur_row = sizeof($list_box_contents) - 1;
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 = '';
///////ossdescription
$man_id = (tep_not_null($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : '');
$link = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id'] . ($man_id ? '&manufacturers_id='.$man_id : ($cPath && $cat_path ? '&cPath=' . $cPath : '')) ) . '"' . ($man_id || ($cat_path && $cat_path) ? ' rel="nofollow"' : '') . '>';
$lc_text = ' ' . $link . '<span class="productListing-name">' . $listing['products_name'] . '</span></a>' . product_description($listing['products_id'],$link);
///////eof ossdescription
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';
$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'])) {
$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> ';
} else {
$lc_text = ($listing['products_price'] > 0 ? ' ' . $price . ' ' : ' ' . TEXT_POA);
if (function_exists(tep_get_att_price)) $lc_text .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : ' ') ;
}*/
if (tep_not_null($listing['specials_new_products_price'])) {
$prod_list_contents .= '<del>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</del><span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
} else {
$prod_list_contents .= '' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '';
}
break;
case 'PRODUCT_LIST_QUANTITY':
$lc_align = 'right';
$lc_text = ' ' . $listing['products_quantity'] . ' ';
break;
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> ';
}
break;
case 'PRODUCT_LIST_BUY_NOW':
$button = (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_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'])) . '</a> ' : (LISTING_BUTTON == 'small 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_draw_button(ICON_ARROW_RIGHT, 'cart', null, 'primary') . '</a> ' : '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_draw_button(SMALL_IMAGE_BUTTON_VIEW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'])) . '</a> ' ));
$lc_align = 'center';
$lc_text = $button;
break;
}
$list_box_contents[$cur_row][] = array('align' => $lc_align,
'params' => 'class="productListing-data" ',
'text' => $lc_text);
}
}
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 > 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 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
}
if ($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 />';
?>
Any ideas on how to fix this?



Find content
Not Telling
