Page 1 of 1

[MOD] Admin>Product>Search : On product Name or SKU

Posted: Wed Jul 28, 2010 2:32 pm
by Martin
This Mod allows you to search your product list based on a part of the SKU rather than having to know the whole thing.

Open: /admin/includes/classes/class.product.php

Find:

Code: Select all

$queryWhere .= "OR lower(ps.prodcode) = '" . $GLOBALS['ISC_CLASS_DB']->Quote($search_query) . "' ";
Replace with:

Code: Select all

//MOD Search using partial SKU 
				//$queryWhere .= "OR lower(ps.prodcode) = '" . $GLOBALS['ISC_CLASS_DB']->Quote($search_query) . "' ";
				$queryWhere .= "OR lower(ps.prodcode) like '%" . $GLOBALS['ISC_CLASS_DB']->Quote($search_query) . "%' ";
//MOD END Search using partial SKU	


For 5.5.2 it's subtly different so try this...

Find:

Code: Select all

				$queryWhere .= "OR ps.prodcode = '" . $GLOBALS['ISC_CLASS_DB']->Quote($search_query) . "' ";
Replace with:

Code: Select all

//MOD Search using partial SKU 
				//$queryWhere .= "OR ps.prodcode = '" . $GLOBALS['ISC_CLASS_DB']->Quote($search_query) . "' ";
				$queryWhere .= "OR ps.prodcode like '%" . $GLOBALS['ISC_CLASS_DB']->Quote($search_query) . "%' ";
//MOD END Search using partial SKU	

Re: [MOD] Admin>Product>Search : On product Name or SKU

Posted: Thu Jul 29, 2010 5:37 am
by CharlieFoxtrot
Good stuff! (Clever people are great! Thank you!)