6

I see methods like getBackend* and getFrontend, could some one be able to define what the a backend/ frontend model is and its responsibilities?

Just really to give a definition in my head of what it is. I presume a back end model is related to the admin interface?

12

You can use the backend model to perform different actions when saving an attribute value: Validate the value or perform an action before the value is saved or loaded.
For example all data attributes should have the backend model Mage_Eav_Model_Entity_Attribute_Backend_Datetime (eav/entity_attrbute_backend_datetime) or something that inherits it.
This way you ensure the value inserted in the database is formated to look like Y-m-d H:i:s independent from the locale and date format used. Take a look at what backend models can do by inspecting the classes in app\code\core\Mage\Eav\Model\Entity\Attribute\Backend folder.

The frontend model is somehow the other way arround. It takes the value from the database and performs different actions to display it in the right way (in admin or frontend). maybe you get an idea of the actions performed from the classes in app\code\core\Mage\Eav\Model\Entity\Attribute\Frontend

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.