Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Searching Value of Extra Product Fields OSC 2.3.4


radhavallabh

Recommended Posts

Hi, I am trying to use this below code to fetch values from Extra Product Field Contribution into search results by typing them in quick search box ....

 

On advanced search result.php I added additionally -----

// Begin EPF Keywords Support
$keywords1 = array();
foreach ($epf as $e) {
  $mt = ($e['uses_list'] && !$e['multi_select'] ? ($pname[$e['field']] == 0) : !tep_not_null($pname[$e['field']]));
  if ($e['keyword'] && !$mt) {
	if ($e['uses_list']) {
	  if ($e['multi_select']) {
		$values = explode('|', trim($pname[$e['field']], '|'));
		foreach ($values as $val) {
		  $keywords1[] = tep_output_string(tep_get_extra_field_list_value($val));
		}
	  } else {
		$keywords1[] = tep_output_string(str_replace(' | ', ', ', tep_get_extra_field_list_value($pname[$e['field']], $e['show_chain'])));
	  }
	} else {
	   $keywords1[] = tep_output_string($pname[$e['field']]);
	}
  }
}
//if (!empty($keywords1)) echo '' . "\n";
// End EPF Keywords Support

Then I additionally added $keywords1 below to get them into search result:-

/************** BEGIN SITESEARCH CHANGE ****************/
  require(DIR_WS_FUNCTIONS . FILENAME_SITE_SEARCH);
  $dir = DIR_WS_LANGUAGES;
  $searchTerm = $keywords;
  $articlesList = array();
  $fileList = array();
  $pagesList = array();
  if (tep_not_null($keywords)) //only check for words
  {
    CheckAllPages($dir, $searchTerm, $keywords1, $fileList, $articlesList, $pagesList, $languages_id);
  }   

  /************** END SITESEARCH CHANGE ****************/
  $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ADVANCED_SEARCH));
  $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, tep_get_all_get_params(), 'NONSSL', true, false));

But it still does not seem to work...

 

I am using

Extra Product Fields for oscommerce v2.3x core

by Gergely Tóth on oscommerce 2.3.4

 

Please could someone help me figure out where am I going wrong.....

Thanks in advance....

Link to comment
Share on other sites

i think you are going in the wrong direction

 

in the regular search result page you have

  $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on pd.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
 

 

where you need to add a left join with PEF

 

and a bit further in the where_str you need to pass in the correct fields to search

 

no need to create a second keywords variable.

 

Now the site search section you have listed above, i do not know.

 

Perhaps you are better off posting in the contributions thread, or list your complete page here so we can get the full picture, right now it looks like apples and oranges mixed up :D

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

@@bruyndoncx @@Tsimi

 

Thank you so much for guiding me....

Yes I was actually looking in the wrong direction.----- got it working using the Search in Description method;

Thank you so much for your valuable help...

Will also make sure to paste the complete page PHP in future..... :thumbsup: :D

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...