Magento Quickies

All the Non-Trivial Magento Trivia

1 note

N98-magerun: Attribute Migration Script

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.

Filed under magento n98magerun

  1. magento-quickies posted this