HarrisStreet ImpEx for Magento

This article is part of a series covering 3rd party n98-magerun modules/extensions.

In this post we show you another great module to manage your Magento configurations. It supports importing and exporting of store config data in a hierarchical folder structure. This can be done for different environments.

The module was created by Zookal pty ltd the largest student portal in Australia.


You need to install the file directly in your Magento installation via modman.

modman clone https://github.com/Zookal/HarrisStreet-ImpEx.git


After the installation you should see three new commands in your command list.

  • hs:ccd:export
  • hs:ccd:import
  • hs:ccd:convert

The config data can be imported and exported in this config formats:

Now we can start with an initial export…

Export Config Data

Config data can be exported by calling the command hs:ccd:export.
The command support multiple config formats and provides this options

  • --format (-m) Format: yaml, json, csv, xml, limeSodaXml (default: “yaml”)
  • --hierarchical (-a) Create a hierarchical or a flat structure (not all export format supports that). Enable with: y (default: “n”)
  • --filename (-f) File name into which should the export be written. Defaults into var directory.
  • --include (-i) Path prefix, multiple values can be comma separated; exports only those paths
  • --exclude (-x) Path prefix, multiple values can be comma separated; exports everything except …
  • --filePerNameSpace (-s) Export each namespace into its own file. Enable with: y (default: “n”)
  • --exclude-default (-c) Excludes default values (@todo)

Let’s export the whole config data of a shop in default yaml format in seperated files and a prefix.

$> n98-magerun.phar hs:ccd:export --filePerNameSpace=y --filename=dev
Wrote: 1 settings to file dev_admin.yaml
Wrote: 1 settings to file dev_advanced.yaml
Wrote: 1 settings to file dev_catalog.yaml
Wrote: 3 settings to file dev_currency.yaml
Wrote: 39 settings to file dev_design.yaml
Wrote: 1 settings to file dev_dev.yaml
Wrote: 4 settings to file dev_general.yaml
Wrote: 16 settings to file dev_n98_monitoring.yaml
Wrote: 3 settings to file dev_web.yaml

The command created a file containing the the config for each section of your store config. It also recognizes own sections like in my case “n98_monitoring”.

Import Config Data

Now let’s create an import environment.
We need to create a base folder which contains the structure of our organization. Each folder defines an environment.
Environments can be cascaded. The import command will process all .yaml files found in the defined folders.

In my case i created this folder structure to specify an folder for my dev environment and a staging and production area.
The base folder defines the top of your configuration cascade. It’s included evey time. The folder can be used to define default values which can be overridden in sub-folders.

├── base
│   ├── admin.yaml
│   ├── advanced.yaml
│   ├── catalog.yaml
│   ├── currency.yaml
│   ├── design.yaml
│   ├── dev.yaml
│   ├── general.yaml
│   ├── n98_monitoring.yaml
│   └── web.yaml
├── development
│   ├── cmuench
│   │   └── web.yaml
│   └── web.yaml
├── production
└── staging

The files in base folder was generated by previous export. I renamed the files and moved it to base folder.
As you can see i defined two additional files in the development area.

  • develpment/web.yaml
  • develpment/cmuench/web.yaml

If you run the import command you need to set the base folder of your configuration. In my case “configuration”.
And you need to set the relative path to your environment folder. In my case “development/cmuench”.

The development/cmuench.yaml looks like this:

# web
    0: 'http://magento.local/'
    0: 'http://magento.local/'

This defines an special base-url for my development machine.

Let’s run the command…

$> n98-magerun.phar hs:ccd:import ./configuration development/cmuench

The output displays all config changes:

