11 use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory;
44 parent::__construct($context);
54 $this->
getResponse()->representJson($this->jsonHelper->jsonEncode($this->saveAttributeOptions()));
72 $attribute = $this->attributeFactory->create();
74 $optionsBefore =
$attribute->getSource()->getAllOptions(
false);
77 'value' => [
'option_0' => [
$option[
'label']]],
78 'order' => [
'option_0' => count($optionsBefore) + 1],
82 $attribute = $this->attributeFactory->create();
84 $optionsAfter =
$attribute->getSource()->getAllOptions(
false);
85 $newOption = array_pop($optionsAfter);
86 $savedOptions[
$option[
'id']] = $newOption[
'value'];
__construct(Action\Context $context, \Magento\Framework\Json\Helper\Data $jsonHelper, AttributeFactory $attributeFactory)