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

Modules, Add-ons and custom code that's more than just a quick hack or Mod.
Post Reply
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

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

Post 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	
CharlieFoxtrot
Confirmed
Confirmed
Posts: 413
Joined: Sun Aug 09, 2009 1:23 pm

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

Post by CharlieFoxtrot »

Good stuff! (Clever people are great! Thank you!)
ISC 4.0.7

"... and let's be honest that whole "by design" thing is getting old too."
Post Reply