Magento – Retrieve Advanced Search results as a plain array

I am currently working on a Magento application and have a requirement to sort advanced search results based on the precedence of the categories in the store.

Basically, i have the algorithm prepared where i would loop through the advanced search results, run a query to retrieve the position of the products category and then sort the final result set before returning it back to the calling function.

But the issue I’m having is that i am unable to retrieve the search results as a plain array to work with. Could any one of the experts tell a way to retrieve this array please?


Maximumus 69

One thought on “Magento – Retrieve Advanced Search results as a plain array”

  1. assuming that you’re working in list.phtml, this should work.


    where $requiredFields is null (if you want all fields) or an array containing the fields that you’re interested in.

    Note that your choice to convert to array and then sort is particularly inefficient. You should be using Magento’s inbuilt Collection sorting mechanisms. Read the documentation and API then then give setOrder('position') a try.

    Good luck,

Leave a Reply

Your email address will not be published. Required fields are marked *