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
  #21  
Old 01-11-2006, 12:29 PM
 
bdg bdg is offline
 

Member
  
Join Date: Nov 2005
Posts: 10
 

Default

Quote:
Originally Posted by sstillwell@aerostich.com
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"])) $condition[] = "$sql_tbl[products].fulldescr LIKE '%".$data["substring"]."%'";
Add:
Code:
if (!empty($data["by_productcode"])){ $condition[] = "$sql_tbl[products].productcode LIKE '%".$data["substring"]."%'"; if(!empty($active_modules['Product_Options'])) { $condition[] = "$sql_tbl[variants].productcode LIKE '%".$data["substring"]."%'"; } }

And all is peaceful in Xcart land once again

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?
Reply With Quote
  #22  
Old 01-15-2006, 08:42 PM
  davidsaldana's Avatar 
davidsaldana davidsaldana is offline
 

Senior Member
  
Join Date: Oct 2005
Posts: 187
 

Default

Anybody get this working for 4.016. The code is different than the original post.
__________________
4.4
Code:
Hello World
Reply With Quote
  #23  
Old 01-16-2006, 11:42 AM
 
vulcan-works vulcan-works is offline
 

Senior Member
  
Join Date: Feb 2004
Posts: 143
 

Default

For people using 4.0.16 and higher this works for me

In /include/search.php
Add:
Code:
if (!empty($data["by_productcode"])){ $condition[] = "$sql_tbl[products].productcode LIKE '%".$data["substring"]."%'"; if(!empty($active_modules['Product_Options'])) { $condition[] = "$sql_tbl[variants].productcode LIKE '%".$data["substring"]."%'"; } }

AFTER:
Code:
if (!empty($data["by_fulldescr"])) { if($current_area == 'C' || $current_area == 'P') { $condition[] = "IF($sql_tbl[products_lng].full_descr IS NOT NULL AND $sql_tbl[products_lng].full_descr != '', $sql_tbl[products_lng].full_descr, $sql_tbl[products].fulldescr) LIKE '%".$data["substring"]."%'"; } else { $condition[] = "$sql_tbl[products].fulldescr LIKE '%".$data["substring"]."%'"; } }

and do rest as in the other posts on here
__________________
X-cart--4.7.12

vulcanworks.net
Reply With Quote
  #24  
Old 01-24-2006, 08:41 PM
  jedak's Avatar 
jedak jedak is offline
 

Senior Member
  
Join Date: Apr 2005
Location: NY
Posts: 149
 

Default

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.
__________________
X-Cart pro v4.0.17
X-Cart pro v4.1.6
X-Cart pro v4.2
Reply With Quote
  #25  
Old 02-04-2006, 09:13 AM
 
Zak Zak is offline
 

Member
  
Join Date: May 2004
Posts: 18
 

Default

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...
__________________
Zak
Xcart Version 4.18
Reply With Quote
  #26  
Old 02-06-2006, 07:57 AM
 
manningbrothers manningbrothers is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 52
 

Default 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?
__________________
X-Cart version 4.3.2, 4.4.2, Windows OS
Reply With Quote
  #27  
Old 03-09-2006, 02:55 AM
 
Sheffield_Tiger Sheffield_Tiger is offline
 

Member
  
Join Date: Mar 2006
Posts: 10
 

Default Re: Search Variants in 4.0.10 Code

Quote:
Originally Posted by manningbrothers
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?

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:
Originally Posted by mffowler
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"])) {
change to:
Code:
if (empty($data["by_title"]) && empty($data["by_shortdescr"]) && empty($data["by_fulldescr"]) && empty($data["by_productcode"]) && empty($data["extra_fields"])) {
find
Code:
if (!empty($data["by_fulldescr"])) { if($current_area == 'C' || $current_area == 'P') { $condition[] = "IF($sql_tbl[products_lng].full_descr IS NOT NULL AND $sql_tbl[products_lng].full_descr != '', $sql_tbl[products_lng].full_descr, $sql_tbl[products].fulldescr) LIKE '%".$data["substring"]."%'"; } else { $condition[] = "$sql_tbl[products].fulldescr LIKE '%".$data["substring"]."%'"; } }
change to:
Code:
if (!empty($data["by_fulldescr"])) { if($current_area == 'C' || $current_area == 'P') { $condition[] = "IF($sql_tbl[products_lng].full_descr IS NOT NULL AND $sql_tbl[products_lng].full_descr != '', $sql_tbl[products_lng].full_descr, $sql_tbl[products].fulldescr) LIKE '%".$data["substring"]."%'"; if (!empty($data["by_productcode"])){ $condition[] = "$sql_tbl[products].productcode LIKE '%".$data["substring"]."%'"; if(!empty($active_modules['Product_Options'])) { $condition[] = "$sql_tbl[variants].productcode LIKE '%".$data["substring"]."%'"; } } } else { $condition[] = "$sql_tbl[products].fulldescr LIKE '%".$data["substring"]."%'"; } }

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

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!
__________________
Version 4.0.17
Reply With Quote
  #28  
Old 03-09-2006, 06:04 AM
 
manningbrothers manningbrothers is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 52
 

Default

thanks so much - i forgot i left this post up here and figured it out...have a great day
__________________
X-Cart version 4.3.2, 4.4.2, Windows OS
Reply With Quote
  #29  
Old 03-28-2006, 12:24 PM
 
chrisollar chrisollar is offline
 

Member
  
Join Date: Mar 2006
Location: waco, texas, usa
Posts: 20
 

Default version 4.0.18 gold sku search

Quote:
mffowler
include/search.php

find
Code:

if (empty($data["by_title"]) && empty($data["by_shortdescr"]) && empty($data["by_fulldescr"]) && empty($data["extra_fields"])) {

change to:
Code:

if (empty($data["by_title"]) && empty($data["by_shortdescr"]) && empty($data["by_fulldescr"]) && empty($data["by_productcode"]) && empty($data["extra_fields"])) {

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!
__________________
Shannon Williams for Chris Ollar
chrisollar@grandecom.net
x-cart gold 4.0.18
x-cart gold 4.1
LC v2.1
LC v2.2 beta 1
unix
Reply With Quote
  #30  
Old 12-01-2006, 04:07 AM
  chamberinternet's Avatar 
chamberinternet chamberinternet is offline
 

X-Wizard
  
Join Date: Sep 2005
Location: Lancashire, UK
Posts: 1,470
 

Default 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
__________________
Developing in 4.7.x now (Dipping into v5 - Slowly!)
Have used 4.1.x, 4.2.x, 4.4.x, 4.5.x, 4.6.x & 4.7.x
Multiple Instances of X-Cart
MySQL 5.6.37
CentOS 7.4


Chamber Internet
- Lancashire, United Kingdom
http://www.chamberelancs.co.uk
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 03:44 PM.

   

 
X-Cart forums © 2001-2020