Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Include search by SKU into basic search in v4

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #31  
Old 01-09-2007, 04:31 AM
  big pine kenny's Avatar 
big pine kenny big pine kenny is offline
 

Advanced Member
  
Join Date: Nov 2006
Location: Florida Keys
Posts: 84
 

Default 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?
__________________
X-Cart Gold v5.3 [unix]
http://tools-rvsupplies.com
Reply With Quote
  #32  
Old 01-15-2007, 09:41 PM
 
delsurf delsurf is offline
 

Advanced Member
  
Join Date: Feb 2004
Posts: 32
 

Default 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" />
__________________
1) x-cart 4.1.5, Unix
Reply With Quote
  #33  
Old 03-26-2007, 07:52 AM
 
jfilardo jfilardo is offline
 

Advanced Member
  
Join Date: Jul 2005
Posts: 50
 

Default 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.
__________________
www.coopersport.com
North America's Premiere MINI Outfitter

X-Cart Gold v4.0.19 [Apache/Linux]
Reply With Quote
  #34  
Old 03-27-2007, 08:57 AM
 
jeff819 jeff819 is offline
 

Advanced Member
  
Join Date: May 2006
Posts: 42
 

Default 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
__________________
X-Cart Gold - Version 4.0.19
Reply With Quote
  #35  
Old 05-17-2007, 06:42 PM
 
MMANOR MMANOR is offline
 

Member
  
Join Date: Feb 2007
Posts: 28
 

Default 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.
__________________
x-cart-4.1.8gold
Reply With Quote
  #36  
Old 08-31-2007, 01:05 PM
  shipmerchant's Avatar 
shipmerchant shipmerchant is offline
 

eXpert
  
Join Date: Mar 2005
Posts: 361
 

Default 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
__________________
Mil Mascaras
Live Xcart Site #1-V- 4.1.8
Live Xcart site # 2-V 4.4.3
CDSEO Mod - Firetank MM30 - 7DANA- The bestTemplates!
Linux - EWD Host Servers awesome service!
AlteredCart One Page Checkout
Reply With Quote
  #37  
Old 09-01-2007, 02:58 PM
 
MoonDog MoonDog is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 93
 

Default 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 -
__________________
X-CART Gold v4.1.8
Reply With Quote
  #38  
Old 09-01-2007, 03:08 PM
  shipmerchant's Avatar 
shipmerchant shipmerchant is offline
 

eXpert
  
Join Date: Mar 2005
Posts: 361
 

Thumbs up Re: Include search by SKU into basic search in v4

MoonDog,

Thanks so much for you help!

It worked as expected!!!!

Regards.
__________________
Mil Mascaras
Live Xcart Site #1-V- 4.1.8
Live Xcart site # 2-V 4.4.3
CDSEO Mod - Firetank MM30 - 7DANA- The bestTemplates!
Linux - EWD Host Servers awesome service!
AlteredCart One Page Checkout
Reply With Quote
  #39  
Old 09-02-2007, 09:43 AM
  Vacman's Avatar 
Vacman Vacman is offline
 

X-Adept
  
Join Date: Sep 2005
Location: Torrance, CA
Posts: 792
 

Default 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.
__________________
Carl Tice

X-Cart 4.6.6
X-Payments 3.0
ReBOOT 3.4.1

PHP 5.6.30
MySQL 5.6.35
Linux 2.6.32-042stab120.18
ionCube PHP Loader v4.7.3
Perl 5.10.1
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:27 AM.

   

 
X-Cart forums © 2001-2020