I need to access the currently loaded search results as an array but from within catalog/layer/view.phtml.
I’ve tried using the following code, but it returns an empty array…
$products = $this->getLayout()
->getBlockSingleton('catalog/product_list')
->getLoadedProductCollection()
->toArray();
echo "<pre>".print_r($products,true)."</pre>";
die();
Is this even possible?
You need to get the search Model.
Here is the code to get the Search model:
Here is the code to search your products:
Then to get the results in an object, enter the following line:
Good luck,
Pesach