Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Blank Search Results Page


Tom172

Recommended Posts

Posted

Hi @all.

 

I am a bit lost with a problem and would appreciate any hint on where to have a closer look at in my 2.2rca OScommerce Shop:

 

 

The search_results.php page shows only the table that tells me: "showing results 1-20 of 92 total results", but it does not show any found products though.

 

The search itself should work, as the given number of results actually changes depending on the search term I enter. However there are no results listed.

 

 

 

The real mess is: I can´t tell what could cause this. As I have not used the search box in the past. So it is difficult to say which of the 90+ contributions or modifications I have installed over the past two years may cause this behaviour.

 

 

 

To narrow it down I have already tried the stock oscommerce search box, advanced_search.php, search_results.php and html_output.php files instead of the modified versions. The result with those virgin files remains the same: The search results pages gives me a number of found results/products but does not list any product.

 

 

Any hint will be appreciated.

Posted

I want to add:

 

There is no failure message or warning, etc.

 

It just does not give any result.

Posted

I found out that the problem must be related to modules/product_linsting.php

 

=> when I use a stock product_listing.php the listing appears correct in advanced_search_results.php

 

 

The weird thing is: The product_listing works just fine when navigating the categories and watch the product listing from there.

 

 

The question is: Could anyone give me a hint what could cause the product listing work correct in "normal" product listing when navigating through categories, but fail when it is included in advanced_search_results.php

 

 

The product_listing modul is quite a bit modified so what I did first was: I took a stock file and made all changes to that file that were required by those contributions. The result remains the same.

 

istalled are:

 

6856 Extra Product Fields

7071 Events Calendar (Expired Products)

5351 Show all Products (Category view)

3076 Sold out but displayed

 

 

Perhaps someone can have a look at my modules/product_listing.php and give me some hint what could cause this:

 

<?php
/*
 $Id: product_listing.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 if ( ($listing_split->number_of_rows > 0) && ( (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
 }

 $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 = '';
       break;
// BOF 6856 Extra Product Fields 3.01
     case 'PRODUCT_LIST_TYPE':
       $lc_text = TEXT_PTYPE;
       $lc_align = '';
       break;
// EOF 6856 Extra Product Fields 3.01		
     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 = 'right';
       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 = 'center';
       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($HTTP_GET_VARS['sort'], $col+1, $lc_text);
   }

   $list_box_contents[0][] = array('align' => $lc_align,
                                   'params' => 'class="productListing-heading"',
                                   '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)) {
// BOF 7071 EVENTS CALENDAR 1.0
    if ($listing['products_event_expires_type'] == 'disable' || (($listing['products_event_expires_type'] == 'today' && $listing['products_event_date'] > date('Y-m-d')) || ($listing['products_event_expires_type'] == 'tomarrow' && $listing['products_event_date'] >= date('Y-m-d')))) {
// EOF 7071 EVENTS CALENDAR 1.0

     $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 = '';
           $lc_text = ' ' . $listing['products_model'] . ' ';
           break;
//          case 'PRODUCT_LIST_NAME'
// BOF 5351 show all stuff mod => see few lines down
/**		  case 'PRODUCT_LIST_NAME':
           $lc_align = '';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
           } else {
             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
           }**/
// BOF 6856 Extra Product Fields 3.01
         case 'PRODUCT_LIST_TYPE':
           $lc_align = '';
           $lc_text = ' ' . epf_get_ptype_desc($listing['products_type']) . ' ';
           break;
         case 'PRODUCT_LIST_NAME':
           $extra = '';
           foreach ($epf as $e) {
             if ($e['listing']) {
               $mt = ($e['uses_list'] && !$e['multi_select'] ? ($listing[$e['field']] == 0) : !tep_not_null($listing[$e['field']]));
               if (!$mt) { // only list fields that aren't empty
                 $extra .= '<br><b>' . $e['label'] . ': </b>';
                 if ($e['uses_list']) {
                   if ($e['multi_select']) {
                     $epf_values = explode('|', trim($listing[$e['field']], '|'));
                     $epf_string = '';
                     foreach ($epf_values as $v) {
                       $epf_string .= tep_get_extra_field_list_value($v) . ', ';
                     }
                     $extra .= trim($epf_string, ', ');
                   } else {
                     $extra .= tep_get_extra_field_list_value($listing[$e['field']],$e['show_chain'] == 1);
                   }
                 } else {
                   $extra .= $listing[$e['field']];
                 }
// BOF 5351 show all stuff mod 
			  } else {
				$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
			  }
// EOF 5351 show all stuff mod
               }
             }

