Beispiel #1
0
        $SUCCESS = "inventory record removed from the system";
    }
}
/** setup the form that goes at the top */
$pc->set_id($productid);
$onchange = 'onchange="cmSetSkuField()"';
$fex = new formex('POST');
$fex->add_element('sizes', array('Size', 'select', array(), null, $onchange, 1));
$fex->add_element('colors', array('Colors', 'select', array(), null, $onchange, 1));
$fex->add_element('qty', array('Qty', 'text', 1, array('size' => 3, 'maxlength' => 6), 1));
$fex->add_element('sku', array('SKU', 'text', '', array('size' => 16, 'maxlength' => 64), 1));
if ($USE_ADDERS) {
    $fex->add_element('adder', array('Adder', 'text', '0.00', array('size' => 7, 'maxlength' => 10), 'onchange="cmAddPrice(this.value)"', 1));
}
$fex->add_element('nid', array('id', 'hidden', $productid, null));
$fex->set_element_opts('sizes', array('' => '-----') + cshopUtils::get_all_sizes($pdb));
$fex->set_element_opts('colors', array('' => '-----') + cshopUtils::get_all_colors($pdb));
if (isset($invid) and $ACTION == OP_EDIT) {
    $sql = sprintf("SELECT i.sizes_id AS sizes, i.colorways_id AS colors, i.qty, i.sku, adder\n                            , IFNULL((p.price + adder), p.price) AS total_price\n                    FROM {$inventory_table} i, cm_products p WHERE i.id = %d AND p.id = i.product_id", $invid);
    $inv_record = $pdb->getRow($sql);
    $fex->elem_vals = $inv_record;
    $killlink = sprintf('%s?op_kill=%d&nid=%d', $_SERVER['PHP_SELF'], $invid, $productid);
}
/* get the product SKU as a base, for the JS magic in the Size/Color selects */
$sku_base = $pc->get_header('sku');
$base_price = $pc->get_header('price');
$total_price = isset($inv_record) ? $inv_record['total_price'] : $base_price;
/** list all inventory records in one big ass dump using HTML_Table **/
$table = new fu_HTML_Table(array('width' => '90%', 'align' => 'center'));
$table->setAutoGrow(true);
$table->setAutoFill("-");