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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:58:43+00:00 2026-05-23T11:58:43+00:00

I have extended the Mage_Adminhtml_Block_Sales_Order_Grid class with a custom module to add several customer

  • 0

I have extended the Mage_Adminhtml_Block_Sales_Order_Grid class with a custom module to add several customer attributes (Magento EE 1.10) to the grid.

Two of the attributes I added are text fields (i.e. they live in the customer_entity_varchar table, and I was able to add them to the collection and display them in the grid. So far so good.

A third attribute is a select, so the values live in the customer_entity_int, the eav_attribute_option and the eav_attribute_option_value tables. I added the necessary values to the collection (using $collection->getSelect()->joinLeft(.....). Again, so far so good.

My problem is being able to display and filter the attribute at the same time.

Inside the _prepareColumns() function in my MyCompany_MyModule_Block_Adminhtml_Order_Grid class, if I add a column like this, – as expected – I can display the values of the attribute on each row, but I don’t get a drop down filter in the header:

protected function _prepareColumns()
{
    ...
    $this->addColumn('bureau', array(
        'header'    => Mage::helper('sales')->__('Bureau'),
        'index'     => 'bureau',
        'type'      => 'text'
    ));
    ...
}

Following the example of status, and adding the column like this, gives me the drop down filter in the header, but it no longer displays the values for the attribute in each row:

protected function _prepareColumns()
{
    ...
    $this->addColumn('bureau', array(
        'header'    => Mage::helper('sales')->__('Bureau'),
        'index'     => 'bureau',
        'type'      => 'options',
        'options'   => $this->_getBureauOptions(),
        'filter_index' => 'value_option_table.option_id'
    ));
    ...
}   

protected function _getBureauOptions()
{
    $bureau = Mage::getResourceModel('eav/entity_attribute_collection')
        ->setCodeFilter('bureau')
        ->getFirstItem();

    $bureauOptions = $bureau->getSource()->getAllOptions(false);
    $optionsArr = array();

    foreach ($bureauOptions as $option) {
        $optionsArr[$option['value']] = $option['label'];
    }

    return $optionsArr;
} 

Any advice / explanation would be much appreciated.

UPDATE:
It turns out that my code also causes a SQL error in a multi-website environment when an admin user only has permissions for some websites:
"SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'store_id' in where clause is ambiguous"

  • 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-23T11:58:43+00:00Added an answer on May 23, 2026 at 11:58 am

    @clockworkgeek had the answer to the first part of my question.

    The problem was that my joinLeft() was retrieving text values from the attribute options, while I should have been retrieving integer values when using 'type => 'options'.

    Once I changed my joinLeft() to only retrieve integer values from customer_entity_int (actually a simpler join), the filtering and display worked flawlessly – thank you sir.

    I will re-post my second issue (about SQL errors caused by permissions) as a separate question.

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

Sidebar

Related Questions

I have extended the ActiveRecord::Base class as follows: lib/activerecord_ext.rb: class ActiveRecord::Base named_scope( :recent, :conditions
I have extended Django's User Model using a custom user profile called UserExtension .
I have a SharePoint site extended for forms authentication. The Active Directory site is
I have a FBA website and then I extended it (to use Windows Authentication)
I have a C++ Windows application that can be extended by writing C++ plugins,
I have 2 classes, main and extended. I need to use main vars in
Is there a way to write an enumeration that can be extended. I have
I have 'extended' the System.DateTime struct by adding some essential fields to it. Ideally
I have extended regexes enabled in my Bash by shopt -s extglob They may
I have extended my entities to implement specific interfaces for its type. I am

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.