Categories


Archives


Recent Posts


Categories


N98-magerun: Attribute Migration Script

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

I’m happy to report n98-magerun have incorporated and improved my old attribute migration generator script into a new dev:setup:script:attribute command.

$ n98-magerun list dev:setup:script
...
Available commands for the "dev:setup:script" namespace:
  dev:setup:script:attribute   Creates attribute script for a given attribute code

If you’re not familiar with my original script, it automatically created a Magento setup resource migration script for existing catalog product attributes. This allows you to configure a development Magento system however you wanted via the UI, and then generate a script to insert your attribute into a staging or production system.

Here’s the syntax for the n98-magerun version

$ n98-magerun dev:setup:script:attribute catalog_product color

You’ll notice instead of simply passing in the attribute code (color), you also need to pass in the attribute type (catalog_product). This is a little more work, but also means you can use this script for any EAV attribute. My original script was focused on product attribute creation because that was the specific problem I needed solved at the time.

This sort of collaboration is what I’ve always liked about “open source”. One group (Netz98) makes a great Magento tool, someone else (Me) vomits up a useful script but then moves on, and a third person (Dusan Lukic) has the knowledge/creativity to see how the two interlock and the drive to bring them together.

Copyright © Alana Storm 1975 – 2023 All Rights Reserved

Originally Posted: 27th June 2013

email hidden; JavaScript is required