·

photo credit: Abstract Light via photopin (license)

Create an install- or upgrade script in Magento that creates a product attribute

When writing Magento Modules (or updating them), you’ll often find yourself in the situation where some of the functionality depends on the presence of a specific product attribute.
As you know, you can use an installer script to create product attributes programmatically, just like you can create static blocks programmatically. Since I encounter this situation often myself, I’ll show you how I do this in an install- or upgrade script.

The code

Here is the code that I use: you can edit it and use it in your installer scripts:

 

Visitors give this article an average rating of 3.2 out of 5.

How would you rate this article?

3 thoughts on “Create an install- or upgrade script in Magento that creates a product attribute”

  1. Sreedarsh says:

    Very good code…100% working

  2. Amrin rajani says:

    Hi Geil, I have a single vendor store and would like to convert it to multivendor by programming and not using extensions. How can I do this? Could you please guide me?

  3. Chandan Rai says:

    Very Nice code ..Worked on first run..

Leave a Reply