Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

After i replace my product info module by product_listing_1_2_3_4_5, next page function disappear.

 

I have set a small amount for MAX_DISPLAY_SEARCH_RESULTS! but nothing happen when my list is more than MAX_DISPLAY_SEARCH_RESULTS .

 

Here is the code, please help to find out the result. I have try but not work.... >.<

 

thanks!

 

<?php

/*

$Id: product_listing.php,v 1.1.1.1 2003/02/20 01:03:54 ptosh Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

// VIEW_OPTION SESSION REGISTER

 

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

$_SESSION['view'] = $HTTP_GET_VARS['listing'];

$view = $HTTP_GET_VARS['listing'];

} else if (tep_session_is_registered('view')) {

$view = $_SESSION['view'];

} else if (!tep_session_is_registered('view')) {

$view = 'side';

tep_session_register('view');

}

 

switch($view){

case 'vertical':

$max_display_search_result = MAX_DISPLAY_SEARCH_RESULTS;

break;

case 'side':

$max_display_search_result = MAX_DISPLAY_SEARCH_RESULTS * 3;

break;

}

 

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

$_SESSION['PLsort'] = $HTTP_GET_VARS['PLsort'];

$PLsort = $HTTP_GET_VARS['PLsort'];

} else if (tep_session_is_registered('PLsort')) {

$PLsort = $_SESSION['PLsort'];

} else if (!tep_session_is_registered('PLsort')) {

$PLsort = '3d';

tep_session_register('PLsort');

}

 

switch ($PLsort) {

case '5a':

$sort_suffix = "order by p.products_price asc";

break;

case '5d':

$sort_suffix = "order by p.products_price desc";

break;

case '3a':

$sort_suffix = "order by pd.products_name desc";

break;

case '3d':

$sort_suffix = "order by pd.products_name asc";

break;

}

 

$original_sort_location = strpos($listing_sql, 'order by');

$listing_sql_corrected = substr($listing_sql, 0, $original_sort_location - 1) . $sort_suffix;

 

?>

 

 

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<form>

<tr>

<td class="main"><b><?php echo LISTING_DISPLAY_OPTION ; ?></b>

<select size="1" onChange="if(options[selectedIndex].value) window.location.href=(options[selectedIndex].value)">

<option <?php if($view=='vertical'){ echo 'selected' ;} ?> value="<?php echo tep_href_link(basename($PHP_SELF),tep_get_all_get_params(array('listing')).'listing=vertical', NONSSL);?>"><?php echo SORT_BY_IMAGE_TEXT ; ?></option>

<option <?php if($view=='side'){ echo 'selected' ;} ?> value="<?php echo tep_href_link(basename($PHP_SELF),tep_get_all_get_params(array('listing')).'listing=side', NONSSL);?>"><?php echo SORT_BY_IMAGE ; ?></option>

</select></td>

<td align="right" class="main"><b><?php echo LISTING_SORT_BY ; ?></b> <select name="select" onChange="if(options[selectedIndex].value) window.location.href=(options[selectedIndex].value)">

<option <?php if($PLsort=='5a'){ echo 'selected' ;} ?> value="<?php echo tep_href_link(basename($PHP_SELF),tep_get_all_get_params(array('page')).'PLsort=5a', NONSSL);?>"><?php echo LISTING_PRICE_LOW ; ?></option>

<option <?php if($PLsort=='5d'){ echo 'selected' ;} ?> value="<?php echo tep_href_link(basename($PHP_SELF),tep_get_all_get_params(array('page')).'PLsort=5d', NONSSL);?>"><?php echo LISTING_PRICE_HIGHT ; ?></option>

<option <?php if($PLsort=='3d'){ echo 'selected' ;} ?> value="<?php echo tep_href_link(basename($PHP_SELF),tep_get_all_get_params(array('page')).'PLsort=3d', NONSSL);?>"><?php echo LISTING_TITLE_A_TO_Z ; ?></option>

<option <?php if($PLsort=='3a'){ echo 'selected' ;} ?> value="<?php echo tep_href_link(basename($PHP_SELF),tep_get_all_get_params(array('page')).'PLsort=3a', NONSSL);?>"><?php echo LISTING_TITLE_Z_TO_A ; ?></option>

</select></td>

</tr>

</form>

</table><br>

 

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

 

 

$listing_split = new splitPageResults($listing_sql_corrected, $max_display_search_result, 'p.products_id');

 

if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"> <?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?> 1</td>

<td align="right" class="smallText"> <?php echo TEXT_RESULT_PAGE; ?> <?php echo $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?> </td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator(); ?></td>

</tr>

<?php

}

?>

<tr>

<td><?php

if ($listing_split->number_of_rows > 0) {

switch($view){

############################

# Image + Text #

############################

case 'vertical':

$listing_query = tep_db_query($listing_split->sql_query);

echo '<table border="0" width="100%" cellspacing="0" cellpadding="2">'."\n" ;

while ($listing = tep_db_fetch_array($listing_query)) {

//price

if (tep_not_null($listing['specials_new_products_price'])) {

$price = '<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 {

$price = $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';

}

//buynow

if($listing['products_quantity'] > 0) {

$BUY_NOW = '<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('button_buy_now.gif', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . '</a> ';

} else {

$BUY_NOW = STOCK_MARK_PRODUCT_OUT_OF_STOCK;

}

//stylesheet.css

if (($row/2) == floor($row/2)) {

$_class = "productListing-even";

} else {

$_class = "productListing-odd" ;

}

 

$row++;

echo '<tr class="'.$_class.'">';

echo '<td align="center" class="productListing-data"><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></td>';

echo '<td align="center" class="productListing-data"> '.$listing['products_model'].' </td>';

echo '<td class="productListing-data"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">'.$listing['products_name'].'</a> </td>';

echo '<td align="center" class="productListing-data">'.$BUY_NOW.' </td>';

echo '<td align="right" class="productListing-data"> '.$price.' </td>';

echo '</tr>';

}

echo '</table>' ;

break;

############################

# Image #

############################

case 'side':

default:

$listing_query = tep_db_query($listing_split->sql_query);

echo '<table border="0" width="100%" cellspacing="0" cellpadding="2">'."\n" ;

echo '<tr>'."\n";

$row = 0 ;

$col = 0 ;

 

while ($listing = tep_db_fetch_array($listing_query)) {

//price

if (tep_not_null($listing['specials_new_products_price'])) {

$price = '<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 {

$price = $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';

}

//buynow

if($listing['products_quantity'] > 0) {

$BUY_NOW = '<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('button_buy_now.gif', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . '</a> ';

} else {

$BUY_NOW = STOCK_MARK_PRODUCT_OUT_OF_STOCK;

}

 

$row++;

$col++;

echo '<td align="center" class="productListing-data" width="33%" valign="top" style="padding-bottom:10px;"><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) . '<br>'.$listing['products_name'].'</a><br>'.$price./*'<br>'.$BUY_NOW.*/'</td>';

if ($col > 2) {

echo '</tr>'."\n".'<tr>'."\n";

$col = 0;

$row ++;

}

}

echo '</tr>';

echo '</table>' ;

break;

}

 

echo ' </td>' . "\n" .

' </tr>' . "\n";

} else {

?>

<tr class="productListing-odd">

<td class="smallText"> <?php echo (isset($HTTP_GET_VARS['manufacturers_id']) ? TEXT_NO_PRODUCTS2 : TEXT_NO_PRODUCTS); ?> </td>

</tr>

<?php

}

?>

<tr>

<td><?php echo tep_draw_separator(); ?></td>

</tr>

<?php

if ( ($listing_numrows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {

?>

<tr>

<td><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 align="right" class="smallText"> <?php echo TEXT_RESULT_PAGE; ?> <?php echo $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?> </td>

</tr>

</table></td>

</tr>

<?php

}

?>

</table>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...