Public Member Functions | |
validate ($object) | |
beforeSave ($object) | |
afterLoad ($object) |
Definition at line 35 of file Sortby.php.
afterLoad | ( | $ | object | ) |
Reimplemented from Mage_Eav_Model_Entity_Attribute_Backend_Abstract.
Definition at line 83 of file Sortby.php.
00083 { 00084 $attributeCode = $this->getAttribute()->getName(); 00085 if ($attributeCode == 'available_sort_by') { 00086 $data = $object->getData($attributeCode); 00087 if ($data) { 00088 $object->setData($attributeCode, split(',', $data)); 00089 } 00090 } 00091 return $this; 00092 }
beforeSave | ( | $ | object | ) |
Before Attribute Save Process
Varien_Object | $object |
Reimplemented from Mage_Eav_Model_Entity_Attribute_Backend_Abstract.
Definition at line 71 of file Sortby.php.
00071 { 00072 $attributeCode = $this->getAttribute()->getName(); 00073 if ($attributeCode == 'available_sort_by') { 00074 $data = $object->getData($attributeCode); 00075 if (!is_array($data)) { 00076 $data = array(); 00077 } 00078 $object->setData($attributeCode, join(',', $data)); 00079 } 00080 return $this; 00081 }
validate | ( | $ | object | ) |
Validate process
Varien_Object | $object |
Reimplemented from Mage_Eav_Model_Entity_Attribute_Backend_Abstract.
Definition at line 44 of file Sortby.php.
00045 { 00046 if (!parent::validate($object)) { 00047 return false; 00048 } 00049 00050 $attributeCode = $this->getAttribute()->getName(); 00051 if ($attributeCode == 'default_sort_by') { 00052 if ($available = $object->getData('available_sort_by')) { 00053 if (!is_array($available)) { 00054 $available = split(',', $available); 00055 } 00056 if (!in_array($object->getData($attributeCode), $available)) { 00057 Mage::throwException(Mage::helper('eav')->__('Default Product Listing Sort by not exists on Available Product Listing Sort by')); 00058 } 00059 } 00060 } 00061 00062 return true; 00063 }