Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Extra Fields - how to search extra fields


webman2015

Recommended Posts

I have installed the extra fields mod. It works great. But, how do I set up the advanced_search.php so that I can search by a single field only?

 

For example, I have a new field labeled "Height" and I want the customer to be able to search by height.

 

I want to have a drop down menu that shows 0-5 inches, 6-10 inches, 11-15 inches and so on.

 

anyone know how?

Link to comment
Share on other sites

Forgive me if I'm wrong, but you seem to be saying: this is what I want, so now will one of you write the code for me!!

 

 

That approach will get you nowhere, best to research your issue (there are many examples of drop downs in the contribs) try some things, then if you get stuck, ask here saying what you've tried.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

I have installed the extra fields mod. It works great. But, how do I set up the advanced_search.php so that I can search by a single field only?

 

For example, I have a new field labeled "Height" and I want the customer to be able to search by height.

 

I want to have a drop down menu that shows 0-5 inches, 6-10 inches, 11-15 inches and so on.

 

anyone know how?

 

 

Sorry for not being clear in the first post. I am interested in doing the work myself, actually love this stuff!!

 

I have searched these forums full time for five days now (literally) and cant seem to find out exactly what I am looking for. I have set up extra fields in the database using the New Fields version 4 mod. Actually, this is just instructions to manually enter the custom fields. I am also using easy populate. Both work well and I can upload data with excel, no problem.

 

I have looked into the "advanced search mod", "advanced search infobox BTS", "advanced search attributes", "AJAX search suggest", "display matching categories in search results", "search enhancements" and others. I have actually studied each one, looking for ideas, but have no success yet.

 

I also have 11 other various mods installed into the shop from better products display to image enhancements and more. All are great.

 

What I am searching for is how to modify the advanced_search.php so that a customer can now click a button (mentioned earlier) for a particular height for example.

 

I have tried various ideas, but cant quite seem to get the data to come up right. I will not claim to be an expert in PHP, but can usually figure simple things out myself and install mods with no problem.

 

I only ask if anyone out there has ever tried this before and if so, where is the discussion, or mod for it.

 

I will keep searching the forums until something comes up. This is my full time job and I am stuck on this one point, so I am very determined and dedicated.

 

Again, sorry for not coming across properly earlier.

 

Any help would be GREATLY appreciated.

Link to comment
Share on other sites

Sorry for not being clear in the first post. I am interested in doing the work myself, actually love this stuff!!

 

I have searched these forums full time for five days now (literally) and cant seem to find out exactly what I am looking for. I have set up extra fields in the database using the New Fields version 4 mod. Actually, this is just instructions to manually enter the custom fields. I am also using easy populate. Both work well and I can upload data with excel, no problem.

 

I have looked into the "advanced search mod", "advanced search infobox BTS", "advanced search attributes", "AJAX search suggest", "display matching categories in search results", "search enhancements" and others. I have actually studied each one, looking for ideas, but have no success yet.

 

I also have 11 other various mods installed into the shop from better products display to image enhancements and more. All are great.

 

What I am searching for is how to modify the advanced_search.php so that a customer can now click a button (mentioned earlier) for a particular height for example.

 

I have tried various ideas, but cant quite seem to get the data to come up right. I will not claim to be an expert in PHP, but can usually figure simple things out myself and install mods with no problem.

 

I only ask if anyone out there has ever tried this before and if so, where is the discussion, or mod for it.

 

I will keep searching the forums until something comes up. This is my full time job and I am stuck on this one point, so I am very determined and dedicated.

 

Again, sorry for not coming across properly earlier.

 

Any help would be GREATLY appreciated.

:

Actually, even easier is if I can simply figure out how to set up the html link with the proper extension. Example: http://www.......advanced_search_result.ph...ds=11+inches....

 

If I can figure out how to get results from my p.products_height table entry using an html link like above, then I will write my own drop down menu using links. When I try the above code I get all entries with 11 inches, whether it be height, width, or even if the product number contains "11" in it. I cant figure out how to refine this search to include only "height".

 

And I keep getting the error "at least one of the fields in the search form must be entered" when I try anything else in the html link.

 

Troy

Link to comment
Share on other sites

I have installed the extra fields mod. It works great. But, how do I set up the advanced_search.php so that I can search by a single field only?

 

For example, I have a new field labeled "Height" and I want the customer to be able to search by height.

 

I want to have a drop down menu that shows 0-5 inches, 6-10 inches, 11-15 inches and so on.

 

anyone know how?

 

 

