You are here

function uc_product_prepare in Ubercart 7.3

Implements hook_prepare().

File

uc_product/uc_product.module, line 505
The product module for Ubercart.

Code

function uc_product_prepare($node) {
  $defaults = array(
    'model' => '',
    'list_price' => 0,
    'cost' => 0,
    'sell_price' => 0,
    'weight' => 0,
    'weight_units' => variable_get('uc_weight_unit', 'lb'),
    'length' => 0,
    'width' => 0,
    'height' => 0,
    'length_units' => variable_get('uc_length_unit', 'in'),
    'pkg_qty' => 1,
    'default_qty' => 1,
    'shippable' => variable_get('uc_product_shippable_' . $node->type, 1),
    'ordering' => 0,
  );
  foreach ($defaults as $key => $value) {
    if (!isset($node->{$key})) {
      $node->{$key} = $value;
    }
  }
}