You are here

function uc_attribute_option_form_submit in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_attribute/uc_attribute.admin.inc \uc_attribute_option_form_submit()
  2. 7.3 uc_attribute/uc_attribute.admin.inc \uc_attribute_option_form_submit()

Submit function for uc_attribute_option_form().

File

uc_attribute/uc_attribute.module, line 684

Code

function uc_attribute_option_form_submit($form_id, $form_values) {
  if (!isset($form_values['oid'])) {
    db_query("INSERT INTO {uc_attribute_options} (aid, name, cost, price, weight, ordering) VALUES (%d, '%s', %f, %f, %f, %d)", $form_values['aid'], $form_values['name'], $form_values['cost'], $form_values['price'], $form_values['weight'], $form_values['ordering']);
  }
  else {
    db_query("UPDATE {uc_attribute_options} SET name = '%s', cost = %f, price = %f, weight = %f, ordering = %d WHERE aid = %d AND oid = %d", $form_values['name'], $form_values['cost'], $form_values['price'], $form_values['weight'], $form_values['ordering'], $form_values['aid'], $form_values['oid']);
  }
  return 'admin/store/products/attributes/' . $form_values['aid'] . '/options';
}