PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'pear_error_handler'); } if ($msg and !count($errs)) { /** redir on success **/ header(sprintf("Location: %s?nid=%d&msg=%s", $_SERVER['PHP_SELF'], $productid, base64_encode($msg))); exit; } /** build form **/ $fex = new formex('POST'); $allproducts = $pc->get_product_list(); $fex->js_src_inline = true; $fex->add_element($colmap); $fex->set_element_opts('cm_products_relations', $allproducts); $fex->add_element('op', array($ACTION, 'submit', null, null, 1)); $fex->add_element('nid', array('id', 'hidden', $productid, 1)); $fex->set_elem_default_vals('cm_products_relations', $pc->fetch_related_products()); /** **/ // get message for display if any if (isset($_GET['msg'])) { $msg = base64_decode($_GET['msg']); } # output template ############################################################################## ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>product media control framelet</title> <link rel="stylesheet" href="/control/control.css" type="text/css"> <link rel="stylesheet" href="/control/cshop/store.css" type="text/css"> </head>
$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 $link = sprintf('%s?op_edit=%d&nid=%d', $_SERVER['PHP_SELF'], $row['id'], $productid); $table->addRow($vals, null, true, $link); } $numrows = count($inv); if (!$numrows) { $fex->set_elem_default_vals('sku', $sku_base); $fex->add_element('op', array('CREATE', 'submit', null, null, 1)); } else { $fex->add_element('op', array('UPDATE', 'submit', null, null, 1)); } $invform = $fex->get_struct(); ############################################################################## # output template ############################################################################## ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>inventory control framelet</title> <link rel="stylesheet" href="/control/cshop/store.css" type="text/css"> <script type="text/javascript">
} if ($msg and !count($errs)) { /** redir on success **/ header(sprintf("Location: %s?nid=%d&msg=%s", $_SERVER['PHP_SELF'], $productid, base64_encode($msg))); exit; } /** build form **/ $fex = new formex('POST'); $allcats = $pcat->get_categories_for_select(0, 0, true); $fex->js_src_inline = true; $fex->add_element($colmap); $fex->set_element_opts('cm_products_categories', $allcats); $fex->add_element('op', array($ACTION, 'submit', null, null, 1)); $fex->add_element('nid', array('id', 'hidden', $productid, 1)); $product_info = $pc->fetch(array('title'), true); $fex->set_elem_default_vals('cm_products_categories', $product_info['cm_products_categories']); /** **/ // get message for display if any if (isset($_GET['msg'])) { $msg = base64_decode($_GET['msg']); } # output template ############################################################################## ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>product media control framelet</title> <link rel="stylesheet" href="/control/control.css" type="text/css"> <link rel="stylesheet" href="/control/cshop/store.css" type="text/css"> </head>
PEAR::setErrorHandling(PEAR_ERROR_RETURN); $shipclass = CSHOP_CLASSES_SHIPMETHOD; $ship = new $shipclass(); $ship->set_destination($shipdest); $shipquotes = $ship->get_all_quotes($cart); if (PEAR::isError($shipquotes)) { $errs[] = $shipquotes->getMessage(); } elseif ($ship->has_calculation_error) { $errs = $ship->calculation_errors; } elseif (count($shipquotes)) { if ($ship->qualifies_freeship) { $smarty->assign('HAVE_FREE_SHIP', true); } $fex->add_element('ship_method', array('Shipping Method', 'radio', $shipquotes, 1)); // set the first radio button to default checked: $fex->set_elem_default_vals('ship_method', array_shift(array_keys($shipquotes))); $smarty->assign('shipquotes', $shipquotes); } /* remember all the current quotes on the server to detect any tampering in next step*/ $_SESSION['shipquotes'] = $shipquotes; /** also now we can calculate tax to that shipping address. Store in the cart table * and let the luser know */ $taxtotal = $cart->calculate_tax(); $smarty->assign('tax_total', $taxtotal); $smarty->assign('action', 'checkout_pickshipmethod'); $tpl = 'checkout_pickship.tpl'; } elseif ($ACTION == OP_GET_BILL) { $cart_total = $cart->get_grandtotal(); $smarty->assign('cart_grandtotal', $cart_total); /* add form fields for GiftCards and get current totals for display */ if (defined('CSHOP_ACCEPT_GIFTCARDS') && CSHOP_ACCEPT_GIFTCARDS) {