5 min read

Magento 1: Export manufacturers CSV by specific store view

Magento 1: Export manufacturers CSV by specific store view

Last modified

This post will guide you on how you can export the manufacturer list (Magento 1.9) to CSV file.
In this script, I am filtering the list by store view. Let’s suppose you have a store view for Arabic (Store ID=1) and you want to export the manufacturer (Attribute ID= 555) list in Arabic labels only.
The below script will be helpful for you.


<?php

require_once 'app/Mage.php';
Mage::app("admin");

$manufacturer_attribute_id = 555; // Change attribute id as per your store setup
$storeId = 7; // Punch the store id for which you want to export the data
$collection = Mage::getResourceModel('eav/entity_attribute_option_collection')
	        ->setAttributeFilter($manufacturer_attribute_id)
	        ->setStoreFilter($storeId, false);

$handle = fopen("var/export/manufacturers.csv", "w");
$header = array('ID', 'Name');
fputcsv($handle, $header);

foreach($collection as $manufacturer){
	
	$row  = array($manufacturer->getOptionId(), $manufacturer->getValue());
    fputcsv($handle, $row);
	
}

fclose($handle);
?>

Navigate to your `var/export` folder and find the `manufacturers.csv`.

Please post your questions and queries in the comments box below.