REQUEST: Modify

Hi All,



I’ve attempted to get this functionality work the way I want it, not to much avail as I’m not exactly a jQuery guru.



Is this something accomplishable?



Before


Change the present functionality from search by product to search by order id





After

Quick search will search by order id by default.





Regards,

Jesse-Lee Stringer











Edit

admin/bottom.tpl



Replace this code

```php









$lang.quick_search…“}” name=“q” id=“quick_search” class=“input-text {if $search.q == “”}cm-hint{/if}” />

{capture name=“tools_list”}



{/capture}

{include file=“buttons/button.tpl” but_text=$lang.search_product but_name=“dispatch[products.manage]” but_onclick=“$(‘#quick_search’).attr(‘name’, ‘q’).val($(‘#quick_search’).val() == $(‘#elm_default_search’).val() ? ‘’ : $(‘#quick_search’).val());” but_role=“submit” allow_href=true} {$lang.or} {include file=“common_templates/tools.tpl” prefix=“bottom” hide_actions=true tools_list=$smarty.capture.tools_list display=“inline” link_text=$lang.choose link_meta=“lowercase”}



```With this



```php








$lang.quick_search…“}” name=“order_id” id=“quick_search” class=“input-text {if $search.q == “”}cm-hint{/if}” />

{capture name=“tools_list”}



{/capture}

{include file=“buttons/button.tpl” but_text=$lang.order_id but_name=“dispatch[orders.manage]” but_onclick=“$(‘#quick_search’).attr(‘name’, ‘order_id’).val($(‘#quick_search’).val() == $(‘#elm_default_search’).val() ? ‘’ : $(‘#quick_search’).val());” but_role=“submit” allow_href=true} {$lang.or} {include file=“common_templates/tools.tpl” prefix=“bottom” hide_actions=true tools_list=$smarty.capture.tools_list display=“inline” link_text=$lang.choose link_meta=“lowercase”}



```

Most of the time I use this to search product SKU, how would I make searching for SKY default ?


[quote name=‘JesseLeeStringer’]Hi All,



I’ve attempted to get this functionality work the way I want it, not to much avail as I’m not exactly a jQuery guru.



Is this something accomplishable?



Before


Change the present functionality from search by product to search by order id





After

Quick search will search by order id by default.





Regards,

Jesse-Lee Stringer[/QUOTE]

Try replacing the code above with this for product code default





```php









$lang.quick_search…“}” name=“pcode” id=“quick_search” class=“input-text {if $search.q == “”}cm-hint{/if}” />

{capture name=“tools_list”}



{/capture}

{include file=“buttons/button.tpl” but_text=$lang.product_code but_name=“dispatch[products.manage]” but_onclick=“$(‘#quick_search’).attr(‘name’, ‘pcode’).val($(‘#quick_search’).val() == $(‘#elm_default_search’).val() ? ‘’ : $(‘#quick_search’).val());” but_role=“submit” allow_href=true} {$lang.or} {include file=“common_templates/tools.tpl” prefix=“bottom” hide_actions=true tools_list=$smarty.capture.tools_list display=“inline” link_text=$lang.choose link_meta=“lowercase”}



```

You can search for the product code that way, but I like being able to search for the product code (sku) on any of the product search areas.



The code I have below will allow you to search by product code in both the admin and the customer side.



This code came from the CS Knowledge base.



In core/fn.catalog.php



Below:


if ($params['pname'] == 'Y') {
$tmp .= db_quote(" OR descr1.product LIKE ?l", "%$piece%");
}




Add:


$oc_codes = db_get_fields(" SELECT product_code FROM ?:product_options_inventory");
if (in_array($piece, $oc_codes)) {
$pid = db_get_field(" SELECT product_id FROM ?:product_options_inventory WHERE product_code = '$piece'");
$tmp .= db_quote(" OR products.product_id LIKE ?s", "%$pid%");
}
if ($params['pname'] == 'Y') {
$tmp .= db_quote(" OR products.product_code LIKE ?s", "%$piece%");
}




Hope that helps,



Brandon