public function newAction() { $param['product_code'] = $this->_getParam('product_code'); $param['product_name'] = $this->_getParam('product_name'); $param['short_description'] = $this->_getParam('short_description'); $param['description'] = $this->_getParam('description'); $param['active'] = $this->_getParam('active'); $app = Model_Product::find($param['product_code']); if ($app) { throw new Exception("Product Code '" . $param['product_code'] . "' already exist."); } $p = new Model_Product(); $p->newProduct($param); echo json_encode(array('success' => true)); }