Does anyone know how to perform a search on custom fields without all possible matches from the whole database showing up? I spent the whole day yesterday pouring over my work to make sure I installed the mods correctly according to directions.

 

I did find out how to eliminate the error when none of the original search fields are entered. I will post the modification here, in case someone else can benefit from it one day:

 

In advanced_search.php near the top, change the following in red (modify to fit your needs)

 

if ( ((keywords == '') || (keywords.length < 1)) && ((dfrom == '') || (dfrom == '<?php echo DOB_FORMAT_STRING; ?>') || (dfrom.length < 1)) && ((dto == '') || (dto == '<?php echo DOB_FORMAT_STRING; ?>') || (dto.length < 1)) && ((pfrom == '') || (pfrom.length < 1)) && ((pto == '') || (pto.length < 1)) && ((height == '') || (height.length < 1)) ) {

error_message = error_message + "* <?php echo ERROR_AT_LEAST_ONE_INPUT; ?>\n";

error_field = document.advanced_search.keywords;

error_found = true;

}

 

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

 

In advanced_search_result.php also near the top, make the changes in red (modify to fit your needs)

 

if ( (isset($HTTP_GET_VARS['keywords']) && empty($HTTP_GET_VARS['keywords'])) &&

(isset($HTTP_GET_VARS['dfrom']) && (empty($HTTP_GET_VARS['dfrom']) || ($HTTP_GET_VARS['dfrom'] == DOB_FORMAT_STRING))) &&

(isset($HTTP_GET_VARS['dto']) && (empty($HTTP_GET_VARS['dto']) || ($HTTP_GET_VARS['dto'] == DOB_FORMAT_STRING))) &&

(isset($HTTP_GET_VARS['pfrom']) && !is_numeric($HTTP_GET_VARS['pfrom'])) &&

(isset($HTTP_GET_VARS['pto']) && !is_numeric($HTTP_GET_VARS['pto'])) &&

(isset($HTTP_GET_VARS['height']) && (empty($HTTP_GET_VARS['height'])) )

 

) {

$error = true;

 

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

 

In the above example, my new product attribute is "height". The database entry is under the "Products" table and labeled "products_height". But I just cant seem to find a way to sort only the height table.

 

Any ideas?

Link to comment
Share on other sites

Anybody??

 

I have been trying to get this to work for two whole weeks now full time. It is the only thing holding me back now.

 

During my reading of the forums, I have seen many people seeking related answers, but still waiting. If anyone would help me, I will be very happy to post my experiences and the fixes, if found to all those others.

Link to comment
Share on other sites

  • 2 months later...
Anybody?

 

I am still searching full time for some way to make this happen. I am sadly no php expert and have not yet had any success at making this work.

 

There is a contribution currently in development and release as an alpha version which is similar to what you're looking for.

 

Info can be found at the link below:

 

http://www.oscommerce.com/forums/index.php?showtopic=336920

Link to comment
Share on other sites

  • 10 years later...

Well...  I have what it seems a 100 yr old problem with advanced_search_results.php - posted the following - 2011:

$Id: advanced_search_result.php,v 1.72 2003/06/23

Advanced_search_results.php is such an odd document. The $select, $from and $where_str statements are separated in portions. I know that the issue lies solely in:

$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 ";
The above displays all slaves – which sometimes are over 20 slaves per master. See
http://scientiis.com/biotech/catalog/index.php

$where_str = " where p.products_status = '1' and p.products_master = '0' 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 ";

The above displays the master, but does not search the slaves. Searching for a slave model gives " There is no product that matches the search criteria."

Maybe if I could adapt somehow the following:
// Master Products
$master_prod = tep_db_query("select products_master, products_master_status
from " . TABLE_PRODUCTS . "
where products_id = '" . $products_master['products_id'] . "'");
$master_prod_values = tep_db_fetch_array($master_prod);
if (($master_prod_values['products_master_status'] == 0) && ($master_prod_values['products_master'] != 0)) {
$str_selected_values = $master_prod_values['
products_master'];
} else {
$str_selected_values = $products_master['products_id'];
}
Tried adapting the following, but received errors
if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
$where_str .= " and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
}
There is also this function in /includes/functions/general.php
// Master Products
function tep_get_products_master_status($product_id) {
$product_query = tep_db_query("select products_master_status from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
$product = tep_db_fetch_array($product_query);
return $product['products_master_status'];
}
// Master Products EOF

By the way, I'm not a programmer.
Thank you.
Celia Jarvis

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...