findOneById($_GET['delete']); } if(isset($_GET['modify'])) { $type = 'modify'; $product = ProductQuery::create()->findOneById($_GET['modify']); } if(isset($_GET['add'])) { $type = "add"; $product = new Product(); } if(!is_object($product)) { header("Location: products.php?id={$catid}"); } if(isset($_GET['delete'])) { $product->delete(); header("Location: products.php?id={$catid}"); } if(isset($_POST['name']) && isset($_POST['price']) && isset($_POST['width']) && isset($_POST['height']) && isset($_POST['desc']) && isset($_POST['cat'])) { $product->setName($_POST['name']); $product->setPrice($_POST['price']); $product->setWidth($_POST['width']); $product->setHeight($_POST['height']); $product->setDescription($_POST['desc']); if(is_array($_POST['cat'])) { $catCollect = new Propel\Runtime\Collection\Collection(); foreach ($_POST['cat'] as $categoryID) { $catCollect->set($categoryID, CategoryQuery::create()->findOneById($categoryID)); } $product->setCategories($catCollect); } $product->save(); header("Location: products.php?id={$catid}"); } ?>