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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:57:46+00:00 2026-05-27T09:57:46+00:00

I have created a custom module which displays a tab and a section in

  • 0

I have created a custom module which displays a tab and a section in admin configuration panel to manage customer attributes.

I have loaded all customer attributes with a check box each.

This is my code for displaying all customer attributes as checkboxes. I want the checkbox value selected from here to be added as a column in Manage Customer Grid.
Model/Attributes.php

$attributes =   Mage::getModel('customer/entity_address_attribute_collection');
    $result = array();
    foreach ($attributes as $attribute)
    {
        if (($label = $attribute->getFrontendLabel()))
            $result[$attribute->getId()] = $label;
    }
    $attributes1 = Mage::getModel('customer/entity_attribute_collection');
    $result1 = array();
    foreach ($attributes1 as $attribute1)
    {
        if (($label1 = $attribute1->getFrontendLabel()))
            $result1[$attribute1->getId()] = $label1;
    }
    $final = array_merge($result, $result1);

    return $final;

Now based on selection of these check boxes, I would like to add an extra column in ‘Manage Customer’ Grid.

I tried retrieving the value of selected checkbox but I just get the array index number.

       Mage::getStoreConfig('sectionname/groupname/fieldname');

Can some one tell me how to fetch the the selected checkbox value and add a column based on the selection represented by that checkbox?

Thanks in advance.

  • 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-27T09:57:46+00:00Added an answer on May 27, 2026 at 9:57 am

    When you use array_merge you are destroying the correct indexes, which are supposed to be the attribute IDs. Also it’s good practice to give your variables meaningful names.

    $result = array();
    $addressAttributes = Mage::getModel('customer/entity_address_attribute_collection');
    foreach ($addressAttributes as $addressAttribute)
    {
        if (($addrlabel = $addressAttribute->getFrontendLabel()))
            $result[$addressAttribute->getId()] = $addrlabel;
    }
    $customerAttributes = Mage::getModel('customer/entity_attribute_collection');
    foreach ($customerAttributes as $customerAttribute)
    {
        if (($custlabel = $customerAttribute->getFrontendLabel()))
            $result[$customerAttribute->getId()] = $custlabel;
    }
    
    return $result;
    

    I suppose the next step is to remove the columns that your grid’s parent will add, these are stored in a grid’s protected _columns property. Not all columns are to be removed, such as the massaction column. Then add your chosen columns back in.

    protected function _prepareColumns()
    {
        parent::_prepareColumns();
        // remove the excess columns here
    
        $attributeIds = Mage::getStoreConfig('sectionname/groupname/fieldname');
        $attributes = Mage::getModel('eav/entity_attribute')->getCollection()
            ->addFieldToFilter('attribute_id', array('in' => $attributeIds));
    
        foreach ($attributes as $attribute)
        {
            $options = array();
            if ($attribute->getFrontendInput() == 'select') {
                foreach ($attribute->getSource()->getAllOptions() as $value) {
                    $options[$value['value']] = $value['label'];
                }
            }
            $this->addColumn($attribute->getCode(), array(
                'index'   => $attribute->getCode(),
                'header'  => $attribute->getFrontendLabel(),
                'type'    => $attribute->getFrontendInput(),
                'options' => $options
            ));
        }
    
        return $this;
    }
    

    This way may lose useful formatting like column widths, etc. so a more sophisticated way would be to work out which columns are already in place and leave them, then only remove those that haven’t been selected.

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

Sidebar

Related Questions

I have created a custom Magento module which extends the core sales order functionality
If have created a custom role within SqlServer which I added to the db__denydatareader
I'm currently working on a custom module in which I have a controller extending
I have created new aspx file within a module which I am going to
I have created a custom button called ModuleUIButton which inherits from UIButton . This
I have installed a schema for a custom module which creates the table when
I have a custom c++ module for python that exposes functions, some of which
I have created a custom module in magento and wants to show products with
So I have created a custom module for Drupal 6.x and it works as
I have created custom MembershipUser, MembershipProvider and RolePrivoder classes. These all work and I

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.