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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:47:43+00:00 2026-05-16T05:47:43+00:00

The import products profile allows you to filter which products to export by name,

  • 0

The import products profile allows you to filter which products to export by name, sku…
I want to have the same functionality in the manage products page.
The admin will filter products in the grid and then click a “export” button to get the filtered products.

How can I add the “export” button? what template/block do I need to override?
When the admin click the button, how can I get the filtered collection?
How can I export the filtered collection to a csv file? Can I use the dataflow for that?

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-05-16T05:47:44+00:00Added an answer on May 16, 2026 at 5:47 am

    You will need to implement a new massAction in the admin product controller. A good way to start is to have a look at the product controller and see how the other massActions are implemented.

    Let’s have a look… First you will need to add a declaration of a massAction to a grid. This can be done in app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php. You need to add the following in the _prepareMassaction method:

    $this->getMassactionBlock()->addItem('export', array(
                    'label' => Mage::helper('catalog')->__('Export to CSV'),
                    'url'   => $this->getUrl('*/*/massExport', array('_current'=>true)),
                ));
    

    Now you will have to implement this new action in the product controller (app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php):

    public function massExportAction()
        {
            $productIds = $this->getRequest()->getParam('product');
            if (!is_array($productIds)) {
                $this->_getSession()->addError($this->__('Please select product(s).'));
                $this->_redirect('*/*/index');
            }
            else {
                //write headers to the csv file
                $content = "id,name,url,sku\n";
                try {
                    foreach ($productIds as $productId) {
                        $product = Mage::getSingleton('catalog/product')->load($productId);
                        $content .= "\"{$product->getId()}\",\"{$product->getName()}\",\"{$product->getProductUrl()}\",\"{$product->getSku()}\"\n";
                    }
                } catch (Exception $e) {
                    $this->_getSession()->addError($e->getMessage());
                    $this->_redirect('*/*/index');
                }
                $this->_prepareDownloadResponse('export.csv', $content, 'text/csv');
            }
    
        }
    

    The code is mostly copied from the massDeleteAction, but instead of deleting products you should add to the $content variable. After you are done creating the content of your csv export (you will probably need to add other fields to it) you need to call the _prepareDownloadResponse method of the controller class. That’s it, you have your custom export in place!

    On a final note, once you are happy with the changes remember to move them to your local code pool so that your magento installation remains update-proof 🙂

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

Sidebar

Related Questions

I have created csv file and import that using System -> Import/Export -> Dataflow-Profile
we want to export/import configurable products through the Magento-API in another system. What is
I have an import/export from/to xls of my Products, SubProducts & Costs of my
when exporting and importing data in Magento via import/export profile, products are not being
So I have this need to import (currently) about 15k products. Each product has
(Using Rails 3.1.3) I have an app that manages products. I import the products
I have a lot of products which need to be assigned to new categories.
I'm importing multiple products to Magento. I have two stores where I want to
I have to import 30.000 products into magento shop and it takes ages. I'm
I have a problem with Plone 4.0.1. At portal_setup, when I want to import

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.