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)
-   -   Improved Search Function (https://forum.x-cart.com/showthread.php?t=4415)

chilll33 04-07-2005 07:26 AM

I've been using this with 4.0.13 for the past couple weeks, works great, x-cart should really use this mod as their standard search.

swordmart 04-08-2005 09:10 AM

Search SKU's?
 
Hi, thx for the mod guys! I have another issue,I've been reading all over the forum, and Im stuck. Is there a way to make this mod, search the SKU without it being an option.

Cheers Jamie

sstillwell@aerostich.com 04-08-2005 11:22 AM

Re: Search SKU's?
 
Quote:

Originally Posted by swordmart
Hi, thx for the mod guys! I have another issue,I've been reading all over the forum, and Im stuck. Is there a way to make this mod, search the SKU without it being an option.

Cheers Jamie


Yes there is, try this thread.
http://forum.x-cart.com/viewtopic.php?t=11930&highlight=simple+search+sku

Alltribes 04-08-2005 11:29 AM

After failing to modify this mod to use the newest search.php, I went back to bluecat's file, added the lines to search by sku in the above thread, and it works great on 4.0.12.

*edit* I found an error, 2 actualy.

For one, the categories no longer showed up in advanced search, and the page loaded really wide, then fit the page as it loaded (IE only). The second error I had happen before with all my pages, so I think that's probably related to some of my custom mods, probably my 4 column layout.

After taking out the search by sku code, both errors still exitst, but the only one I'm worried about is the categories not showing up.

swordmart 04-08-2005 11:35 PM

Thx
 
Thanks So much, just what i needed!

Jerrad 04-09-2005 06:16 AM

I'm having the same problem as Alltribes, the categories are missing in the advanced search.
But the page layout is unchanged, though I'm also using 4 columns.

Alltribes 04-11-2005 10:10 AM

I think I have it. This includes the search by sku mod. This is for 4.0.12, but should work with later versions. I am still testing it, but the categories show up and the wierd stretching bug I had is gone :)

Code:

$ss = split(" ",$data["substring"]);
    $ss_condition = "";
    foreach($ss as $s)
    {
                # Search for substring in some fields...
                $condition = array();
                if (!empty($data["by_title"])) {
                        if($current_area == 'C' || $current_area == 'P') {
                                $condition[] = "IF($sql_tbl[products_lng].product IS NOT NULL AND $sql_tbl[products_lng].product != '', $sql_tbl[products_lng].product, $sql_tbl[products].product) LIKE '%".$s."%'";
                        } else {
                                $condition[] = "$sql_tbl[products].product LIKE '%".$s."%'";
                        }
                }
               
                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[products_lng].descr,  $sql_tbl[products].descr) LIKE '%".$s."%'";
                        } else {
                                $condition[] = "$sql_tbl[products].descr LIKE '%".$s."%'";
                        }
                }

                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 '%".$s."%'";
                        } else {
                                $condition[] = "$sql_tbl[products].fulldescr LIKE '%".$s."%'";
                        }
                }
               
                if (!empty($data["by_productcode"])) {
                        if($current_area == 'C' || $current_area == 'P') {
                                $condition[] = "IF($sql_tbl[products].productcode IS NOT NULL AND $sql_tbl[products].productcode != '', $sql_tbl[products].productcode, $sql_tbl[products].productcode) LIKE '%".$s."%'";
                        } else {
        $condition[] = "$sql_tbl[products].productcode LIKE '%".$s."%'";
                        }
                }
               
                if (!empty($data["extra_fields"]) && $active_modules['Extra_Fields']) {
                        foreach($data["extra_fields"] as $k => $v)
                                $condition[] = "($sql_tbl[extra_field_values].value LIKE '%".$s."%' AND $sql_tbl[extra_fields].fieldid = '$k')";
                        $join['extra_field_values'] = "$sql_tbl[products].productid = $sql_tbl[extra_field_values].productid";
                        $join['extra_fields'] = "$sql_tbl[extra_field_values].fieldid = $sql_tbl[extra_fields].fieldid AND $sql_tbl[extra_fields].active = 'Y'";
                }
                if (!empty($condition))
                        $ss_condition .= " AND (".implode(" OR ", $condition).")";
    }
  $search_condition .= $ss_condition;
                # Search statistics


Mind you this is a mkod to the 4.0.12 code, not the code posted previously.

chetlucas 04-19-2005 02:23 PM

Search by SKU, Product or Whatever
 
I have looked, tried and failed on everything I have found regarding improved search functions. The only version that worked for me was in 3.5.3 and it worked well. I want the same thing in 4.0.11. I want to be able to search from the main search bar for sku, product or whatever I type in and search for. If I type in Black Cows, I want to be able to find "black cow", or cows that are black or something like that. You get the idea. Unicorns and find unicorn without having to type it in singular phrase (cow, unicorn, etc). Persons searching usually always use plural phrases. If I knew where to put the coding for truncating the plural phrases, then I would do it. I have tried various ways, but kept getting errors. I would appreciate any assistance from the experts here. Thanks.

html_sucks 04-20-2005 07:05 AM

Missing categories in advanced search and products admin
 
I've also just noticed the missing categories in advanced search and products admin, which i've tracked down to the (much) improved search.php script (only issue i've found) - this was on v4.0.13

Quite simple to fix, just add this code to the end of the file search.php file (about line 647/648 for me)

Code:

$search_categories = $smarty->get_template_vars("allcategories");
$smarty->assign("search_categories", $search_categories);


Hope that helps :)

cherie 05-13-2005 10:37 AM

This is great. The x-cart search really needs to be improved. Can someone post the final version of the include/search.php they are using for 4.0.13?


All times are GMT -8. The time now is 03:50 PM.

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