You are here

function uc_attribute_condition_ordered_product_option_form in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_attribute/uc_attribute.ca.inc \uc_attribute_condition_ordered_product_option_form()

File

uc_attribute/uc_attribute_workflow.inc, line 61
Workflow-ng file for Ubercart attributes.

Code

function uc_attribute_condition_ordered_product_option_form($settings = array()) {
  $form = array();
  $options = array();
  $result = db_query("SELECT a.aid, a.name AS attr_name, a.ordering, o.oid, o.name AS opt_name, o.ordering FROM {uc_attributes} AS a JOIN {uc_attribute_options} AS o ON a.aid = o.aid ORDER BY a.ordering, o.ordering");
  while ($option = db_fetch_object($result)) {
    $options[$option->attr_name][$option->oid] = $option->opt_name;
  }
  $form['attribute_option'] = array(
    '#type' => 'select',
    '#title' => t('Attribute option'),
    '#default_value' => $settings['attribute_option'],
    '#options' => $options,
  );
  return $form;
}