--- uc_attribute.admin.inc 2010-07-11 18:33:31.000000000 -0700
+++ uc_attribute.admin.new.inc 2010-09-16 09:36:11.203606900 -0700
@@ -387,7 +387,13 @@ function uc_attribute_option_form($form_
'#default_value' => $option->weight,
'#weight' => 3,
);
-
+ $form['bulk_update'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Update All?'),
+ '#description' => t('If selected, all products will be updated with options adjustments on this page.
Warning: all option adjustments set at product level will be overriden!'),
+ '#default_value' => 0,
+ '#weight' => 4,
+ );
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
@@ -431,6 +437,10 @@ function uc_attribute_option_form_submit
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_state['values']['name'], $form_state['values']['cost'], $form_state['values']['price'], $form_state['values']['weight'], $form_state['values']['ordering'], $form_state['values']['aid'], $form_state['values']['oid']);
+ if ($form_state['values']['bulk_update'] == 1) {
+ db_query("UPDATE {uc_product_options} SET cost = '%f', price = '%f', weight = '%f', ordering = '%d' WHERE oid = '%d'",
+ $form_state['values']['cost'], $form_state['values']['price'], $form_state['values']['weight'], $form_state['values']['ordering'], $form_state['values']['oid']);
+ }
drupal_set_message(t('Updated option %option.', array('%option' => $form_state['values']['name'])));
watchdog('uc_attribute', 'Updated option %option.', array('%option' => $form_state['values']['name']), WATCHDOG_NOTICE, 'admin/store/attributes/'. $form_state['values']['aid'] .'/options/'. $form_state['values']['oid']);
$form_state['redirect'] = 'admin/store/attributes/'. $form_state['values']['aid'] .'/options';