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
  #11  
Old 12-24-2004, 07:29 AM
 
roblen roblen is offline
 

Senior Member
  
Join Date: Oct 2004
Posts: 114
 

Default 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?
__________________
X-Cart version 4.1.9
PHP 5.2.13 Details >>
GD bundled (2.0.34 compatible)
MySQL server 5.0.77-log
MySQL client 5.0.77
Web server Apache/2.2
Operation system Linux
Perl not found
XML parser (expat) found
Reply With Quote
  #12  
Old 01-12-2005, 06:20 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default 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"])) {
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
__________________
4.1.9
Reply With Quote
  #13  
Old 04-26-2005, 12:01 PM
 
SkullHead SkullHead is offline
 

Advanced Member
  
Join Date: Apr 2005
Posts: 30
 

Default

mffowler


I typed in the numbers of the sku but not the letters "sku" and it worked great!
__________________
4.0.17
PHP 4.4.7
Apache
MySQL server 5.0.51a-log
MySQL client 4.1.11
Web server Apache
Operation system Linux
Perl 5.008008
Reply With Quote
  #14  
Old 05-09-2005, 12:57 PM
 
ReubenJLau ReubenJLau is offline
 

Member
  
Join Date: Apr 2005
Posts: 27
 

Default

Great mod! works for me! (see version below)
__________________
X-Cart Gold v4.0.13
Reply With Quote
  #15  
Old 05-12-2005, 09:39 AM
 
Billgray Billgray is offline
 

Member
  
Join Date: May 2005
Location: UK
Posts: 11
 

Default 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
__________________
XCART
Used
Reply With Quote
  #16  
Old 05-13-2005, 06:36 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default Re: Tried and failed to do this.

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

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
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #17  
Old 09-19-2005, 04:14 PM
 
dannyrus dannyrus is offline
 

Member
  
Join Date: Sep 2005
Posts: 18
 

Default

Great Mod, took 5 minutes if that... Thanks alot for posting it!!
__________________
Danny - Photoscope Б─╒ X-Cart Version 4.0.14
Reply With Quote
  #18  
Old 11-01-2005, 03:51 PM
 
Mr Bob Mr Bob is offline
 

Senior Member
  
Join Date: Jul 2005
Posts: 199
 

Default

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.
__________________
Product: X-Cart Gold
Current version: 4.0.14

Additional Mods: X-Affiliate
Reply With Quote
  #19  
Old 11-05-2005, 04:00 PM
 
Mr Bob Mr Bob is offline
 

Senior Member
  
Join Date: Jul 2005
Posts: 199
 

Default

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" />
__________________
Product: X-Cart Gold
Current version: 4.0.14

Additional Mods: X-Affiliate
Reply With Quote
  #20  
Old 12-12-2005, 11:25 AM
 
chyldofsun chyldofsun is offline
 

eXpert
  
Join Date: Jan 2003
Location: Sunny Southern California
Posts: 292
 

Default 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!
__________________
X-Cart Version 4.4.3

In the USA: 1-818-332-7931
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 04:58 PM.

   

 
X-Cart forums © 2001-2020