Author - Ashley Schroder

Hi! I'm Ashley Schroder, the head software engineer at World Wide Access, a company that exports New Zealand products to the world.

I'm an active member of the Magento community, contributing open source extensions to Magento Connect and sharing my Magento experiences through my blog, You can find helpful tips and advice there on a wide range of Magento development issues.

More Info » Follow me on Twitter »

Reader Comments (10)

  1. Vinai Kopp
    October 31, 2010 at 10:16 pm /

    Great post! I really like the attribute models system of magento.
    Just wanted to point out that this of course also works on any models with an eav resource model, including custom ones.
    Other related topics would be frontend, source and attribute models.

  2. Magento Product Audit Extension - Monitor and Record Changes to your Products |

    […] wrote up an article over on MageBase this weekend expanding on a tip I got from the Magento Developers Paradise. In the process of writing it, I went through a worked example and as usual with articles you want […]

  3. Jonathan Day
    November 18, 2010 at 8:00 pm /

    Thanks Ashley, good write-up. I’ve always used the Observer model (except there are a few circumstances where the core code doesn’t throw an Event at the right time – grrr) and never thought of this approach.

    One question though, does the beforeSave() or afterSave() method on the attribute get called each time that the product is saved, or only when that attribute changes? That would limit its effectiveness for updating remote systems cos I can’t think of a way to force the user to change the value each time?? Thoughts?


  4. KingKaleemKhan
    July 6, 2011 at 7:40 pm /

    Great tutorial. I want to know what would be the type for Drop Down attribute, as for the text area you have assigned ‘varchar’. and from where can I get the complete list?


  5. Vinai Kopp
    July 7, 2011 at 10:04 am /

    You can use varchar or int (depending on the value type of the options).
    For multi-selects use varchar since the values are stored as a comma-separated list (be sure to use the eav/entity_attribute_backend_array backend model).

    For a list of all types run
    SELECT DISTINCT backend_type FROM eav_attribute;

    1. KingKaleemKhan
      July 11, 2011 at 3:45 pm /

      Thank you very much Vinai Kopp

  6. Pierre FAY
    November 25, 2011 at 2:30 am /

    to understand custom model, you can look at this tutorial :

  7. AA
    April 11, 2012 at 4:24 am /

    I have a question for you guys, can I programatically change the $_backend for an attributte, during runtime? Meaning, i want for an attribute like media gallery who has _backend something like Product/Attribute/Backend/Media, to temporarily change that to another class (and then maybe switch back to the original). Any idea if how this is possible?

  8. Damu
    June 4, 2012 at 2:01 pm /

    gr8. hopefully now i can fix eav/attribute_data_checkbox issue, i am having.


Add a Comment & Join the Discussion

Insert small snippets of code by using [code]{your_code_here}[/code]
For larger code blocks please use and paste your link.

You may also use the following HTML in your comment: <a href="" title=""> <abbr title="">
<acronym title=""> <blockquote cite=""> <cite> <em> <strike> <strong>


This site uses Akismet to reduce spam. Learn how your comment data is processed.