Exemplo n.º 1
0
    $fex->add_element('op', array($ACTION, 'submit'));
    // the button
    if ($orders = $user->fetch_order_history()) {
        $table = new fu_HTML_Table(array("width" => "820"));
        $table->setAutoGrow(true);
        $table->setAutoFill("-");
        $table->addRow(array('Order Number', 'Ship name', 'Status', 'Date', 'Amt Quoted'), 'header', false);
        foreach ($orders as $o) {
            $vals = array($o['order_token'], $o['shipping_name'], $o['status'], date('d M Y', strtotime($o['order_create_date'])), $o['amt_quoted']);
            $link = sprintf('store.orders.php?tok=%s', $o['order_token']);
            $table->addRow($vals, '', false, $link);
        }
    }
} else {
    /** list all cm_categories in one big ass dump using HTML_Table **/
    $table = new fu_HTML_Table(array("width" => "600"));
    $table->setAutoGrow(true);
    $table->setAutoFill("n/a");
    $header_row = array();
    if (!isset($user->control_header_cols)) {
        $cols = array('cust_name', 'last_name', 'first_name', 'company', 'email', 'perms');
        foreach ($cols as $k) {
            if (!empty($user->colmap[$k])) {
                $header_row[$k] = $user->colmap[$k][0];
            }
        }
    } else {
        $header_row =& $user->control_header_cols;
        $cols = array_keys($user->control_header_cols);
    }
    if (isset($_GET['by']) and (in_array($_GET['by'], $cols) or $_GET['by'] == 'num_orders')) {
Exemplo n.º 2
0
    // the button
    if ($ACTION == OP_EDIT) {
        $bundle->set_id($req_id);
        $vals = $bundle->fetch();
        $fex->elem_vals = $vals;
        $method_title = $vals['title'];
        $fex->add_element('id', array('hid id', 'hidden', $req_id));
        // important
        $confirm_msg = 'This will remove this item from the site permanently. Are you sure?';
        $fex->add_element('op_kill', array('REMOVE', 'submit', null, array('class' => 'ccomKillSwitch'), "onclick=\"return confirm('{$confirm_msg}')\""));
    } else {
        $method_title = 'ADD NEW ZONE';
    }
    $form = $fex->get_struct();
} else {
    $table = new fu_HTML_Table(array('width' => '100%'));
    $table->setAutoGrow(true);
    $table->setAutoFill("—");
    $header_row = array('title' => 'Bundle Name', 'base_price' => 'Base', 'qty_inventory' => 'On hand');
    $table_ordercol = isset($_GET['by']) ? $_GET['by'] : 'title';
    $order_dir = (!isset($_GET['dir']) or $_GET['dir'] == 'A') ? 'ASC' : 'DESC';
    /** decide on which result page to show **/
    $bundle->set_range($rows_per_page);
    $offset = isset($_GET['page']) ? $rows_per_page * $_GET['page'] - 1 : 0;
    $bundle->set_offset($offset);
    /** **/
    $have_table = false;
    $cols = array_merge(array('id'), array_keys($header_row));
    if ($rows = $bundle->fetch_any($cols, 0, 0, $table_ordercol, null, $order_dir)) {
        $have_table = true;
        $table->addSortRow($header_row, $table_ordercol, null, 'TH', '', $order_dir);
Exemplo n.º 3
0
        $fex->add_element('id', array('hid id', 'hidden', $catid, null));
        // important
        $cat_name = $fex->elem_vals['name'];
        /** if there are zero products in this category, let them delete it **/
        $sql = sprintf("SELECT COUNT(*) FROM cm_products_categories WHERE cm_categories_id = %d", $catid);
        $product_count = $pdb->getOne($sql);
        if ($product_count) {
            $confirm_msg = "There are {$product_count} products that are in this category. If you delete the category, they may be hidden from customers. Are you sure?";
        } else {
            $confirm_msg = 'This will remove this category from the site permanently. Are you sure?';
        }
        $fex->add_element('op_kill', array(OP_KILL, 'submit', null, null, 'onclick="return confirm(\'' . $confirm_msg . '\')"'));
    }
} else {
    /** list all cm_categories in one big ass dump using HTML_Table **/
    $table = new fu_HTML_Table(array("width" => "600"));
    $table->setAutoGrow(true);
    $table->setAutoFill("n/a");
    $header_row = array('name' => 'Name', 'shipType' => 'Ship Class', 'taxable' => 'Tax', 'iLevel' => 'Level', 'is_active' => 'live?', 'feature_rank' => 'Feature Rank', 'order_weight' => 'Order Weight', 'product_count' => '#Products');
    $table->addSortRow($header_row, null, null, 'TH', null);
    $sql = "SELECT c.id, c.name, c.ship_class_id, c.is_taxable, c.level, c.is_active, c.parent_cat_id, c.feature_rank, c.order_weight\n                   , COUNT(pc.cm_products_id) AS product_count\n                   , IFNULL(CONCAT(cat.name, ':', c.name), c.name) AS concat_name\n            FROM {$tablename} c \n            LEFT JOIN cm_products_categories pc ON (pc.cm_categories_id = c.id)\n            LEFT JOIN cm_categories cat ON (cat.id = c.parent_cat_id)\n            GROUP BY (c.id)\n            ORDER BY c.order_weight, concat_name";
    $res = $pdb->query($sql);
    while ($row = $res->fetchRow()) {
        $vals = array($row['concat_name'], $shipTypes[$row['ship_class_id']], $row['is_taxable'] ? 'Y' : 'N', $row['level'] == 0 ? 'top' : 'sub', $row['is_active'] ? 'Y' : 'N', $row['feature_rank'] ? $row['feature_rank'] : '-', $row['order_weight'], $row['product_count']);
        $link = sprintf('%s?cat=%d', $_SERVER['PHP_SELF'], $row['id']);
        $table->addRow($vals, '', null, $link);
    }
    $numrows = $res->numRows();
}
##############################################################################
# output template
Exemplo n.º 4
0
    $fex->add_element('op', array($ACTION, 'submit'));
    // the button
    $fex->add_element('class', array(null, 'hidden', $class));
    // important
    if ($ACTION == OP_EDIT) {
        $dbc->set_id($itemid);
        $fex->elem_vals = $dbc->fetch('', true);
        $fex->add_element('id', array(null, 'hidden', $itemid));
        // important
        $cat_name = $fex->elem_vals[$table_namecol];
        $confirm_msg = sprintf('This will remove this %s from the site permanently. Are you sure?', $table_title);
        $fex->add_element('op_kill', array(OP_KILL, 'submit', null, null, 'onclick="return confirm(\'' . $confirm_msg . '\')"'));
    }
} else {
    /** list all cm_colors in one big ass dump using HTML_Table **/
    $table = new fu_HTML_Table(array("width" => "600"));
    $table->setAutoGrow(true);
    $table->setAutoFill("n/a");
    $header_row = array();
    if (!isset($dbc->control_header_cols)) {
        foreach ($colmap as $k => $v) {
            $header_row[$k] = $v[0];
        }
    } else {
        $header_row =& $dbc->control_header_cols;
    }
    if (isset($_GET['by'])) {
        $orby = $_GET['by'];
        if (in_array($orby, array_keys($header_row))) {
            $table_ordercol = $orby;
        }
Exemplo n.º 5
0
        // important
        $cat_name = $fex->elem_vals['sName'];
        /** if there are zero products in this manufacturer, let them delete it **/
        $sql = sprintf("SELECT COUNT(*) FROM products WHERE manufacturerid = %d", $mfrid);
        $product_count = $pdb->getOne($sql);
        if ($product_count) {
            $confirm_msg = "There are {$product_count} products that are associated with this manufacturer. You cannot delete the manufacturer until all these products have been removed or reassigned";
            $fex->add_element('op_kill', array(OP_KILL, 'submit', null, null, 'onclick="alert(\'' . $confirm_msg . '\'); return false"'));
        } else {
            $confirm_msg = 'This will remove this manufacturer from the site permanently. Are you sure?';
            $fex->add_element('op_kill', array(OP_KILL, 'submit', null, null, 'onclick="return confirm(\'' . $confirm_msg . '\')"'));
        }
    }
} else {
    /** list all manufacturers in one big ass dump using HTML_Table **/
    $table = new fu_HTML_Table(array("width" => "600"));
    $table->setAutoGrow(true);
    $table->setAutoFill("n/a");
    $header_row = array('sName' => 'Name', 'product_count' => '#Products');
    $table->addSortRow($header_row, null, null, 'TH', null);
    $table->addCol(array('Edit/Del'), 'align="center"', 'th');
    $sql = "SELECT m.id, m.sName, COUNT(p.id) AS product_count\n            FROM  manufacturers m LEFT JOIN products p ON (p.manufacturerid = m.id) \n            GROUP BY (m.id)\n            ORDER BY sName";
    $res = $pdb->query($sql);
    while ($row = $res->fetchRow()) {
        $vals = array($row['sName']);
        // store.edit.php?nid=444
        $vals[] = sprintf('<a href="store.edit.list.php?mfr=%d">%d</a>', $row['id'], $row['product_count']);
        $vals[] = sprintf('<a href="store.manufacturers.php?mfr=%d" class="buttonEditItem">&raquo;</a>', $row['id']);
        $table->addRow($vals);
    }
    $numrows = $res->numRows();
Exemplo n.º 6
0
        $cy = array();
        foreach ($vals['cm_shipmethods_zone_locales'] as $iso) {
            $cy[$iso] = $country_opts[$iso];
        }
        $vals['cm_shipmethods_zone_locales'] = $cy;
        $fex->elem_vals = $vals;
        $method_title = $vals['zone_name'];
        $fex->add_element('id', array('hid id', 'hidden', $req_id));
        // important
    } else {
        $method_title = 'ADD NEW ZONE';
    }
    $form = $fex->get_struct();
} else {
    /** or a fu_HTML_Table showing all coupons TODO paging ***********************************/
    $table = new fu_HTML_Table(array('width' => '100%'));
    $table->setAutoGrow(true);
    $table->setAutoFill("&mdash;");
    $have_zones = false;
    if ($rows = $sm->get_avail_zones()) {
        $have_zones = true;
        $table->addRow(array('Zone Name'), 'TH');
        foreach ($rows as $row) {
            $class = 'controlListingRow';
            $link = sprintf('%s?op_edit=%d', $_SERVER['PHP_SELF'], $row['id']);
            unset($row['id']);
            $table->addRow(array_values($row), $class, true, $link);
        }
    }
}
##############################################################################
Exemplo n.º 7
0
        if (isset($vals[$dbc->_table_namecol])) {
            $crumbs[$vals[$dbc->_table_namecol]] = $_SERVER['PHP_SELF'] . "?{$base_get_vars}&op_edit=" . $vals['id'];
        }
        $action_name = 'edit';
    } else {
        // I had dejå vu when I wrote this code
        $fex->add_element('but', array('ADD', 'submit'));
        $action_name = 'add';
    }
    $crumbs[$action_name] = null;
    $form_underframe = ($ACTION & OP_EDIT and $dbc->has_dependents) ? $dbc->dependent_class : null;
    $fex->add_element('op', array(null, 'hidden', $ACTION, null));
    $fex->add_element('page', array(null, 'hidden', $page_id, null));
    $fex->add_element('parent_id', array(null, 'hidden', $page_parent_id, null));
} else {
    $table = new fu_HTML_Table();
    $table->setAutoGrow(true);
    $table->setAutoFill("n/a");
    $header_row = array();
    if ($dbc->control_cols) {
        foreach ($dbc->control_cols as $k) {
            $header_row[$k] = isset($colmap[$k]) ? $colmap[$k][0] : '';
        }
    } else {
        foreach ($colmap as $k => $v) {
            $header_row[$k] = $v[0];
        }
    }
    $table_ordercol = $dbc->col_orderby_def;
    if (isset($_GET['by'])) {
        $table_ordercol = $_GET['by'];
Exemplo n.º 8
0
    $fex = new formex('POST');
    $fex->js_src_inline = true;
    $fex->add_element($colmap);
    $fex->add_element('op', array($ACTION, 'submit', null, null, 1));
    $fex->add_element('nid', array('id', 'hidden', $productid, null));
    $fex->set_element_opts('colorways_id', cshopUtils::get_all_colors($pdb, true));
    if ($ACTION == OP_EDIT) {
        $sql = sprintf("SELECT colorways_id, order_weight, class, filename_large AS upfile\n                        FROM {$tablename} WHERE id = %d", $reqid);
        $row = $pdb->getRow($sql);
        $fex->elem_vals = $row;
        $fex->add_element('reqid', array('reqid', 'hidden', $reqid, null));
        $fex->add_element('op_kill', array(OP_KILL, 'submit', null, null, 'onclick="return confirm(\'Are you sure?\')"'));
    }
} else {
    /** list all cm_categories in one big ass dump using HTML_Table **/
    $table = new fu_HTML_Table(array('width' => '90%', 'align' => 'center'));
    $table->setAutoGrow(true);
    $table->setAutoFill("-");
    $header_row = array('class' => 'Class', 'filename_fmt' => 'File Name', 'colorname' => 'Colorway', 'order_weight' => 'weight');
    $table->addRow(array_values($header_row), null, 'TH');
    $table->addCol(array('&nbsp;'), 'align="center"', 'th');
    $sql = sprintf("SELECT pi.id, pi.class, pi.order_weight, system_location, filename_large, filename_thumb, dims_thumb, cw.name AS colorname\n                    FROM cm_product_images pi \n                        LEFT JOIN cm_colorways cw ON (cw.id = colorways_id)\n                    WHERE cm_products_id = %d\n                    ORDER BY pi.order_weight, cw.name", $productid);
    $res = $pdb->query($sql);
    while ($row = $res->fetchRow()) {
        $vals = array();
        $row['filename_fmt'] = strlen($row['filename_large']) > 30 ? substr($row['filename_large'], 0, 27) . '...' : $row['filename_large'];
        foreach (array_keys($header_row) as $k) {
            $vals[] = $row[$k];
        }
        // store.edit.php?nid=444
        $vals[] = sprintf('<img src="%s/%s" %s alt="" />', $row['system_location'], $row['filename_thumb'], $row['dims_thumb']);
Exemplo n.º 9
0
}
$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("-");
$header_row = array('sku' => 'SKU', 'size' => 'size', 'color' => 'Color', 'qty' => 'Qty.');
if ($USE_ADDERS) {
    $header_row['adder'] = 'Adder';
    $header_row['total_price'] = 'Total';
}
$table->addRow(array_values($header_row), null, 'TH');
$inv = $pc->fetch_all_inventory();
foreach ($inv as $row) {
    $vals = array();
    foreach (array_keys($header_row) as $k) {
        $vals[] = $row[$k];
    }
    // store.edit.php?nid=444
Exemplo n.º 10
0
    // get all of the products joined with the inventory levels, colors, sizes, etc
    // organized: title, sku, size, color way, qty in stock
    $inv = $prod->fetch_inventory_report(null, 'title', 'asc', 0, 999000);
    $cols = array('title', 'sku', 'size_code', 'color_name', 'qty');
    $csv = new CSV_Table_Fu();
    $csv->show_cols = $cols;
    $csv->print_csv_headers(SITE_DOMAIN_NAME . '-inventory_dump.csv');
    $csv->dumpall($inv);
    exit;
}
$range = 50;
$offset = isset($_GET['page']) ? ($_GET['page'] - 1) * $range : 0;
/** go get im **/
$report = $prod->fetch_inventory_report($pid, $orby, $order_dir, $offset, $range, $filter_cat_id);
/** list all cm_categories in one big ass dump using HTML_Table **/
$table = new fu_HTML_Table(array('width' => '90%', 'align' => 'center', 'style' => 'padding-top: 25px'));
$table->setAutoGrow(true);
$table->setAutoFill("-");
$xgets = $mosh->make_get_params($_GET, array('by', 'dir'));
$table->addSortRow($header_row, $orby, null, 'TH', $xgets, $order_dir);
$sep = strpos($_SERVER['REQUEST_URI'], '?') === false ? '?' : '&';
$csv_link = $_SERVER['REQUEST_URI'] . $sep . 'op_csv';
foreach ($report as $row) {
    $vals = array();
    $link = null;
    if (isset($link_fmt)) {
        $args = array();
        foreach ($link_vals as $v) {
            $args[] = $row[$v];
        }
        $link = vsprintf($link_fmt, $args);
Exemplo n.º 11
0
             $w[] = sprintf('ord.order_token = %s', $pdb->quote($_GET['fq']));
         } elseif ($_GET['fc'] == 'user.email') {
             $w[] = sprintf('u.email LIKE %s', $pdb->quote($_GET['fq']));
         } elseif ($_GET['fc'] == 'user.name' and strlen($_GET['fq']) > 2) {
             $w[] = 'u.cust_name LIKE \'%%' . addslashes($_GET['fq']) . '%%\'';
         }
     }
     if (count($w)) {
         $where = join(' AND ', $w);
     }
 }
 /** **/
 $header_row = array('ord.id' => 'Order ID', 'order_token' => 'Order Number', 'email' => 'User', 'perms' => 'Cust', 'orders_status' => 'Status', 'order_create_date' => 'Order Date', 'amt_quoted' => 'Total', 'ship_date' => 'Ship Date');
 if ($orders = $order->fetch_any(null, $offset, $range, $orby, $where, $orderdir)) {
     /** list all cm_categories in one big ass dump using HTML_Table **/
     $table = new fu_HTML_Table(array("width" => "860"));
     $table->setAutoGrow(true);
     $table->setAutoFill("n/a");
     $table->addSortRow($header_row, $orby, null, 'TH', null, $orderdir);
     /* we got orders. add to $table object */
     foreach ($orders as $o) {
         $name = !empty($o['cust_name']) ? $o['cust_name'] : $o['first_name'] . ' ' . $o['last_name'];
         if (!empty($o['company'])) {
             $name .= " [{$o['company']}]";
         }
         $email = !empty($o['email']) ? $o['email'] : $o['anon_email'];
         $vals = array($o['id'], $o['order_token'], "{$name} &lt;{$email}&gt;", $o['perms'], $order->statuses[$o['orders_status']], date('d M Y', strtotime($o['order_create_date'])), $o['amt_quoted'], $o['ship_date']);
         $link = sprintf('%s?%s=%s', $_SERVER['PHP_SELF'], $reqIdKey, $o['order_token']);
         $class = '';
         if (isset($order_list_colors[$o['orders_status']])) {
             $table->bgcolor_alts = $order_list_colors[$o['orders_status']];
Exemplo n.º 12
0
            }
        }
    }
} elseif ($ACTION == OP_KILL) {
    $download->set_id($thisid);
    if ($download->kill()) {
        $msg = $thing . ' has been deleted.';
    }
}
if (!empty($msg) and !count($errs)) {
    /** redir on success **/
    header(sprintf("Location: %s?pid=%d&msg=%s", $_SERVER['PHP_SELF'], $productid, base64_encode($msg)));
    exit;
}
if (!$ACTION) {
    $table = new fu_HTML_Table(array('width' => '90%', 'align' => 'center'));
    $header_row = array('name' => 'Name', 'url' => 'URL', 'is_active' => 'Active?');
    $table->addSortRow($header_row);
    $numrows = 0;
    if ($downloads = $download->fetch_by_product_id($productid)) {
        foreach ($downloads as $row) {
            $vals = array();
            $row['url'] = sprintf('<a href="%s">%s</a>', $row['url'], $row['url']);
            foreach (array_keys($header_row) as $k) {
                $vals[] = $row[$k];
            }
            // store.edit.php?nid=444
            $link = sprintf('%s?op_edit=%d&pid=%d', $_SERVER['PHP_SELF'], $row['id'], $productid);
            $table->addRow($vals, null, true, $link);
        }
        $numrows = count($downloads);
Exemplo n.º 13
0
}
$order_dir = (empty($_GET['dir']) or $_GET['dir'] == 'D') ? 'DESC' : 'ASC';
$sql = sprintf($sql, $orby, $order_dir);
/** go get im **/
$res = $pdb->query($sql);
/** list all cm_categories in one big ass dump using HTML_Table **/
/** list all cm_categories in one big ass dump using HTML_Table **/
if (isset($_GET['op_csv'])) {
    $table = new CSV_Table_Fu();
    $csv_headers = array();
    foreach ($header_row as $k => $v) {
        $csv_headers[] = preg_replace('/<[^>]+>/', " ", $v);
    }
    $table->addSortRow(array_values($csv_headers));
} else {
    $table = new fu_HTML_Table(array("id" => "reports"));
    $table->setAutoGrow(true);
    $table->setAutoFill("-");
    $xgets[] = "report={$ACTION}";
    $table->addSortRow($header_row, $fake_orby, null, 'TH', join('&', $xgets), $order_dir);
    #$tfoot = $table->getFooter();
    #$tfoot->addRow(array_values($header_row));
    $sep = strpos($_SERVER['REQUEST_URI'], '?') === false ? '?' : '&';
    $csv_link = $_SERVER['REQUEST_URI'] . $sep . 'op_csv';
}
while ($row = $res->fetchRow()) {
    $vals = array();
    $link = null;
    if (isset($link_fmt)) {
        $args = array();
        foreach ($link_vals as $v) {