getRequestValue('id'); $productManager = new ProductManager(); $productManager ->loadById($productId); $options = new ConfigOptionsType(); $options->setType($productManager->get(ProductParams::CLASS_OF_SERVICE_NAME)); $options->setProductId($productId); $options->load(); $configurableOption = new ConfigurableOptions($productId); ConfigurableOptionsBuilder::buildAll($configurableOption, $options->getConfigurableOptions()); $this->data = [ 'fields' => $configurableOption->show() ]; } /** * @return HtmlDataJsonResponse|void */ public function create() { $productId = $this->getRequestValue('id'); try { $productManager = new ProductManager(); $productManager ->loadById($productId); $options = new ConfigOptionsType(); $options->setType($productManager->get(ProductParams::CLASS_OF_SERVICE_NAME)); $options->setProductId($productId); $options->load(); $configurableOption = new ConfigurableOptions($productId); ConfigurableOptionsBuilder::build($configurableOption, $this->formData, $options->getConfigurableOptions()); $status = $configurableOption->createOrUpdate(); $msg = ($status) ? 'configurableOptionsCreate' : 'configurableOptionsUpdate'; return (new HtmlDataJsonResponse()) ->setStatusSuccess() ->setCallBackFunction('redirectToConfigurableOptionsTab') ->setMessageAndTranslate($msg); } catch (\Exception $ex) { return (new HtmlDataJsonResponse()) ->setStatusError() ->setMessage($ex->getMessage()); } } public function delete() { } public function update() { } }