advanced/modules_disable_output/Mage_AdminNotification => 1
Processed: ./configuration/base/advanced.yaml with 1 value.
design/admin/theme => foo
design/email/logo_alt => 
design/footer/absolute_footer => 
design/footer/copyright => © 2013 Magento Enterprise Edition Demo Store. All Rights Reserved.
design/head/default_description => Default Description
design/head/default_keywords => Magento, Varien, E-commerce
design/head/default_robots => INDEX,FOLLOW
design/head/default_title => Magento Enterprise Edition
design/head/demonotice => 0
design/head/includes => 
design/head/title_prefix => 
design/head/title_suffix => 
design/header/logo_alt => Magento Commerce
design/header/logo_src => images/logo.gif
design/header/welcome => Default welcome msg!
design/package/name => enterprise
design/package/ua_regexp => a:0:{}
design/pagination/anchor_text_for_next => 
design/pagination/anchor_text_for_previous => 
design/pagination/pagination_frame => 5
design/pagination/pagination_frame_skip => 
design/theme/default => 
design/theme/default_ua_regexp => a:0:{}
design/theme/layout => 
design/theme/layout_ua_regexp => a:0:{}
design/theme/locale => 
design/theme/skin => 
design/theme/skin_ua_regexp => a:0:{}
design/theme/template => 
design/theme/template_ua_regexp => a:0:{}
design/watermark/image_imageOpacity => 
design/watermark/image_position => stretch
design/watermark/image_size => 
design/watermark/small_image_imageOpacity => 
design/watermark/small_image_position => stretch
design/watermark/small_image_size => 
design/watermark/thumbnail_imageOpacity => 
design/watermark/thumbnail_position => stretch
design/watermark/thumbnail_size => 
Processed: ./configuration/base/design.yaml with 39 values.
web/secure/base_url => http://magento-prod.local/
web/seo/use_rewrites => 1
web/unsecure/base_url => http://magento-prod.local/
Processed: ./configuration/base/web.yaml with 3 values.
admin/dashboard/enable_charts => 0
Processed: ./configuration/base/admin.yaml with 1 value.
general/locale/code => de_DE
general/locale/timezone => Europe/Berlin
general/region/display_all => 1
general/region/state_required => AT,CA,CH,DE,EE,ES,FI,FR,LT,LV,RO,US
Processed: ./configuration/base/general.yaml with 4 values.
dev/template/allow_symlink => 1
Processed: ./configuration/base/dev.yaml with 1 value.
n98_monitoring/index/cataloginventory_stock => 
n98_monitoring/index/catalogsearch_fulltext => 
n98_monitoring/index/catalog_category_flat => 
n98_monitoring/index/catalog_category_product => 
n98_monitoring/index/catalog_product_attribute => 
n98_monitoring/index/catalog_product_flat => 
n98_monitoring/index/catalog_product_price => 
n98_monitoring/index/catalog_url => 
n98_monitoring/index/tag_summary => 
n98_monitoring/pid_file/files => a:0:{}
n98_monitoring/product_visibility_count/threshold => 
n98_monitoring/queue_folder_filecount/folders => a:0:{}
n98_monitoring/sales_order_count/stores => a:1:{s:18:"_1401051204581_581";a:2:{s:5:"Store";s:7:"default";s:7:"Minutes";s:2:"60";}}
n98_monitoring/table/additional => a:0:{}
n98_monitoring/table/catalog_category_product_index => 
n98_monitoring/table/catalog_product_index_price => 
Processed: ./configuration/base/n98_monitoring.yaml with 16 values.
catalog/category/root_id => 2
Processed: ./configuration/base/catalog.yaml with 1 value.
currency/options/allow => EUR
currency/options/base => EUR
currency/options/default => EUR
Processed: ./configuration/base/currency.yaml with 3 values.
web/secure/base_url => http://magento-dev.local/
web/unsecure/base_url => http://magento-dev.local/
Processed: ./configuration/development/web.yaml with 2 values.
web/secure/base_url => http://magento.local/
web/unsecure/base_url => http://magento.local/
Processed: ./configuration/development/cmuench/web.yaml with 2 values.

Let’s verify the special config settings of my development machine with:

$ n98-magerun.phar config:get web/*
| Path                  | Scope   | Scope-ID | Value                 |
| web/secure/base_url   | default | 0        | http://magento.local/ |
| web/seo/use_rewrites  | default | 0        | 1                     |
| web/unsecure/base_url | default | 0        | http://magento.local/ |

It worked! We have imported the complete config for our development machine.
Now we are able to manage the configuration of the production and staging area as well.


This module enables you a wide world to manage complex config environments. It’s very easy to dump the config
in a clear way.
I hope this post gives you nee ideas to use n98-magerun in your company.

It’s also possible to install the module by composer.
For more informations look at the github page of the project: https://github.com/Zookal/HarrisStreet-ImpEx

One Pingback/Trackback