Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4075196
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:16:00+00:00 2026-05-20T17:16:00+00:00

I am currently working on a Magento application and have a requirement to sort

  • 0

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?

Regards,

Maximumus 69

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:16:01+00:00Added an answer on May 20, 2026 at 5:16 pm

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

    $_productCollection=$this->getLoadedProductCollection();
    $_productCollection->toArray($requiredFields)
    

    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,
    JD

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a Magento extension, and I have overridden a core
I am currently working on a Magento store (ver. 1.6.2.0) however when i click
I am working on an online store on the Magento platform and have hit
I have developed a custom search engine for our Magento store and I am
I'm currently working on a new Magento template, and I'm facing problems with jQuery.
Currently working in the deployment of an OFBiz based ERP, we've come to the
Am currently working on an application that requires users to submit posts and comments
I'm currently working on a custom module in which I have a controller extending
Currently working on a flex AIR project based on PureMVC framework. There was a
Currently working on a Spring 2.5 web application, looks as if the business has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.