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)

finestshops 07-28-2004 07:26 PM

Include search by SKU into basic search in v4
 
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"])) {

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"]."%'";


skin1/customer/search.tpl

after

Code:

<INPUT type="hidden" name="posted_data[by_fulldescr]" value="Y">     

add

Code:

<INPUT type="hidden" name="posted_data[by_productcode]" value="Y">     

skin1/customer/main/search_result.tpl

after

Code:

<TD width="5"><INPUT type="checkbox" name="posted_data[by_fulldescr]"{if $search_prefilled eq "" or $search_prefilled.by_fulldescr} checked{/if}></TD><TD nowrap>{$lng.lbl_det_description}</TD>

add

Code:

<TD width="5"><INPUT type="checkbox" name="posted_data[by_productcode]"{if $search_prefilled eq "" or $search_prefilled.by_productcode} checked{/if}></TD><TD nowrap>{$lng.lbl_sku}</TD>

Enjoy :wink:

nhraracer241 09-02-2004 09:25 AM

Anyone used this on version 3.5._?

finestshops 09-02-2004 09:41 AM

Quote:

Originally Posted by nhraracer241
Anyone used this on version 3.5._?


It's completely different in v3.5. I believe there is a solution on this forum
to do the same in v3.5.

Check: http://forum.x-cart.com/viewtopic.php?t=5971

nhraracer241 09-02-2004 10:01 AM

Thanks. I found a fix for this that Boomer had posted. Works great!

sonichart 11-06-2004 08:58 PM

Is it possible to have TWO boxes on the main page? Search ProdID and Search SKU ??

mffowler 11-11-2004 06:06 AM

I don't seem to find search.php in /customer? It is in the root directory and /includes, but different than this example.

Can you point me in the right direction, so that SKU can come up in the search and advanced?

Thanks,

Mike

QVS 11-29-2004 05:11 PM

thanks for the mod :) worked perfectly 8)

QVS 11-29-2004 05:14 PM

Quote:

Originally Posted by mffowler
I don't seem to find search.php in /customer? It is in the root directory and /includes, but different than this example.

Can you point me in the right direction, so that SKU can come up in the search and advanced?

Thanks,

Mike


yeh use the one in includes ;)

sstillwell@aerostich.com 12-03-2004 09:01 AM

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 ;)

PhilJ 12-03-2004 10:25 AM

Fantastic mod, thank you =D>


All times are GMT -8. The time now is 11:27 PM.

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