X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Include search by SKU into basic search in v4 (https://forum.x-cart.com/showthread.php?t=8664)

big pine kenny 01-09-2007 04:31 AM

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?

delsurf 01-15-2007 09:41 PM

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" />

jfilardo 03-26-2007 07:52 AM

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.

jeff819 03-27-2007 08:57 AM

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

MMANOR 05-17-2007 06:42 PM

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:

If you want to search by SKU from the main page of the store, you should modify the /customer/search.tpl template file eg. via Admin Zone -> 'Edit templates' section and add this code
---
<input type="hidden" name="posted_data[by_sku]" value="on">
---

just after this line:

---
<input type="hidden" name="posted_data[by_shortdescr]" value="Y" />
---

Also please add this code to the /include/search.php:

--
if (!empty($data["by_sku"])) {
if($current_area == 'C' || $current_area == 'P') {
$condition[] = "$sql_tbl[products].productcode LIKE '%".$data["substring"]."%'";
}
}
--

Eg. just after:

--
if (!empty($data["by_shortdescr"])) {
if($current_area == 'C' || $current_area == 'P') {
$condition[] = "IF($sql_tbl[products_lng].descr IS NOT NULL AND $sql_tbl[products_lng].descr != '', $sql_tbl[produ
} else {
$condition[] = "$sql_tbl[products].descr LIKE '%".$data["substring"]."%'";
}
}
--

After this everything should work fine.


shipmerchant 08-31-2007 01:05 PM

Re: Include search by SKU into basic search in v4
 
Quote:

Originally Posted by jedak
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.


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

MoonDog 09-01-2007 02:58 PM

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:


<input type="hidden" name="posted_data[by_sku]" value="Y" />


after this line of code:

Code:


<input type="hidden" name="posted_data[by_shortdescr]" value="Y" />


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:


{* $Id: search.tpl,v 1.9.2.1 2006/11/27 14:28:38 max Exp $ *}
<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_sku]" value="Y" />
<input type="hidden" name="posted_data[by_fulldescr]" value="Y" />
<input type="hidden" name="posted_data[including]" value="all" />
<table cellpadding="0" cellspacing="0"> 
<tr>
 <td class="TopLabel" style="padding-left: 20px; padding-right: 5px;">{$lng.lbl_search}:</td>
 <td valign="middle"><input type="text" name="posted_data[substring]" size="16" value="{$search_prefilled.substring|escape}" /></td>
 <td valign="middle" style="padding-left: 5px; padding-right: 20px;"><a href="javascript: document.productsearchform.submit();">{include file="buttons/search_head.tpl"}</a></td>
 <td><a href="search.php"><u>{$lng.lbl_advanced_search}</u></a></td>
</tr>
</table>
</form>


- MoonDog -

shipmerchant 09-01-2007 03:08 PM

Re: Include search by SKU into basic search in v4
 
MoonDog,

Thanks so much for you help!

It worked as expected!!!!

Regards.

Vacman 09-02-2007 09:43 AM

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 02:44 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.