naarestrup Posted February 13, 2004 Posted February 13, 2004 Hi! We've got OS commerce pretty much up and running and have sorted out a few odds and ends along the way, but the solution to one keeps eluding me. We have installed the "Coming Products" contribution and when you click on the arrow on top of the "Coming products" windows and get the upcoming_products.php page it simply outputs the following error message: Warning: Missing argument 3 for splitpageresults() in /home/grascoho/public_html/includes/classes/split_page_results.php on line 24 Warning: Missing argument 4 for splitpageresults() in /home/grascoho/public_html/includes/classes/split_page_results.php on line 24 TEXT_NO_UPCOMING_PRODUCTS Here's our current split_page_results.php file: <?php/* $Id: split_page_results.php,v 1.10 2002/11/23 16:33:58 dgw_ Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce Released under the GNU General Public License */ class splitPageResults { /* NOTE: the constructor (also) builds an sql query that counts the total records from $sql_query.. this value is then saved as $query_num_rows (which does not have to be set before creating an instance of this class. Please note the function references (&$variable) - please read up on this in the PHP documentation. */ /* class constructor */ function splitPageResults(&$current_page_number, $max_rows_per_page, &$sql_query, &$query_num_rows) { if (empty($current_page_number)) $current_page_number = 1; $pos_to = strlen($sql_query); $pos_from = strpos($sql_query, ' from', 0); $pos_group_by = strpos($sql_query, ' group by', $pos_from); if (($pos_group_by < $pos_to) && ($pos_group_by != false)) $pos_to = $pos_group_by; $pos_having = strpos($sql_query, ' having', $pos_from); if (($pos_having < $pos_to) && ($pos_having != false)) $pos_to = $pos_having; $pos_order_by = strpos($sql_query, ' order by', $pos_from); if (($pos_order_by < $pos_to) && ($pos_order_by != false)) $pos_to = $pos_order_by; $pos_limit = strpos($sql_query, ' limit', $pos_from); if (($pos_limit < $pos_to) && ($pos_limit != false)) $pos_to = $pos_limit; $pos_procedure = strpos($sql_query, ' procedure', $pos_from); if (($pos_procedure < $pos_to) && ($pos_procedure != false)) $pos_to = $pos_procedure; $offset = ($max_rows_per_page * ($current_page_number - 1)); $sql_query .= " limit " . $offset . ", " . $max_rows_per_page; $reviews_count_query = tep_db_query("select count(*) as total " . substr($sql_query, $pos_from, ($pos_to - $pos_from))); $reviews_count = tep_db_fetch_array($reviews_count_query); $query_num_rows = $reviews_count['total']; } /* class functions */ // display split-page-number-links function display_links($query_numrows, $max_rows_per_page, $max_page_links, $current_page_number, $parameters = '') { global $PHP_SELF; $class = 'class="pageResults"'; if ( tep_not_null($parameters) && (substr($parameters, -1) != '&') ) $parameters .= '&'; // calculate number of pages needing links $num_pages = intval($query_numrows / $max_rows_per_page); // $num_pages now contains int of pages needed unless there is a remainder from division if ($query_numrows % $max_rows_per_page) $num_pages++; // has remainder so add one page // first button - not displayed on first page // if ($current_page_number > 1) echo '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=1', 'NONSSL') . '" ' . $class . ' title=" ' . PREVNEXT_TITLE_FIRST_PAGE . ' ">' . PREVNEXT_BUTTON_FIRST . '</a> '; // previous button - not displayed on first page if ($current_page_number > 1) echo '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . ($current_page_number - 1), 'NONSSL') . '" ' . $class . ' title=" ' . PREVNEXT_TITLE_PREVIOUS_PAGE . ' "><u>' . PREVNEXT_BUTTON_PREV . '</u></a> '; // check if num_pages > $max_page_links $cur_window_num = intval($current_page_number / $max_page_links); if ($current_page_number % $max_page_links) $cur_window_num++; $max_window_num = intval($num_pages / $max_page_links); if ($num_pages % $max_page_links) $max_window_num++; // previous window of pages if ($cur_window_num > 1) echo '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . (($cur_window_num - 1) * $max_page_links), 'NONSSL') . '" ' . $class . ' title=" ' . sprintf(PREVNEXT_TITLE_PREV_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a>'; // page nn button for ($jump_to_page = 1 + (($cur_window_num - 1) * $max_page_links); ($jump_to_page <= ($cur_window_num * $max_page_links)) && ($jump_to_page <= $num_pages); $jump_to_page++) { if ($jump_to_page == $current_page_number) { echo ' <b>' . $jump_to_page . '</b> '; } else { echo ' <a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . $jump_to_page, 'NONSSL') . '" ' . $class . ' title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' "><u>' . $jump_to_page . '</u></a> '; } } // next window of pages if ($cur_window_num < $max_window_num) echo '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . (($cur_window_num) * $max_page_links + 1), 'NONSSL') . '" ' . $class . ' title=" ' . sprintf(PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a> '; // next button if (($current_page_number < $num_pages) && ($num_pages != 1)) echo ' <a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . ($current_page_number + 1), 'NONSSL') . '" ' . $class . ' title=" ' . PREVNEXT_TITLE_NEXT_PAGE . ' "><u>' . PREVNEXT_BUTTON_NEXT . '</u></a> '; // last button // if (($current_page_number < $num_pages) && ($num_pages != 1)) echo '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . $num_pages, 'NONSSL') . '" ' . $class . ' title=" ' . PREVNEXT_TITLE_LAST_PAGE . ' ">' . PREVNEXT_BUTTON_LAST . '</a> '; } // display number of total products found function display_count($query_numrows, $max_rows_per_page, $current_page_number, $text_output) { $to_num = ($max_rows_per_page * $current_page_number); if ($to_num > $query_numrows) $to_num = $query_numrows; $from_num = ($max_rows_per_page * ($current_page_number - 1)); if ($to_num == 0) { $from_num = 0; } else { $from_num++; } return sprintf($text_output, $from_num, $to_num, $query_numrows); } } ?> You can check it out at http://www.grascohobby.com TIA. - Niclas Any ideas?
Guest Posted February 14, 2004 Posted February 14, 2004 The error message seems to indicate that your upcoming_products.php is calling the function splitpageresults() with only 2 of 4 arguments. The error seems to be in upcoming_products.php, not in splitpageresults. I could tell you more if you post your upcoming_products.php file. You may simply want to compare it to the original, specifically looking for where splitpageresults() is referenced. HTH -jared
naarestrup Posted February 14, 2004 Author Posted February 14, 2004 :unsure: Here's the upcoming_products.php file: <?php/* $Id: upcoming_products.php,v 1.00 2003/17/09 22:49:59 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_UPCOMING_PRODUCTS); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_UPCOMING_PRODUCTS)); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'NONSSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <table width="100%" border="0"> <tr> <td> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_default.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php $upcoming_products_array = array(); $upcoming_products_query_raw = "select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_available, products_date_available as date_expected from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where to_days(products_date_available) >= to_days(now()) and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by products_date_available asc"; $upcoming_products_split = new splitPageResults($upcoming_products_query_raw, MAX_DISPLAY_UPCOMING_PRODUCTS); if (($upcoming_products_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 $upcoming_products_split->display_count(TEXT_DISPLAY_NUMBER_OF_UPCOMING_PRODUCTS); ?> </td> <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $upcoming_products_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('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <tr> <td> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if ($upcoming_products_split->number_of_rows > 0) { $upcoming_products_query = tep_db_query($upcoming_products_split->sql_query); while ($upcoming_products = tep_db_fetch_array($upcoming_products_query)) { if ($new_price = tep_get_products_special_price($upcoming_products['products_id'])) { $priceold=$currencies->display_price($upcoming_products['products_price'], tep_get_tax_rate($upcoming_products['products_tax_class_id'])); $difference=$currencies->display_price($upcoming_products['products_price']-$new_price, tep_get_tax_rate($upcoming_products['products_tax_class_id'])); $workingpriceold = substr($priceold,TEXT_CURRENCY_SYMBOL_LENGTH); $workingdifference = substr($difference,TEXT_CURRENCY_SYMBOL_LENGTH); $savings=round($workingdifference/$workingpriceold,2)*100; $products_price = '<span class="priceinsteadfeatured">'.TEXT_PRICE_INSTEAD.'</span><s><span class=priceinsteadfeatured>' . $currencies->display_price($upcoming_products['products_price'], tep_get_tax_rate($upcoming_products['products_tax_class_id'])) . '</s></span>'.'<span class="priceinsteadfeatured">' . ' ' . TEXT_PRICE_NOW . ' </span><span class="priceinsteadfeatured">' . $currencies->display_price($new_price, tep_get_tax_rate($upcoming_products['products_tax_class_id'])) . '</span><br><span class="priceinsteadfeatured">'.TEXT_PRICE_SAVINGS. '</span><span class="priceinsteadfeatured">'.$difference. ' ('.$savings.'%)</span>'; } else { $products_price = '<span class="pricenormalfeatured">'.TEXT_PRICE.$currencies->display_price($upcoming_products['products_price'], tep_get_tax_rate($upcoming_products['products_tax_class_id'])).'</span>'; } ?> <tr> <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $upcoming_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $upcoming_products['products_image'], $upcoming_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td> <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $upcoming_products['products_id']) . '"><b><u>' . $upcoming_products['products_name'] . '</u></b></a><br>' . '<br>' . $products_price . '<br><br>Release Date: ' . tep_date_short($upcoming_products['products_date_available']) ; ?></td> <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_UPCOMING_PRODUCTS, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $upcoming_products['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td> </tr> <tr> <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } } else { ?> <tr> <td class="main"><?php echo TEXT_NO_UPCOMING_PRODUCTS; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> </table> </td> </tr> <?php if (($upcoming_products_split->number_of_rows > 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 $upcoming_products_split->display_count(TEXT_DISPLAY_NUMBER_OF_UPCOMING_PRODUCTS); ?></td> <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $upcoming_products_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table> </td> </tr> <?php } ?> </table></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> The only way it differs from the original is that I've added our CSS to this one. Tested with the original file from the downloaded contribution and it returned the same error... I'm about getting blind trying to figure this one out....
Guest Posted February 18, 2004 Posted February 18, 2004 well . . . . I'm running MS2, and my upcoming_products looks nothing like that. Mine seems to be written to be included as part of index.php, and yours looks to be more of a stand-alone page. So, I looked at the date in the header of your file. It looks like you're running a CVS version, as the header is dated sept 17, 2003, and MS2 was from July 2003. I'm not sure if splitpageresults has been changed since then, but from the error message you're reporting, my guess is that either: a) splitpageresults() has changed (or is mismatched to the version of osC that you're running), and upcoming_products has not been updated accordingly, AND/OR B) upcoming_products has changed (or is mismatched to the version of osC that you're running). sorry I'm not more help. Since you're already running CVS code, you may consider simply updating to a more current snapshot - - if this is a build problem, or an oversight, then it's most likely fixed by now (it's been several months since the code drop you're running). -jared
focusinnovations Posted February 25, 2004 Posted February 25, 2004 Yes I am running 2.2CVS and the split_page_result.php is totally different
Recommended Posts
Archived
This topic is now archived and is closed to further replies.