title: Magento: Limit text field size in product custom attribute to 80 characters
body: <p>I have a problem by using the following tip from the magento forum:</p>
  
  <blockquote>
    <p><strong>Quote</strong>: 
    One option you could do is to add a backend model for this attribute.
    In this model you could write your own <code>beforeSave</code> function that will
    process the length of given value and trim it to be the desired
    length. The class should extend  <code>Mage_Eav_Model_Entity_Attribute_Backend_Abstract</code></p>
    
    <p>Code:</p>
  </blockquote>
  
  <pre><code>public function beforeSave($object) {
       $attrCode = $this-&gt;getAttribute()-&gt;getAttributeCode();
       if ($object-&gt;hasData($attrCode)) {
           $object-&gt;setData($attrCode, substr($object-&gt;getData($attrCode),0,50));
       }
       return $this; }
  </code></pre>
  
  <p><strong>My question now is: how and where do I implement this snippet?</strong> 
  I recently put it in <code>/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Default.php</code> but it had no effect.</p>