Example #1
0
 public function editAction()
 {
     $id = $this->_getParam('id', 0);
     if ($id > 0) {
         $products = new Application_Model_Products();
         $this->view->entries = $products->find($id);
     }
 }
Example #2
0
 public function productAction()
 {
     // action body
     $id = $this->_getParam('id', 0);
     $code = $this->_getParam('productcode', '');
     $product = new Application_Model_Products();
     if ($id > 0) {
         $this->_helper->json($product->find($id));
     }
     if ($code != '') {
         $code = trim($code);
         $where = "ProductCode='" . $code . "'";
         $info = $product->fetchAll('Id', $where);
         if (isset($info['products'][0]['Id'])) {
             $this->_helper->json($product->find($info['products'][0]['Id']));
         } else {
             $this->_helper->json('');
         }
     }
 }