To my knowledge Magento does not allow the limiting of lengths for EAV attributes. For a varchar this gets stored in the table catalog_product_entity_varchar
which has the definition value => varchar(255)
.
One option you could do is to add a backend model for this attribute. In this model you could write your own beforeSave
function that will process the length of given value and trim it to be the desired length. The class should extend Mage_Eav_Model_Entity_Attribute_Backend_Abstract
public function beforeSave($object)
{
$attrCode = $this->getAttribute()->getAttributeCode();
if ($object->hasData($attrCode)) {
$object->setData($attrCode, substr($object->getData($attrCode),0,50));
}
return $this;
}