You are here

function uc_varprice_feature_form in UC Variable Price 6

Same name and namespace in other branches
  1. 7 uc_varprice.module \uc_varprice_feature_form()
1 string reference to 'uc_varprice_feature_form'
uc_varprice_product_feature in ./uc_varprice.module
Implementation of hook_product_feature().

File

./uc_varprice.module, line 331
Defines a product feature to turn any product into a variable priced product.

Code

function uc_varprice_feature_form($form_state, $node, $feature) {
  $form = array();

  // Add some helper JS to the form.
  drupal_add_js(drupal_get_path('module', 'uc_varprice') . '/uc_varprice.js');

  // Load the Variable Price data specific to this product.
  if ($data = db_fetch_object(db_query("SELECT * FROM {uc_varprice_products} WHERE pfid = %d", $feature['pfid']))) {
    $data->sel_options = unserialize($data->sel_options);
  }
  $form['nid'] = array(
    '#type' => 'value',
    '#value' => $node->nid,
  );
  $form['pfid'] = array(
    '#type' => 'value',
    '#value' => $data ? $data->pfid : '',
  );
  $form += _uc_varprice_feature_form($data);
  return uc_product_feature_form($form);
}