I'm trying to get the product collection containing only the products that appear in a search, from inside app\design\frontend[theme]\catalog\layer\view.phtml
I've tried:
$search = Mage::getSingleton('catalogsearch/advanced');
$searchCollection = $search->getProductCollection()->addAttributeToFilter('visibility', 4);
and
$searchCollection = Mage::getModel('catalog/category')->getProductCollection();
$searchCollection = Mage::getSingleton('catalogsearch/advanced')->prepareProductCollection( $searchCollection );
$searchCollection = $searchCollection->getProductCollection();
Both of these return every single product on the site, not just the ones in the search results.
Can anyone help?