public function fetchSelectionCriteriaByManuf($manuf_id, $choices_made = array()) { $choices_sql = $this->getChoicesSQL($choices_made); // the odd label values help with the ordering/sorting process $this->query("SELECT DISTINCT(grp) AS value, 'a' AS label \r\n\t\t\t\t FROM part \r\n\t\t\t\t WHERE cat_id='{$this->_id}' AND manuf_id={$manuf_id}{$choices_sql}\r\n\t\t\t\t UNION \r\n\t\t\t\t SELECT DISTINCT(frame_type) AS value, 'b' AS label \r\n\t\t\t\t FROM part \r\n\t\t\t\t WHERE cat_id='{$this->_id}' AND manuf_id={$manuf_id}{$choices_sql} \r\n\t\t\t\t UNION \r\n\t\t\t\t SELECT DISTINCT(amps) AS value, 'c' AS label \r\n\t\t\t\t FROM part \r\n\t\t\t\t WHERE cat_id='{$this->_id}' AND manuf_id={$manuf_id}{$choices_sql}\r\n\t\t\t\t ORDER BY label ASC, value ASC\r\n\t\t\t\t"); if ($this->queryOK()) { $criteria = array(); while ($row = $this->next()) { switch ($row['label']) { case 'a': if (LWS::isAvailable($row['value'])) { $criteria['group'][] = $row['value']; } break; case 'b': if (LWS::isAvailable($row['value'])) { $criteria['type'][] = $row['value']; } break; case 'c': if (LWS::isAvailable($row['value'])) { $criteria['amperage'][] = $row['value']; } break; default: break; } } return $criteria; } else { return NULL; } // should never get here!! should always have a result set to return. }