Example #1
0
 public function editAction($id)
 {
     $request = $this->request;
     if (!$request->isPost()) {
         $producttypes = ProductTypes::findFirstById(array('id=:id:', 'bind' => array('id' => $id)));
         if (!$producttypes) {
             $this->flash->error("Product type to edit was not found");
             return $this->forward("producttypes/index");
         }
         $this->view->setVar("id", $producttypes->id);
         Tag::displayTo("id", $producttypes->id);
         Tag::displayTo("name", $producttypes->name);
     }
 }
Example #2
0
 /**
  * Deletes a producttypes
  *
  * @param string $id
  */
 public function deleteAction($id)
 {
     $productTypes = ProductTypes::findFirstById($id);
     if (!$productTypes) {
         $this->flash->error("Product types was not found");
         return $this->forward("producttypes/index");
     }
     if (!$productTypes->delete()) {
         foreach ($productTypes->getMessages() as $message) {
             $this->flash->error($message);
         }
         return $this->forward("producttypes/search");
     }
     $this->flash->success("product types was deleted");
     return $this->forward("producttypes/index");
 }