public function pdShowAction($product_id) { if (!$this->request->isPost()) { $dtb_product = DtbProduct::findFirstByproduct_id($product_id); if (!$dtb_product) { $this->flash->error("dtb_product was not found"); return $this->dispatcher->forward(array("controller" => "user_product", "action" => "index")); } $this->view->product_id = $dtb_product->product_id; $this->tag->setDefault("product_id", $dtb_product->getProductId()); $this->tag->setDefault("user_Id", $dtb_product->getUserId()); $this->tag->setDefault("project_name", $dtb_product->getProjectName()); $this->tag->setDefault("product_name", $dtb_product->getProductName()); $this->tag->setDefault("price", $dtb_product->getPrice()); $this->tag->setDefault("product_img", $dtb_product->getProductImg()); $this->tag->setDefault("exist_num", $dtb_product->getExistNum()); } }
/** * Deletes a dtb_product * * @param string $product_id */ public function deleteAction($product_id) { $dtb_product = DtbProduct::findFirstByproduct_id($product_id); if (!$dtb_product) { $this->flash->error("dtb_product was not found"); return $this->dispatcher->forward(array("controller" => "user_product", "action" => "index")); } if (!$dtb_product->delete()) { foreach ($dtb_product->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array("controller" => "dtb_product", "action" => "search")); } $this->flash->success("dtb_product was deleted successfully"); return $this->dispatcher->forward(array("controller" => "user_product", "action" => "index")); }