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 9250051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:21:14+00:00 2026-06-18T10:21:14+00:00

I’ve added a custom attribute to the sales_order_flat table, and I’m trying to display

  • 0

I’ve added a custom attribute to the sales_order_flat table, and I’m trying to display this attribute in the grid at sales_order/index.

I’ve done this with customer attributes successfully, but I’m getting errors when trying the same thing with order data.

<global>
    <blocks>
        <adminhtml>
            <rewrite>
                <sales_order_grid>WACI_AdminHtmlExt_Block_Sales_Order_Grid</sales_order_grid>
            </rewrite>
        </adminhtml>
    </blocks>
 <!-- etc  -->

app/code/local/namespace/module/Block/Sales/Order/Grid.php

class WACI_AdminHtmlExt_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{

    protected function _prepareColumns()
    {

        $this->addColumn('dynamics_ord', array(
            'header'    => $this->__('Dynamics ID'),
            'width'     => '75px',
            'index'     => 'dynamics_ord',
        ));

        $this->addColumnsOrder('dynamics_ord','entity_id');

        return parent::_prepareColumns();
    }
}

I see that _prepareCollection is sometimes used, but I’m trying to just amend the collection during setCollection for, if nothing else, simplicity.

Whatever the case, the column displays, but no data is produced. (And the page errors out when I try to sort).

Any ideas on this?

Update

This post is an extension of this SO thread I’ve updated it to match the modules current status. That is, I’m adding columns to both sales_flat_order and sales_flat_order_grid.

From that post, I’ve got an action that takes place to set this attribute value (after the order has been completed).

My question at this point is – how does updateGridRecords() come into play?

=> updateGridRecords appears to be called automatically when the $order->save() gets called (something I’m doing manually after the order is complete).

If I understand this correctly, because I’m not pulling data from any other model, the _prepareColumns call is all that’s required.

=> yep. Displaying and sorting properly after the attr is saved. Win!

  • 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-18T10:21:15+00:00Added an answer on June 18, 2026 at 10:21 am

    The difference between customer collection and order grid collection is that customer collection is derived from Mage_Eav_Model_Entity_Collection_Abstract and sales_flat_order_grid collection is derived from Mage_Sales_Model_Resource_Abstract which is not EAV.

    Because of that you can’t add attributes to select like you would normaly be able to do with EAV – all the attributes that you want to use must be represented as a table column in the flat table.

    The function addAttributeToSelect that you are calling is implemented in Mage_Sales_Model_Resource_Collection_Abstract class and uses in background addFieldToSelect so in you case you should have a column with name dynamics_ord in sales_flat_order_grid table.

    The function that moves attribute values from order EAV to order grid is Mage_Sales_Model_Resource_Order_Abstract::updateGridRecords and this function reads the structure of sales_flat_order_grid table to know which attributes should be written to sales_flat_order_grid table so if dynamics_ord column is missing you will have to add it in your module’s install script.

    I came across this stack overflow solution on how to add the column in install script and then add it to the grid. The answer is a bit outdated but I think it could work.

    I have also found this out of the box solution on how to add an attribute that will be used on orders grid but haven’t tested it so I can’t be certain if it works.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
In my XML file chapters tag has more chapter tag.i need to display chapters

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.