Example #1
0
 public function productviewAction()
 {
     //Acl
     $this->view->title = 'Product';
     $id = $this->_request->getParam('id');
     $product = new Product_Model_Product();
     $this->view->productdetails = $product->getProduct($id);
 }
Example #2
0
 public function productdeleteAction()
 {
     $this->view->title = 'Product';
     $delform = new Product_Form_Delete();
     $this->view->deleteform = $delform;
     $dbobj = new Product_Model_Product();
     $id = $this->_getParam('id');
     $this->view->id = $id;
     $this->view->productdetails = $this->view->adm->getRecord('ourbank_product', 'id', $id);
     $getstatus = $dbobj->getproductstatus($id);
     //         // if that product id is not used by anyone we can delete that record
     if (!$getstatus) {
         if ($this->_request->isPost() && $this->_request->getPost('Delete')) {
             $id = $this->_getParam('id');
             $formData = $this->_request->getPost();
             //print_r($formData);
             if ($delform->isValid($formData)) {
                 $previousdata = $this->view->adm->editRecord("ourbank_product", $id);
                 $this->view->adm->updateLog("ourbank_product_log", $previousdata[0], $this->view->createdby);
                 //delete
                 $this->view->adm->deleteRecordwithparam('ourbank_product', 'id', $id);
                 $this->_redirect('product/index/');
             }
         }
     } else {
         $this->_helper->flashMessenger->addMessage('You cannot delete this product, its in usage');
         $this->_helper->redirector('index');
     }
 }