![]() |
Include search by SKU into basic search in v4
Hi there,
v4 has some nice features and some not-finished business. Why would x-men include search by SKU/product code in advanced search when this is one of the main search fields people are looking for rpoducts in a lot of industries (auto, computers and etc? Here is the simple mod to search by sku from the main search box: search.php change: Code:
if (empty($data["by_title"]) && empty($data["by_shortdescr"]) && empty($data["by_fulldescr"]) && empty($data["extra_fields"])) { to Code:
if (empty($data["by_title"]) && empty($data["by_shortdescr"]) && empty($data["by_fulldescr"]) && empty($data["by_productcode"]) && empty($data["extra_fields"])) { after Code:
if (!empty($data["by_fulldescr"])) add Code:
if (!empty($data["by_productcode"])) skin1/customer/search.tpl after Code:
<INPUT type="hidden" name="posted_data[by_fulldescr]" value="Y"> add Code:
<INPUT type="hidden" name="posted_data[by_productcode]" value="Y"> skin1/customer/main/search_result.tpl after Code:
<TD width="5"><INPUT type="checkbox" name="posted_data[by_fulldescr]"{if $search_prefilled eq "" or $search_prefilled.by_fulldescr} checked{/if}></TD><TD nowrap>{$lng.lbl_det_description}</TD> add Code:
<TD width="5"><INPUT type="checkbox" name="posted_data[by_productcode]"{if $search_prefilled eq "" or $search_prefilled.by_productcode} checked{/if}></TD><TD nowrap>{$lng.lbl_sku}</TD> Enjoy :wink: |
Anyone used this on version 3.5._?
|
Quote:
It's completely different in v3.5. I believe there is a solution on this forum to do the same in v3.5. Check: http://forum.x-cart.com/viewtopic.php?t=5971 |
Thanks. I found a fix for this that Boomer had posted. Works great!
|
Is it possible to have TWO boxes on the main page? Search ProdID and Search SKU ??
|
I don't seem to find search.php in /customer? It is in the root directory and /includes, but different than this example.
Can you point me in the right direction, so that SKU can come up in the search and advanced? Thanks, Mike |
thanks for the mod :) worked perfectly 8)
|
Quote:
yeh use the one in includes ;) |
This is a great mod!!!!
Xcart should take note and realize this should be standard operating procedure. The mod does lack one thing. It will not bring up "variant skus" When using product variants, those skus don't work. No fear, I have an adjustment for the original poster. include/search.php After: Code:
if (!empty($data["by_fulldescr"])) Code:
if (!empty($data["by_productcode"])){ And all is peaceful in Xcart land once again ;) |
Fantastic mod, thank you =D>
|
This works
I have been using this mod with great success. I found that if user searches for sku in advanced search no result is found. could advance search use diff. page?
|
Search Variants in 4.0.10 Code
This is a great mod. I just changed the code to work with 4.0.10. include/search.php now finds variants in a search. Can someone check this to see if it's correct? It does work for me:
include/search.php find Code:
if (empty($data["by_title"]) && empty($data["by_shortdescr"]) && empty($data["by_fulldescr"]) && empty($data["extra_fields"])) { Code:
if (empty($data["by_title"]) && empty($data["by_shortdescr"]) && empty($data["by_fulldescr"]) && empty($data["by_productcode"]) && empty($data["extra_fields"])) { Code:
if (!empty($data["by_fulldescr"])) { Code:
if (!empty($data["by_fulldescr"])) { I don't know PHP and wouldn't even call myself a developer. Just a lowly store owner who wants a "search" that works. Can anyone out there tell me if this is correct or what should be modified? It works fine for me and finds variants in a search, but it was trial and error as the original and subsequent code on this post weren't compatible w/ 4.0.10 - categories didn't show up in search (admin). If you use this, be sure to backup - I only said it works for me, but maybe it could be checked by someone? Thanks, Mike |
mffowler
I typed in the numbers of the sku but not the letters "sku" and it worked great! :D |
Great mod! works for me! (see version below)
|
Tried and failed to do this.
I am one of those who would rather buy a mod. I not a programmer and dont want to be, I run a business and I am short on time, can anyone recommend a mod that searches by sku, I have 20000 products and on our website xcart 4.13 and the search is crap.
Recommendations please. I think this cart is great and simple. Got 20,000 products and 7,000 cats and only being using it for 4 days. MOD IN SEARCH PLEASE. Or if someone wants to write one even better let me know the cost. Bill Gray |
Re: Tried and failed to do this.
Quote:
The notes here will help you do this or if you need it done for you then hire someone to go under the hood and do the coding |
Great Mod, took 5 minutes if that... Thanks alot for posting it!!
|
I implemented the mod, as well as the changes in the replies (to work for all SKUs, including variants), and it doesn't show any results for any product SKUs.
I am running the version is my sig. |
Seems like all you have to do is add the input box to the search form.
Code:
<INPUT type="hidden" name="posted_data[by_productcode]" value="Y" /> |
Re: Include search by SKU into basic search in v4
[quote="27stars"]Hi there,
v4 has some nice features and some not-finished business. Why would x-men include search by SKU/product code in advanced search when this is one of the main search fields people are looking for rpoducts in a lot of industries (auto, computers and etc? Here is the simple mod to search by sku from the main search box: search.php change: Code:
if (empty($data["by_title"]) && empty($data["by_shortdescr"]) && empty($data["by_fulldescr"]) && empty($data["extra_fields"])) { to Code:
if (empty($data["by_title"]) && empty($data["by_shortdescr"]) && empty($data["by_fulldescr"]) && empty($data["by_productcode"]) && empty($data["extra_fields"])) { I have version 4.0.17 and the search.php code is different. Is ther an update to this mod? Here is my code: # # $Id: search.php,v 1.2.2.3 2005/01/14 12:07:30 max Exp $ # require "./auth.php"; define("GET_ALL_CATEGORIES", true); require $xcart_dir."/include/categories.php"; if($active_modules["Manufacturers"]) include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php"; $tmp=strstr($QUERY_STRING, "$XCART_SESSION_NAME="); if (!empty($tmp)) $QUERY_STRING=ereg_replace("$XCART_SESSION_NAME=([0-9a-zA-Z]*)", "", $QUERY_STRING); if(!empty($active_modules['SnS_connector']) && $REQUEST_METHOD == 'POST') { if($simple_search == 'Y') { func_generate_sns_action("SiteSearch"); } else { func_generate_sns_action("AdvancedSearch"); } } x_session_register("search_data"); $search_data["products"]["forsale"] = "Y"; include $xcart_dir."/include/search.php"; if (!empty($QUERY_STRING)) { $location[] = array(func_get_langvar_by_name("lbl_search_results "), ""); $smarty->assign("main","search"); } else { $location[] = array(func_get_langvar_by_name("lbl_advanced_searc h"), ""); $smarty->assign("main","advanced_search"); } # Assign the current location line $smarty->assign("location", $location); func_display("customer/home.tpl",$smarty); ?> Thanks! |
Quote:
Nice work! I've tried your version as well as the original up top but I can't seem to find any difference in functionality? Clue? |
Anybody get this working for 4.016. The code is different than the original post.
|
For people using 4.0.16 and higher this works for me
In /include/search.php Add: Code:
if (!empty($data["by_productcode"])){ AFTER: Code:
if (!empty($data["by_fulldescr"])) { and do rest as in the other posts on here :) |
Great mod. Thanks, but I 'm having one problem for some reason the sku check box isn't checked by default. So customer have to enter the SKU then after no results are found then they can check the SKU checkbox and searh again to get the product. Any help would be appreciated.
|
I ran into the same problem on a version 4.11 with the sku box having to be checked after returning no results. I finally figured out that you have to edit the product search form to include the sku input.
Open skin1/customer/search.tpl and find: <FORM method="POST" action="search.php" name="productsearchform"> <INPUT type="hidden" name="simple_search" value="Y"> <INPUT type="hidden" name="mode" value="search"> <INPUT type="hidden" name="posted_data[by_title]" value="Y"> <INPUT type="hidden" name="posted_data[by_shortdescr]" value="Y"> <INPUT type="hidden" name="posted_data[by_fulldescr]" value="Y"> And add: <INPUT type="hidden" name="posted_data[by_productcode]" value="Y"> Hope this helps... |
I am not seeing Product.php or include/
Can someone help - Im trying to track down the locations of these files but do not see Product.php or a directory called include...is this the name of the main directory or is it found for instance in the Customer menu?
|
Re: Search Variants in 4.0.10 Code
Quote:
Are you looking in the X-cart webmaster mode, or accesing your site through your ftp client? The include directory is in the root of your x-cart installation.. so http://www.mysite.com/include -or- http://www.mysite.com/store/include depending on how and where you chose to install the X-Cart files Quote:
Thanks Mike. After playing around with a few of the suggested changes, and climbing the walls from frustration at the poor X-Cart search (after only using it for 2 days), this did the trick. Spot on! |
thanks so much - i forgot i left this post up here and figured it out...have a great day
|
version 4.0.18 gold sku search
Quote:
Was able to find and use this code (using ftp) but not find the second half of any of the other codes posted. I was able to make the skin mod but never shows up. (I figure that it won't show without other necessary changes.) We have over 30,000 products and our client wants to be able to search by sku. The only thing that happens in search is when we search by generic "calendar" or "post its" etc. not by SKU. Please help a frustrated user! Thanks! |
Re: Include search by SKU into basic search in v4
This is now supported within v4.1.x ... i didnt need to make any modifications to the php code...
It even searches the Product Variant SKU's too. Regards Shafiq :sK |
Re: Include search by SKU into basic search in v4
I have version 4.1.4 and I type in sku # and it says no product found and takes me to advanced menu and I can check sku and it will bring it up. Is there anyway to do that with out the extra steps?
|
Re: Include search by SKU into basic search in v4
In 4.1.x just place the following in /skin1/customer/search.tpl
<input type="hidden" name="posted_data[by_sku]" value="Y" /> |
Re: Include search by SKU into basic search in v4
Would it be possible for someone to consolidate the code changes necessary in each of the files and templates into one reply. I'm getting very confused trying to figure out what needs to changed in which template to make this mod work in 4.0.19
I would like to be able to add the ability to search the sku/productcode, as well as any 'Extra Fields' in the Product Details page that have been set to show. Thanks for any help. J. |
Re: Include search by SKU into basic search in v4
I would also like to have the necessary code changes posted into one reply. I have tried different pieces of code throughout this post, but I am still unable to search by SKU in version 4.0.
Thanks, Jeff |
Re: Include search by SKU into basic search in v4
Hey All,
I have asked a lot of questions, but never have been able to offer any advice. Well now I have a chance too. For those that have version 4.0.19, I was able to get the solution on how to have the main page search also search by sku. You weren't able to do this before, I through extensive searching I was unable to find the answer in the forums. So I spent 25 points (of the 200 we get) and was able to get the fix. It is: Quote:
|
Re: Include search by SKU into basic search in v4
Quote:
Hi, Has anyone been able to get this to work on V4.1.8 site? I would appreciate it greatly, dont know why this kind of stuff does not come as a standard. Regards |
Re: Include search by SKU into basic search in v4
shipmerchant,
In v4.1.8 all you have to do is go to your skin1/customer/search.tpl file and add the following code: Code:
after this line of code: Code:
and that's it. You can now do a basic search of SKU numbers and the SKU checkbox is also checked. Or you can just replace your search.tpl code with the one below (the added line of code is in blue): Code:
- MoonDog - |
Re: Include search by SKU into basic search in v4
MoonDog,
Thanks so much for you help! It worked as expected!!!! Regards. |
Re: Include search by SKU into basic search in v4
You folks might also want to check out the Smart Search mod. This add-on is absolutely the best search engine mod for XCart I have found yet.
Automatically do the following to each search query [except advanced searches]. Enable Similar Search Phrases (Other close search terms and AutoCorrect words are displayed at the bottom of each search). Enable the Did You Mean feature to display close matching queries when there are no results. Enable Query Expansion when there are less than five results of full-text searches (Similar Search Terms). Include singular and plural forms of each word in the search query. Combine words - example: Mc Donald will also search for McDonald. (This can be resource intensive.) Tag Cloud - Displays a visual design of the most popular words found in the description(s) of the search results. Just search for Smart Search in the forums. |
All times are GMT -8. The time now is 01:06 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.