11 posts by 2 authors in: Forums > CMS Builder
Last Post: February 26, 2008   (RSS)

By equinox - February 20, 2008 - edited: March 30, 2013

Hello Dave and Co,

Still learning your cool system.

Customer needs to have 2 search tools on the listings site that can go on ANY html page of the domain (not just the cms built php pages):

1) a search box. Client has listings for heavy equipment and they have around 1000 pieces of inventory that will be added to the database. Visitors need an easy way to search the inventory, from any page on the site and get results based on keywords and inventory types.

2) Pre-defined searches attached to buttons or text on the site. For example: having a button for " "Caterpillar" or "bulldozers" brings up search results for those items. (we can use the search box to generate the hyperlinks unless you have a better way). Again, these hyperlinks need to work from any page on the site and not just cms built php pages.

Thanks in advance!

Re: [equinox69] need search tool for CMS builder to search records for visitors

By Dave - February 21, 2008

For searching data in the CMS database, you can create a list viewer (search.php) for that and do searches by submitting a form or by direct linking to an url with keywords on the end. For example: search.php?category_type=truck

For more details on that, see this doc page:
http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html

Give that a try. If you get stuck, post the url to one of your list viewers, the fieldname you want to search, and the value you want to search for and I'll help you figure out the url for it.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] need search tool for CMS builder to search records for visitors

By equinox - February 22, 2008 - edited: March 30, 2013

Dave, with your instructions creating a field search is a snap...BUT there are about 30 fields that need to be searched and we don't want 30 search boxes -- just one box to search all fields in all records of the database. I tried to set up the field search to have multiple entries by comma separation, for example:

<form method="POST" action="http://www.customerdomainname.com/customList.php">
<input type="text" name="make_keyword,model_keyword,equipment_type_keyword,attachments_keyword" value="">
<input type="submit" name="submit" value="Search">
</form>

basically I put all the fields into this type of form but the search did not function properly. Part of the reason I'm sure is because the customList.php page only reveals about 5 fields for each record and all the appropriate fields don't appear except on the customPage.php. So I modified the search form to utilize only the fields listed on the customList.php page but the search feature did not work completely. Also, we NEED to be able to search all the fields.

SO, is there a way to use a viewer to query the MySQL database - all records and all fields and display the results of that search?

Re: [Dave] need search tool for CMS builder to search records for visitors

By equinox - February 23, 2008 - edited: March 30, 2013

Dave,

That makes a difference IF I only want to search among the live (displaying) fields from the customList.php page. What is needed is the ability to search all the available fields for a record - which probably is best by searching the MySQL database directly isn't it? We can't set the search to check the customPage.php pages because those pages are defined after viewing the customList.php pages.

This can't be the first time this question has come up has it? A single search box performing an aggregate search function through all available fields should be a fairly common request - or am I messed up in the head for thinking that?

Thanks again in advance.

Re: [equinox69] need search tool for CMS builder to search records for visitors

By Dave - February 23, 2008

Sorry, I don't think I mentioned that before.

You can search fields even if they're not displayed. So just add the extra fields you want to search. The only thing that can't be searched is upload fields. That would require some custom PHP/MySQL.

What it actually does is turn your request into a MySQL query and search the database. So if you have viewer.php?field1,field2=red it creates a query like this:

SELECT * FROM yourTableName WHERE (field1 = 'red' OR field2 = 'red')

And then it loads ALL the available fields for each record. Even if you don't have a PHP tag that displays them.

Try adding some extra fields to your field list and see if that does what you need.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] need search tool for CMS builder to search records for visitors

By equinox - February 23, 2008 - edited: March 30, 2013

Dave,

Here's the code I added for a searchbox and only some of the searches function properly. The photo field is the only upload field and I did not include it. I "suspect" the year field might me screwing up the results because it's a different type search?

<form method="POST" action="http://www.domainname.com/customList.php">
<input type="text" name="title,year,make,model,price,stock_number,description,color,overall_condition,miles,hours,vin,serial,gvw,engine_type,fuel_type_gas,fuel_type_diesel,fuel_type_propane,speed,cylinders,air_conditioning,rearend,undercarriage_percentage,brakes_hydraulic,brakes_air_brakes,transmission_standard,transmission_automatic,transmission_speed,two_speed_rearend,tracks,tire_size,tire_condition_front,tire_condition_rear,bed,bed_type,bed_size,bed_condition_excellent,bed_condition_good,bed_condition_fair,boom,blade,bucket_size,lift_height,additional_comments,location,equipment_type,attachments_keyword" value="">
<input type="submit" name="submit" value="Search">
</form>

Here's the url that the search box is on for testing:

http://www.customersitenamet.com/search.php

Thanks for your help.!

Re: [equinox69] need search tool for CMS builder to search records for visitors

By Dave - February 23, 2008

Terry,

Can you give me some examples of searches that aren't working properly?

You could also consider a more advanced search page for that lets people specify year range, price range, etc.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] need search tool for CMS builder to search records for visitors

By equinox - February 23, 2008 - edited: March 30, 2013

Dave,

1) did you want to shoot me now or wait until later? I SWEAR on my dead aunt's grave that multiple tests late last night that the year, price and at least one other category resulted with "no records found" - but apparently the mere presence of whining to you automatically corrects such errors. ;-)

2) yes, I would like to offer some additional search parameters with a different search box - where the client can give parameters. I need to set up specific parameter boxes with MySQL commands, correct?

3) will the search boxes function on .shtml pages or must the pages be .php?

Re: [equinox69] need search tool for CMS builder to search records for visitors

By Dave - February 25, 2008

Hi Terry,

1) I'll save my shooting credit for later. ;)

2) No MySQL. I know MySQL quite well and even I don't bother with it unless I have too. Just create more search fields on your page like: price_min, price_max, year_min, etc. See the docs page here for more details:

http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html

The programs converts those into MySQL behind the scenes. You can write MySQL if you want (you add it to the 'where' option)... but, usually can be avoided.

3) Yes, so long as they don't have any PHP tags in them they'll function on any page since they're not displaying anything. They're only _submitting_ data to the PHP tag (as specified in the <form action="yourViewer.php">.

Hope that makes sense. Let me know if I can provide more detail.
Dave Edis - Senior Developer
interactivetools.com