/** * Sort options * * @return JSONResponse */ public function sort() { $target = $this->request->get('target'); foreach ($this->request->get($target, array()) as $position => $key) { if (!empty($key)) { $productOption = ProductOption::getInstanceByID((int) $key); $productOption->setFieldValue('position', (int) $position); $productOption->save(); } } return new JSONResponse(false, 'success'); }