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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:01:56+00:00 2026-05-22T19:01:56+00:00

Okay so with Customer Attributes I have a multi-option selection that I have added

  • 0

Okay so with Customer Attributes I have a multi-option selection that I have added to the Manage Customers Grid.

    $prodCode = Mage::getSingleton('eav/config')->getAttribute('customer','prod_codes');
    $prodCodeOptions = $prodCode->getSource()->getAllOptions(false);
    $prodOptions = array();

    foreach($prodCodeOptions as $k)
        $prodOptions[$k['value']] = $k['label'];

    $this->addColumn('prod_codes', array(
        'header'    =>  Mage::helper('customer')->__('Product Code'),
        'width'     =>  '100',
        'index'     =>  'prod_codes',
        'type'      =>  'options',
        'options'   =>  $prodOptions,
        'filter_condition_callback'
                    => array($this, '_filterProdOptionsCondition'),
    ));

I do have my attribute added to the collection at the top of my Grid.php:

->addAttributeToSelect('prod_codes')

Here is my _filterProdOptionsCondition method:

protected function _filterProdOptionsCondition($collection, $column) {
    if(!$value = $column->getFilter()->getValue()) {
        return;
    }
    $this->getCollection()->addFieldToFilter('prod_codes', array('finset' => $value));
    #print($collection->getSelectSql());
}

Now this work fine and dandy if I only have ONE of the options selected, once I apply more than one option to the customers attribute I will get a blank results within the admin grid, however it IS still searchable.

A close look with the print($collection->getSelectSql()); uncommented I see that the attribute ID values are being returned in an comma delimited list.

Now onto my question with that background laid out, is there a method or “Magento” way to display these multi-options within the admin grid I’m just unaware of? Or do I need to simply get the comma values exploded and call for a new collection to build out the display values? Any help appreciated!

  • 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-22T19:01:56+00:00Added an answer on May 22, 2026 at 7:01 pm

    Appears I had to extend the Column renderer to anticipate comma values and simply render them, I’m amazed this isn’t built in since the functionality exists to create the multioptions attributes but no grid display option for it.

    app/code/local/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Options.php

    public function render(Varien_Object $row)
    {
        $options = $this->getColumn()->getOptions();
        $showMissingOptionValues = (bool)$this->getColumn()->getShowMissingOptionValues();
        if (!empty($options) && is_array($options)) {
            $value = $row->getData($this->getColumn()->getIndex());
            if (is_array($value)) {
                $res = array();
                foreach ($value as $item) {
                    if (isset($options[$item])) {
                        $res[] = $options[$item];
                    }
                    elseif ($showMissingOptionValues) {
                        $res[] = $item;
                    }
                }
                return implode(', ', $res);
            }
            elseif (isset($options[$value])) {
                return $options[$value];
            } elseif (is_string($value)) { // <--- MY CHANGES HERE
                $values = explode(',', $value);
                $returnOptions = "";
                foreach($values as $k=>$v) {
                    $returnOptions .= $options[$v]. ", ";
                }
                return substr($returnOptions, 0, -2);
            }
            return '';
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, here's the scenario. I have a utility that processes tons of records, and
Suppose I have a customer object that has all of the standard customer properties
I'm building an application that is used by several different customers. Each customer has
I have two tables, Customer and CustomerConfiguration that should have a one-to-one mapping. What
Okay so what I have is a table that keeps track of history on
Okay. This is my company's customer portal, it's an MVC 2 project. We have
Okay, we know that the following two lines are equivalent - (0 == i)
Well, I have a class Customer (no base class). I need to cast from
To anyone who can help, Thanks Okay, so I have a database holding a
Okay. I have this code on my site: <?php session_start(); include database.php; include bruger.php;

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.