Mage_Catalog_Model_Category_Attribute_Backend_Sortby Class Reference

Inheritance diagram for Mage_Catalog_Model_Category_Attribute_Backend_Sortby:

Mage_Eav_Model_Entity_Attribute_Backend_Abstract Mage_Eav_Model_Entity_Attribute_Backend_Interface

List of all members.

Public Member Functions

 validate ($object)
 beforeSave ($object)
 afterLoad ($object)


Detailed Description

Definition at line 35 of file Sortby.php.


Member Function Documentation

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

Parameters:
Varien_Object $object
Returns:
Mage_Catalog_Model_Category_Attribute_Backend_Sortby

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

Parameters:
Varien_Object $object
Returns:
bool

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     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:38 2009 for Magento by  doxygen 1.5.8