/** * Compare attributes * * @param Mage_Eav_Model_Entity_Attribute $attribute1 * @param Mage_Eav_Model_Entity_Attribute $attribute2 * @return int */ public function attributesCompare($attribute1, $attribute2) { $sortPath = sprintf('attribute_set_info/%s/sort', $this->_sortingSetId); $groupSortPath = sprintf('attribute_set_info/%s/group_sort', $this->_sortingSetId); $sort1 = $attribute1->getData($groupSortPath) * 1000 + $attribute1->getData($sortPath) * 0.0001; $sort2 = $attribute2->getData($groupSortPath) * 1000 + $attribute2->getData($sortPath) * 0.0001; if ($sort1 > $sort2) { return 1; } elseif ($sort1 < $sort2) { return -1; } return 0; }