Magento 1: Export catalog categories for a specific store view

In this post you will learn how you can export Magento 1.9 categories for a specific store view as CSV.

For example, you have Arabic store view with ID 7, and you want to export all arabic category names in a CSV file, below will be the code you want.

Create a file on your Magento root and paste the below code, change the $storeId to your desired ID and run the script.


require_once 'app/Mage.php';

$storeId = 7;
$categories = Mage::getModel('catalog/category')
	->addFieldToFilter('is_active', 1)

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

foreach($categories as $category){

	$row  = array($category->getId(), $category->getName());
    fputcsv($handle, $row);


After running the above script, you will find the exported CSV file `categories_arabic.csv` in the directory `var/export/`

Magento 1: Export manufacturers CSV by specific store view

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.


require_once 'app/Mage.php';

$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')
	        ->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);


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

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

Search Magento products by product labels

Project Overview:

Task was to develop a Product Labels Magento extension. Where admin can create product labels by uploading an image, enter label title and attach them to any number of products available in store. The label should display on front-end along with product information.
Continue reading “Search Magento products by product labels”

Creating Magento order programmatically and charging saved credit card.

Creating order is the basic functionality of Magento but its the trickiest one at the same time for developers. Yes, its true because its not straight forward like instantiating model, assigning some values and saving it. Sometimes you may want to create auto orders using some cron script.
Continue reading “Creating Magento order programmatically and charging saved credit card.”

Magento 2.0 : Fatal error: Uncaught exception ‘Magento\Framework\Exception\LocalizedException’ with message ‘Can’t create directory

You may encounter below fatal error While installing Magento 2.0

Fatal error: Uncaught exception ‘Magento\Framework\Exception\LocalizedException’ with message ‘Can’t create directory /home/tahir/www/magento-2.0/var/generation/Magento/Framework/App/ResourceConnection/.’ in /home/tahir/www/magento-2.0/vendor/magento/framework/Code/Generator.php:103 Stack trace: #0 /home/tahir/www/magento-2.0/vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass(‘Magento\Framewo…’) #1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load(‘Magento\Framewo…’) #2 [internal function]: spl_autoload_call(‘Magento\Framewo…’) #3 /home/tahir/www/magento-2.0/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct(‘Magento\Framewo…’) #4 /home/tahir/www/magento-2.0/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor(‘Magento\Framewo…’) #5 /home/tahir/www/magento-2.0/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(7 in /home/tahir/www/magento-2.0/vendor/magento/framework/Code/Generator.php on line 103


Changing permissions of /var directory will solve the issue. Run below command from root of your Magento 2.0 directory.

sudo chmod 755 -R var


How to Conditionally remove Magento header/footer?

Are you looking for a solution to conditionally remove Magento header footer but don’t know where to start? Right in this post I will show you how to create custom layout handles and utilize them to conditionally remove header/footer blocks.

In some cases there is a need to remove Magento header or footer from pages, for example you are creating some custom landing page and you don’t want to put header or footer or want to remove both from that page, this tutorial will help you achieving it.
Continue reading “How to Conditionally remove Magento header/footer?”

Add custom Javascript in Magento admin form

In previous post we learnt how to render custom html in tabs block. Now lets add custom JavaScript in Magento admin form. Magento is flexible enough to insert your custom JavaScript code snippets in forms created by your very own Magento modules & extensions. Continue reading “Add custom Javascript in Magento admin form”

How to render custom phtml in Magento admin tabs block?

It’s possible to add custom tabs on any page of Magento administration panel. Normally tabs are generated by Form Blocks, this is fine if you want to create standard forms but what if you need to render something totally different. Life can get very easy if we can render our custom phtml file. Embrace the high flexibility of Magento because its possible to render custom phtml in Magento admin tabs block in two simple steps.
Continue reading “How to render custom phtml in Magento admin tabs block?”

Get custom attribute value in Magento

So you have created some custom attributes for your Magento products and now you want to fetch their values. Magento provides a function getAttributeText that takes attribute code and returns you the attribute value.
Continue reading “Get custom attribute value in Magento”

Configure in Magento

Magento has various built-in payment methods, one of them is To enable and configure as your payment processor, you should have API Login ID and Transaction Key. You can get these credentials from your account.
Continue reading “Configure in Magento”