skip to Main Content

This is the page. The code that queries the results is here:

I can’t make any sense out of how OSCommerce works. Let me know if you need anything else. Also, is this just a common problem in SQL Queries, PHP loops, or in some math being wrong? I am looking to be pointed in the right direction, not necessarily needing an exact answer as this is a hacked/custom OsCommerce.



  1. I dont think this is spam..

    this is a common issue with oscommerce.. esp custom contributions add in for more trouble when it comes to queries.. oscommerce navigation class does not support for use of distinct or group by clauses.. i.e, to say when it counts for the records, it does not consider those keywords.. you would need to modify the split page results class to fix this.


    Login or Signup to reply.
  2. The problem is in the “group by” clause which the osCommerce code cannot deal with – in the splitResults class file. Struggled with this for a while, and this was my first attempt at fixing it:

    if (strpos($sql_query, 'group by')) {
        $reviews_count_query = tep_db_query("select count(*) as total from (select count(*)" . substr($sql_query, $pos_from) .") as GroupedResult");
    } else {
        $reviews_count_query = tep_db_query("select count(*) as total " . substr($sql_query, $pos_from, ($pos_to - $pos_from)));
    //$reviews_count_query = tep_db_query("select count(*) as total " . substr($sql_query, $pos_from, ($pos_to - $pos_from)));

    However, with further testing, that is not working properly either. I then spent some time working out what was going on exactly, and found similar code already existed in oscommerce at

    Here you can see the splitpageresults class is “group by” clause…and then underneath is the “fix” to place the corrected amount of customers into the numrows query. And that query is then appropriated by the splitpageresults to make the “showing x of y results”.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top