I've used the Display Products Grouped By Subcategories extension on category list pages before with success.
Another solution before we found this extension was to get the collection in the block and use a special attribute to order the collection. The code was as follows (only works under PHP 5.3)
class Class_Name
{
[...]
protected function _getProductCollection()
{
[...]
$collection = $this->_productCollection;
$collection->addAttributeToSelect('category_sort_value');
// Do some fancy sorting
$collectionReflection = new ReflectionObject($collection);
$itemsPropertyReflection = $collectionReflection->getProperty('_items');
$itemsPropertyReflection->setAccessible(true); // Make it accessible
$collectionItems = $itemsPropertyReflection->getValue($collection);
usort($collectionItems, array("Class_Name", "cmp"));
$itemsPropertyReflection->setValue($collectionReflection, $collectionItems);
$itemsPropertyReflection->setAccessible(false); // Return restriction back
// End them fancyness
$this->_productCollection = $collection;
return $this->_productCollection;
}
public function cmp($a, $b)
{
$a_sort = (int)$a->getData('category_sort_value');
$b_sort = (int)$b->getData('category_sort_value');
if ($a_sort == $b_sort) return 0;
return ($a_sort < $b_sort) ? -1 : 1;
}
}
You can use this class example to extend the Block class for the product list in search and sort the results like that. I hope this will help you in the right direction.