Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

The Search


Addy

Recommended Posts

:'( Guys/Girls.. I need youze... :'(

 

I want to slightly alter my search query without installing new contributions.

In short, I want to change the actual QUERY command... But I'm kinda unable to find it. >_< <_< ... I know I know, I'm ashamed already! :blush: Anyone?

Link to comment
Share on other sites

Gotcha.. Hmm.. this looks tricky...  :blink:  Can someone tell me how to add the search rule that the keywords will also be searched in the categories?

 

I assume you have keywords added to the database table, perhaps using the HTC contribution?

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Well.. no actually... If someone enters a string and starts the search, I want the descriptions being searched (like normal) but also to search if categories exist with that name...

 

The HTC contribution? I've searched but didn't find it...

Link to comment
Share on other sites

Categories?

 

You didn't say anything about categories. You said 'keywords', which I assumed you meant meta keywords.

 

Did you mean to say 'categories'? Categories can be done by changing the query, yes, but meta keywords cna only be searched through by changing the query only if you have them in the database.

 

In any event, there is a contribution for changing the search to look through the category. I know you didn't want to, but installing that will be alot less trouble than doing the work from scratch. No reason to re-invent the wheel.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

True.. True... Thanks for the reply for starters! The thing is, I don't mind installing a contribution if that's the only way.

 

I've seen some contributions that add pulldown menu's... The thing I want is that I type in a product category, I get all the products from that category... So no extra pulldown menu's etc...

Link to comment
Share on other sites

So, it sounds like you're looking for a custom modification, because I don't think something *exactly* like that already exists.

 

Were you trying to change the search feature so that it no longer looks through product names and decriptions, or are you trying to change it so that it looks through category names as well as through product name and decriptions?

 

If you're looking for the former, were you looking for a new text box in which to enter the category name? What if they spell it wrong?

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Well, it sounds to me like you'd need to join to another table in your query. That might get a little tricky, depending on what the join looks like. Post the query here, and I'll take a look.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Thanks dude! I need it! It's a bit tricky cause it's build up in the \catalog\advance_search_results.php file... That's what's confusing me...

 

 $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 ";

 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
   $select_str .= ", SUM(tr.tax_rate) as tax_rate ";
 }

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

 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
   if (!tep_session_is_registered('customer_country_id')) {
     $customer_country_id = STORE_COUNTRY;
     $customer_zone_id = STORE_ZONE;
   }
   $from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";
 }

 

That's it.. Somewhere (as far as I can see) we need to input the categories in the code-soup... I know my php, but this is to advanced and I don't know the whole oscommerce picture... can you help?

Link to comment
Share on other sites

What I forgot to tell is that the advanced_search_result.php builds the query in parts.. Above, you saw the SELECT part... after that, they build the WHERE part, which is quite long, so I post a piece...

 

$where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

 if (isset($HTTP_GET_VARS['categories_id']) && tep_not_null($HTTP_GET_VARS['categories_id'])) {
   if (isset($HTTP_GET_VARS['inc_subcat']) && ($HTTP_GET_VARS['inc_subcat'] == '1')) {
     $subcategories_array = array();
     tep_get_subcategories($subcategories_array, $HTTP_GET_VARS['categories_id']);

     $where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and (p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . "'";

     for ($i=0, $n=sizeof($subcategories_array); $i<$n; $i++ ) {
       $where_str .= " or p2c.categories_id = '" . (int)$subcategories_array[$i] . "'";
     }

     $where_str .= ")";
   } else {
     $where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . "'";
   }
 }

 

That's it.. Somewhere (as far as I can see) we need to input the categories in the code-soup... I know my php, but this is to advanced and I don't know the whole oscommerce picture... can you help?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...