"; print "imagedescriptionpriceshippingModelBladesEdit and Delete"; while (($result = tep_db_fetch_array($query)) !== false) { print ""; print sprintf("%s%5.2f%5.2f%s%sDelete", HTTP_CATALOG_SERVER, DIR_WS_IMAGES, $result["family_picture"], $result["family_desc"], $result["family_price"], $result["family_shipping"], $result["family_model"], $result["family_blades"], $result["subproductid"], $productid); print ""; } print ""; } function add() { $blades[] = array('id' => '+blades', 'text' => '+Blades'); $blades[] = array('id' => 'null', 'text' => 'null'); $productid = isset($_REQUEST["productid"]) ? intval($_REQUEST["productid"]) : 0; print "\n"; print "\n"; print "add subproduct\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
family image" . tep_draw_file_field("family_picture") . "
family Pic Large for Popup" . tep_draw_file_field("family_pic_large") . "
family desc" . tep_draw_textarea_field("family_desc", "soft", "70", "15", "description") . "
family price" . tep_draw_input_field("family_price", 0) . "
family shipping" . tep_draw_input_field("family_shipping", 0) . "
Family Model" . tep_draw_input_field("family_model") . "
Family Blades" . tep_draw_pull_down_menu('family_blades', $blades) . "
\n"; print "
\n"; print "
"; $this->summary(); print "\n"; print "\n"; } function delete() { $subproductid = isset($_REQUEST["subproductid"]) ? intval($_REQUEST["subproductid"]) : 0; if ($subproductid ==0) { $subproductid = isset($_REQUEST["pID"]) ? intval($_REQUEST["pID"]) : 0; } //var_dump($_REQUEST); // Do delete statement. $query = tep_db_query("delete * from family_product where products_id='" . (int)$productid . "'"); $productid = isset($_REQUEST["productid"]) ? intval($_REQUEST["productid"]) : 0; tep_redirect("subproduct.php?action=add&productid={$productid}"); } Function edit() { $subproductid = isset($_REQUEST["subproductid"]) ? intval($_REQUEST["subproductid"]) : 0; if ($subproductid ==0) { $subproductid = isset($_REQUEST["pID"]) ? intval($_REQUEST["pID"]) : 0; } $select = "select * from family_product where subproductid = '$subproductid'"; $row = mysql_fetch_assoc($select); print_r($row); $blades[] = array('id' => '+blades', 'text' => '+Blades'); $blades[] = array('id' => 'null', 'text' => 'null'); print "\n"; print "\n"; print "add subproduct\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
family image" . tep_draw_file_field("family_picture") . "
family Pic Large for Popup" . tep_draw_file_field("family_pic_large") . "
family desc" . tep_draw_textarea_field("family_desc", "soft", "70", "15", "description") . "
family price" . tep_draw_input_field("family_price") . "
family shipping" . tep_draw_input_field("family_shipping", 0) . "
Family Model" . tep_draw_input_field("family_model") . "
Family Blades" . tep_draw_pull_down_menu('family_blades', $blades) . "
\n"; print "
\n"; print "
"; $this->summary(); print "\n"; print "\n"; } function insert() { global $messageStack, $HTTP_POST_VARS, $HTTP_GET_VARS; $productid = isset($_POST["productid"]) ? intval($_POST["productid"]) : 0; $image = new upload("family_picture"); $image->set_destination(DIR_FS_CATALOG_IMAGES); if ($image->parse() && $image->save()) { $image = $image->filename; } else { var_dump($messageStack); return; } $image_x = new upload("family_pic_large"); $image_x->set_destination(DIR_FS_CATALOG_IMAGES); if ($image_x->parse() && $image_x->save()) { $image_x = $image_x->filename; } else { var_dump($messageStack); return; } // var_dump($image_x); // var_dump($HTTP_POST_VARS); $dat = array("products_id" => (int)tep_db_prepare_input($productid), "family_picture" => $image, "family_pic_large" => $image_x, "family_desc" => tep_db_prepare_input($HTTP_POST_VARS["family_desc"]), "family_price" => tep_db_prepare_input($HTTP_POST_VARS["family_price"]), "family_model" => tep_db_prepare_input($HTTP_POST_VARS["family_model"]), "family_blades" => tep_db_prepare_input($HTTP_POST_VARS["family_blades"]), "family_shipping" => tep_db_prepare_input($HTTP_POST_VARS["family_shipping"])); tep_db_perform("family_product", $dat, "insert"); tep_redirect("subproduct.php?action=add&productid={$productid}"); return; } function main() { tep_db_connect(); $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : null; switch ($action) { case "summary": $this->summary(); break; case "add": $this->add(); break; case "insert": $this->insert(); break; case "delete": $this->delete(); break; case "edit": $this->edit(); break; default: print "unknown mode"; break; } tep_db_close(); } } $sp = new subproduct(); $sp->main(); ?>