public function productviewAction() { //Acl $this->view->title = 'Product'; $id = $this->_request->getParam('id'); $product = new Product_Model_Product(); $this->view->productdetails = $product->getProduct($id); }
public function producteditAction() { $this->view->title = "Product"; $productForm = new Product_Form_Product(); $this->view->form = $productForm; $id = $this->_getParam('id'); $this->view->id = $id; // $categoryid = $this->view->adm->getsingleRecord('ourbank_product','category_id','id',$id); if ($id == 1 || $id == 2 || $id == 3) { $this->_helper->flashMessenger->addMessage('You cannot edit this product, its a basic product'); $this->_helper->redirector('index'); } $productname = $this->view->adm->viewRecord("ourbank_category", "id", "DESC"); foreach ($productname as $productname) { $productForm->category_id->addMultiOption($productname['id'], $productname['name']); } $product = new Product_Model_Product(); $productdetails = $product->getProduct($id); $productForm->populate($productdetails[0]); if ($this->_request->isPost() && $this->_request->getPost('Update')) { $id = $this->_getParam('id'); $formData = $this->_request->getPost(); //print_r($formData); if ($productForm->isValid($formData)) { $previousdata = $this->view->adm->editRecord("ourbank_product", $id); $this->view->adm->updateLog("ourbank_product_log", $previousdata[0], $this->view->createdby); //update $this->view->adm->updateRecord("ourbank_product", $id, $productForm->getValues()); $this->_redirect('product/index/'); } } }