/** * Use the sort order of the variation attributes to order the attribute values. * This ensures that when VariationAttributes is used for a table header * and AttributeValues are used for the table rows then the columns will be * in the same order. * @return DataObjectSet */ public function AttributeValuesSorted() { $values = parent::AttributeValues(); $types = $this->Product()->VariationAttributes(); $result = new ArrayList(); foreach ($types as $type) { $result->push($values->find('TypeID', $type->ID)); } return $result; }