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

  • SEARCH
  • Home
  • 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 8897777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:26:08+00:00 2026-06-15T00:26:08+00:00

I have made a small admin module that mirrors CMS->Page. The block for my

  • 0

I have made a small admin module that mirrors CMS->Page. The block for my admin page uses the code from app\code\core\Mage\Adminhtml\Block\Catalog\Product\Grid.php which gives me a grid that I can sort and filter just as I can on the original CMS->Page section.

This is the code in my block for my admin page:

protected function _prepareCollection()
    {
        $collection = Mage::getModel('cms/page')->getCollection();
        $collection->setFirstStoreFlag(true);
        $this->setCollection($collection);
        return parent::_prepareCollection();
    }

Which as I mentioned displays and allows sorting correctly.

However, when I try to modify the data in the rows by amending the above with:

protected function _prepareCollection()
    {
        $collection = Mage::getModel('cms/page')->getCollection();
        $collection->setFirstStoreFlag(true);

        foreach ($collection as $order) {
            $order->setData( 'title', 'Hello world' );    
        } 

        $this->setCollection($collection);
        return parent::_prepareCollection();
    }

I can no longer sort or filter. Can anyone shed any light on whats happening and if I have the right way of changing row data? thanks

  • 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-06-15T00:26:10+00:00Added an answer on June 15, 2026 at 12:26 am

    What’s happening: your collection is being loaded. The foreach language construction triggers the load method of your collection, and it pulls the data from the db and fill the items.

    Why is your sorting not working? Because the sorting is applied to collection after you’ve loaded it already. That means that the items are already present in your collection with default sorting order.

    How should you do your thing? Right now I don’t know what you want to accomplish with that setData method for each of the collection items. If you’re going to use it while creating columns, just add string value in the column.

    ...->addColumn('title', array('default' => 'Hello world'))
    

    If you would want to pull some more data that is present in the collection, you don’t need to load it either, just use collection methods like
    addAttributeToSelect (if it’s EAV entities) or addFieldToFilter.

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

Sidebar

Related Questions

I have made a small helper that adds class=selected . Primarily it uses current_page?
I have made a small change to code of a certain page which is
I have made small web-app in jsp with a start page with login and
I am new to .NET, I have made a small app. I want that
I'm making a webcam app that sends and receives small images. I have made
I have made a small log service that i want to publish to a
I have made an update on Google App Engine with a small fix and
In the bug fixing of a small ASP.NET/C# web app I have made, I
I have made a small program in C# that I want to run in
I have made some small macro that I am using to display text line

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.