コード例 #1
0
ファイル: store.edit.list.php プロジェクト: sbeam/cshop
 */
require_once CONFIG_DIR . 'cshop.config.php';
require_once "fu_HTML_Table.class.php";
require_once "filter_form.class.php";
require_once "res_pager.class.php";
require_once "store.edit.inc.php";
/** **/
$range = 50;
$offset = isset($_GET['page']) ? ($_GET['page'] - 1) * $range : 0;
$filt = new filter_form('GET');
$filt->left_td_style = '';
$filt->field_prefix = '';
$filt->add_element('hdr1', array('Category:', 'heading'));
$filt->add_element('cat', array('', 'select', cshopUtils::get_all_categories($pdb, true)));
$filt->add_element('hdr2', array('Manufacturer', 'heading'));
$filt->add_element('mfr', array('', 'select', cshopUtils::get_all_manufacturers($pdb, true)));
$filt->add_element('hdr3', array('SKU', 'heading'));
$filt->add_element('sku', array('', 'text', '', array('size' => 5)));
$filt->add_element('op_filter', array('GO', 'submit'));
/** if there were things selected in the filter forms then make up some WHERE
 * clauses to narrow the results */
$where = '';
$getvars = '';
if (isset($_GET['mfr']) or isset($_GET['cat'])) {
    $where = 'WHERE 1=1 ';
    if (!empty($_GET['mfr'])) {
        $where .= ' AND cm_manufacturers_id = ' . $pdb->quoteSmart($_GET['mfr']);
        $getvars .= '&mfr=' . urlencode($_GET['mfr']);
    }
    if (!empty($_GET['cat'])) {
        $where .= ' AND pc.cm_categories_id = ' . $pdb->quoteSmart($_GET['cat']);
コード例 #2
0
ファイル: store.edit.php プロジェクト: sbeam/cshop
        $msg = "Product was successfully removed from the site";
    }
    header("Location: store.edit.list.php?info=" . base64_encode($msg));
}
if ($SHOWFORM) {
    $fex->left_td_style = '';
    if ($ACTION == OP_EDIT) {
        $pc->set_id($productid);
    }
    if (isset($pc->colmap_help) && is_array($pc->colmap_help)) {
        foreach ($pc->colmap_help as $k => $text) {
            $fex->set_elem_helptext($k, $text);
        }
    }
    if (isset($colmap['cm_manufacturers_id'])) {
        $fex->set_element_opts('cm_manufacturers_id', cshopUtils::get_all_manufacturers($pdb));
    }
    if (isset($colmap['cm_ship_class_id'])) {
        $fex->set_element_opts('cm_ship_class_id', cshopUtils::get_all_ship_classes($pdb));
    }
    if ($ACTION == OP_EDIT) {
        $fex->elem_vals = $pc->fetch(null, true);
        $product_name = $fex->elem_vals['title'];
        $fex->add_element('id', array('', 'hidden', $productid, null));
        // important
    }
    $fex->add_element('op', array($ACTION, 'submit'));
    // the button
    if ($ACTION == OP_EDIT) {
        $confirm_msg = 'This will remove this product from the site permanently. Are you sure?';
        $fex->add_element('op_kill', array(OP_KILL, 'submit', null, array('class' => 'killButton'), "onclick=\"return confirm('{$confirm_msg}')\""));