// EOF 6856 Extra Product Fields 3.01
           $lc_align = '';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] /*begin epf*/ . $extra /*end epf*/ . '</a>';
// BOF 7071 EVENTS CALENDAR
		  if ($listing['products_event_expires_type'] == 'today') {
                       $lc_text .= '<br><font color="#0000ff">' . TEXT_EVENT_EXPIRES_ON . ' ' . tep_date_long($listing['products_event_date']) . '</font>';
             } elseif ($listing['products_event_expires_type'] == 'tomarrow') {
                       $lc_text .= '<br><font color="#0000ff">' . TEXT_EVENT_EXPIRES_AFTER . ' ' . tep_date_long($listing['products_event_date']) . '</font>';
             }
// EOF 7071 EVENTS CALENDAR 1.0
		  } else {
             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] /*begin epf*/ . $extra /*end epf*/ . '</a> ';
// BOF 7071 EVENTS CALENDAR 1.0
		  if ($listing['products_event_expires_type'] == 'today') {
                       $lc_text .= '<br><font color="#0000ff">' . TEXT_EVENT_EXPIRES_ON . ' ' . tep_date_long($listing['products_event_date']) . '</font>';
             } elseif ($listing['products_event_expires_type'] == 'tomarrow') {
                       $lc_text .= '<br><font color="#0000ff">' . TEXT_EVENT_EXPIRES_AFTER . ' ' . tep_date_long($listing['products_event_date']) . '</font>';
             }
           }
// EOF 7071 EVENTS CALENDAR 1.0
           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';
           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 = ' ' . $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;
// Following section replaced for 5351 show all stuff mod			
//          case 'PRODUCT_LIST_IMAGE':
//            $lc_align = 'center';
//            if (isset($HTTP_GET_VARS['manufacturers_id'])) {
//              $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['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> ';
//            }
// BOF 5351 show all stuff mod
         case 'PRODUCT_LIST_IMAGE':
           $lc_align = 'center';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['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, 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
           }
// EOF 5351 show all stuff mod
           break;
         case 'PRODUCT_LIST_BUY_NOW':
           $lc_align = 'center';
		// The following line replaced for 3076 sold out but displayed
//            $lc_text = '<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', IMAGE_BUTTON_BUY_NOW) . '</a> ';

// BOF 3076 SOLDOUT but displayed
$quantity = tep_db_fetch_array(tep_db_query("select products_quantity from products where products_id like '".$listing["products_id"]."'"));
$lc_align = 'center';

//This line added for 7704 ultimate seo urls => included in following two lines (action ... products_id // .... tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $listing['products_id'])
if (intval($quantity['products_quantity']) > 0) {
$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
}else{
$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'products_id')) . 'action=info_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('more_info.gif', IMAGE_BUTTON_MORE_INFO) . '</a> ';
} 
// EOF 3076 SOLDOUT but displayed
           break;
       }

       $list_box_contents[$cur_row][] = array('align' => $lc_align,
                                              'params' => 'class="productListing-data"',
                                              'text'  => $lc_text);
     }
// BOF 7071 EVENTS CALENDAR 1.0
}
// EOF 7071 EVENTS CALENDAR 1.0
  }


   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 > 0) && ((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
 }
?>

Posted

Ok. Step by Step I found out that the Problem comes with Expired Products (Events Calendar) Contribution. This Contribution excludes expired products from product listing.

 

For now I solved this by just adding a second product_listing.php file that does not filter the expired products and made this file the one that is being included from advanced_search_result.php.

 

This way expired products are not listet in normal product listing when surfing categories but they are listed through the search function. Which is not too bad as it shows a customer that at least we used to have this product in our store but don´t carry it any longer.

 

 

The main question now is for understanding the problem: How can it be that the product_listing works so different when it is included from advanced_search_result.php and not from index ?

Archived

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

×
×
  • Create New...