|
|
#1 |
|
Member
Join Date: Dec 2006
Posts: 96
Rep Power: 11 ![]() |
Hi all
I am trying to manipulate the sarchresult.php page to get the desired search result. What I want to do is to be able to search the category names from the search page. I believe I have added the possebility to do this by the sql statement underneath, but it gives me no searchresult as I search for a category name. Can anyone give me a hint about what's wrong here: Code:
//now setup the search query
$select = $modules->call_hook('searchlistings_select', ''); // Call any module functions
$sSQL="SELECT " .
"p.id, c.name AS category, p.owner, p.title, p.featured, p.section, p.shortDescription, p.display, " .
"p.description, p.price, p.dateadded, p.expiration, p.pBold, p.pHighlighted, " .
"u.state, u.city, u.country,u.phone " . $select .
"FROM ".PREFIX."products AS p ".$addSQL." " .
"LEFT JOIN ".PREFIX."users AS u " .
"ON p.owner = u.id " .
"LEFT JOIN ".PREFIX."categories AS c " .
"ON p.section = c.id " .
"WHERE p.expiration > NOW() AND p.display = 'Y' ";
$sSQL .= ( empty($arr_childs) ) ? '': " AND p.section IN (". implode(', ', $arr_childs) .")";
$sSQL .= ( empty($_REQUEST['phone']) ) ? '': " AND u.phone LIKE '%".safeAddSlashes($_REQUEST['phone'])."%'";
$sSQL .= ( empty($_REQUEST['adid']) ) ? '': " AND p.id = ".(int)$_REQUEST['adid'];
$sSQL .= ( empty($_REQUEST['state']) ) ? '': " AND u.state LIKE '%".safeAddSlashes($_REQUEST['state'])."%'";
$sSQL .= ( empty($_REQUEST['city']) ) ? '': " AND u.city LIKE '%".safeAddSlashes($_REQUEST['city'])."%'";
$sSQL .= ( empty($_REQUEST['country']) ) ? '': " AND u.country LIKE '%".safeAddSlashes($_REQUEST['country'])."%'";
$sSQL .= ( empty($_REQUEST['owner']) ) ? '': " AND p.owner = ".(int)$_REQUEST['owner'];
$sSQL .= ( empty($_REQUEST['searchtext']) ) ? '': " AND (p.title LIKE '%".safeAddSlashes($_REQUEST['searchtext'])."%' OR p.shortDescription LIKE '%".safeAddSlashes($_REQUEST['searchtext'])."%' OR p.description LIKE '%".safeAddSlashes($_REQUEST['searchtext'])."%' OR c.name LIKE '%".safeAddSlashes($_REQUEST['searchtext'])."%')";
$sSQL .= $modules->call_hook('searchquery_where', ''); // Call any module functions
This shoul in theori work, but mayby my sql knowledge is to poor. Thank you Regards Oyvind
__________________
objelland V3.1.5b Developer |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Mar 2006
Posts: 4,109
Rep Power: 100 ![]() ![]() |
I dont really understand what it is your trying to accomplish so cant really give a hint as to whats wrong. However, one thing that you may find helpfull when doing query stuff is to test the query your trying to build by using known values at the mysql command line or via phpmyadmin to make sure the query even works.
Once you build a query you know works, then I would insert an echo statement into the script after the query is built so you can see how its being built by the script with your variables. Keep in mind this may make your pages a bit ugly until you get ride of the echo statement but it can be a big help during development.
__________________
Larry. (Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free) Set your site apart from the competition with one of my modules...... Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module 68 Classifieds Important Links Customer Area | Issue Tracker | Knowledge Base | User Manuals |
|
|
|
|
|
#3 |
|
Member
Join Date: Dec 2006
Posts: 96
Rep Power: 11 ![]() |
Hi
Thanks for your reply. What I am trying to do is this: I would like to be able to change the checkout process. In stead of seeing the categories listed, I would like to be able to search for them. All my categories will be zip codes. Each category will contain sub categories that are the Street names belonging to the zip code (parent category.). The search result of the category search should be every sub category belonging to a parent category Oyvind
__________________
objelland V3.1.5b Developer |
|
|
|
|
|
#4 |
|
The Master
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 44 ![]() ![]() |
Ok, I havent had a chance to look at this properly but what from what I can see you are editing the totally wrong search script.
I wouldnt try editing the search script as you are going to play havoc with the rest of your script. I would simply have a textbox and when submitted it searches and hopefully finds your post code. Or even I would only have one great big category and simply use thepostcode that the user registered with.
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers. |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jul 2007
Posts: 112
Rep Power: 10 ![]() |
This is similar to what I am trying to achieve.
I think even better would be for it to search not just the category name but the "keywords" associated with it, as setup when making the category. So if a user searches for a word, and that word is within either the category/sub category name OR the search keywords associated with it, a link to that category would appear above the usual search results. I understand that "keywords" as setup when making the category are meta keywords, but it would be a very nice feature for the site search to include these words...somehow. What I would be trying to achieve would be to make allowances for for sellers who do not place their ad correctly. For example if they do not include words in their title or description that buyers might use in their search, search will still provide links to the categories that contain words set for the category that they placed their listing in. To clarify, say you have a category with the name "Wheels", a seller places an ad in that category, but does not use the word "wheel" in their ad. A buyer comes along and searches for "wheels" and does not find it. Sure, they can search or browse the "wheels" category, but in my case I have a huge amount of categories, and selecting a category in search can be cumbersome. Thanks
__________________
Greg Version 3.1.9 and 4.0.3 Developer |
|
|
|
|
|
#6 |
|
Member
Join Date: Dec 2006
Posts: 96
Rep Power: 11 ![]() |
Thank you Greg, finally someone that understands what I am trying to say. Have you had any luck with this?
Have you tried any of the developers to get this done? Regards Oyvind
__________________
objelland V3.1.5b Developer |
|
|
|
|
|
#7 |
|
The Master
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 44 ![]() ![]() |
I fully understand what you are trying to do but are trying to place a search function in the checkout page.
All you have to do is have a text input and a submit button. When the search is entered it searches the category table and pulls out any similar postcodes. For me though, I dont think I would set it up like that. I would write in a module to deal specifically with postcodes and leave the categories alone incase one day you decide that your products do actually need categorising.
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers. |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Jul 2007
Posts: 112
Rep Power: 10 ![]() |
No, I haven't asked for this to be done, but I think it would improve the efficiency of search an enormous amount.
Thinking about more, IF it could be done using ONLY the "keywords", as setup when making a category, this would provide a huge amount of flexibility to the process. Using category names can be ambiguous, using just the keywords would be very efficient and flexible. You could include any terms that users may search for looking for a product within any given category. Ideally, I think it should work like this: When a user searches for a word that is contained within the "keywords" of any category, a link to that category is provided alongside/above/somewhere, with the usual search results showing normally. Text with these links could say something like "Related Categories" or something like that. I can see it now "Maffo's Super Search Mod"...come of Maff, get to work man! ![]() I would contribute to the development costs if anyone is interested assuming its possible. Cheers
__________________
Greg Version 3.1.9 and 4.0.3 Developer Last edited by Greg H; 12-17-2007 at 07:54 PM. |
|
|
|
|
|
#9 |
|
The Master
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 44 ![]() ![]() |
The two of you would need to spell it out exactly what happens, word for word what you want the customer to see and when. Does this apply to searches or to the checkout, things like that.
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers. |
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Jul 2007
Posts: 112
Rep Power: 10 ![]() |
Well I was talking about the search function only.
As far as function goes, as I said said in my previous post... When a user searches for a word that is contained within the "keywords" of any category, a link to that category is provided alongside/above/somewhere, with the usual search results showing normally. Text with these links could say something like "Related Categories" or something like that. Cheers
__________________
Greg Version 3.1.9 and 4.0.3 Developer |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Search Page Problem. URGENT!!! | Pierce | v3.1 Questions & Support | 2 | 10-02-2007 02:12 PM |
| Each AD as a Search Result? | garysr | v3.1 Questions & Support | 6 | 11-06-2006 03:46 AM |
| Aligning the "zip code," etc. search fields | spaceboy | v3.1 Modules & Modifications | 5 | 09-09-2006 02:27 PM |
| Drop Down Search Issue | CB | v3.1 Questions & Support | 2 | 06-23-2006 12:04 AM |
| Advanced Search Template | sporthorsebreeder | HTML, CSS, and Design Help | 6 | 04-05-2006 04:25 PM |