/** * update only one field * * @return void */ public function update_field() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->loadLanguage('design/content'); $this->acm = new AContentManager(); if (!$this->user->canModify('listing_grid/content')) { $error = new AError(''); return $error->toJSONResponse('NO_PERMISSIONS_402', array('error_text' => sprintf($this->language->get('error_permission_modify'), 'listing_grid/content'), 'reset_value' => true)); } $allowedFields = array('title', 'description', 'keyword', 'store_id', 'sort_order', 'status', 'parent_content_id'); if (isset($this->request->get['id'])) { //request sent from edit form. ID in url foreach ($this->request->post as $field => $value) { if (!in_array($field, $allowedFields)) { continue; } if ($field == 'keyword') { if ($err = $this->html->isSEOkeywordExists('content_id=' . $this->request->get['id'], $value)) { $error = new AError(''); return $error->toJSONResponse('VALIDATION_ERROR_406', array('error_text' => $err)); } } if ($field == 'sort_order') { // NOTE: grid quicksave ids are not the same as id from form quick save request! list($void, $parent_content_id) = explode('_', key($value)); $value = current($value); } $this->acm->editContentField($this->request->get['id'], $field, $value, $parent_content_id); } return null; } //request sent from jGrid. ID is key of array foreach ($this->request->post as $field => $value) { if (!in_array($field, $allowedFields)) { continue; } // NOTE: grid quicksave ids are not the same as id from form quick save request! list($parent_content_id, $content_id) = explode('_', key($value)); $this->acm->editContentField($content_id, $field, current($value), $parent_content_id); } //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }