Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Search Results Page - Can I change it to be better?


Recommended Posts

Hey all - hope someone can help!


I want to have all the search results to appear per category


i.e. some types search for "Robotech"


They recieve 14 results


3 are DVD's





9 are Toys (





2 is comics





instead of the list of product


If you search www.dstore.com.au you will see exactly what I am trying to achieve. It will be magnificent if we can (or already have) implement it to Oscommerce stock :-)


Let me know people and willing to play around a bit :-)




Link to comment
Share on other sites

I like the idea...


and I am willing to "play around with it" but won't be able to do so until after the 1st week of january... out of town for the holidays...


I'd also like to change the search function so that it accepts "+" signs (parse a plus sign the same as AND)... most search engines now use "+" "-" and quotes for advanced searching and most users (I'd think anyways) are more used to using them than the AND/OR garbage... I am pretty sure OSC search parses quotes right though...


hey if we could get both of these things (what mygeekshop mentioned and this) that'd make for one kickin search...


like I said I am willing to help out but can't until I get back to my regular PC...

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

  • 1 month later...


First add categories_id to advanced_search_results.php:

184  $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, p2c.categories_id ";


Also, sort by categories_id right away:

266        $order_str = ' order by categories_id asc, pd.products_name';

and maybe also:

273    $order_str = ' order by categories_id asc, ';


The rest of the work is to be done in includes/modules/product_listing.php

Loop around your products, comparing $listing_values['categories_id'] to $current_category. Each time the category changes, output your header. Something like this:

    $current_category = 0;

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

   if ($current_category != $listing_values['categories_id']) {

       // Output header for this category

       $current_category = $listing_values['categories_id'];


   // on with the products display !

Christian Lescuyer

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...