Add image options programmatically in custom attribute not workingHow can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2:Custom Field Value in Edit Products SectionWhat causes the following error: Warning: Illegal string offset 'is_in_stock' … AdvancedInventory.php on line 87Magento: Custom file upload from product edit pageMagento 2: - Set WYSIWYG editor near to custom option in admin sideMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom Options

How to deal with account scam and fraud?

Sorting a list according to some pre-specified rules

Will Jimmy fall off his platform?

The flying colours

In layman's terms, does the Luckstone just give a passive +1 to all d20 rolls and saves except for death saves?

What does "frozen" mean (e.g. for catcodes)?

Why no parachutes in the Orion AA2 abort test?

NOLOCK or Read Uncommitted locking / latching behaviours

Why do people prefer metropolitan areas, considering monsters and villains?

Why is whale hunting treated differently from hunting other animals?

Wouldn't putting an electronic key inside a small Faraday cage render it completely useless?

What are the consequences for a developed nation to not accept any refugee?

Shipped package arrived - didn't order, possible scam?

How do I explain that I don't want to maintain old projects?

Can you create a free-floating MASYU puzzle?

Why does the Misal rico de Cisneros uses the word "Qiſſa", and what is it supposed to mean? Why not "Miſſa" (Missa)?

What was the nature of the known bugs in the Space Shuttle software?

What are some bad ways to subvert tropes?

Where are the Wazirs?

Tesco's Burger Relish Best Before End date number

Who goes first? Person disembarking bus or the bicycle?

Diagram with cylinder shapes and rectangles

How was the website able to tell my credit card was wrong before it processed it?

Sense of humor in your sci-fi stories



Add image options programmatically in custom attribute not working


How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2:Custom Field Value in Edit Products SectionWhat causes the following error: Warning: Illegal string offset 'is_in_stock' … AdvancedInventory.php on line 87Magento: Custom file upload from product edit pageMagento 2: - Set WYSIWYG editor near to custom option in admin sideMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom Options






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I want to add new custom option to upload image like extension : https://shop.emiprotechnologies.com/documentation/custom-option-image-for-magento-2 .
So basically , i override some file to add new custom and function to upload, but image not save in pub/media and save name file on database


1. Create module :

2. Declare your new product option : app/code/Vendor/Module/etc/product_options.xml



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/product_options.xsd">
<option name="select" label="Select" renderer="MagentoCatalogBlockAdminhtmlProductEditTabOptionsTypeSelect">
<inputType name="gallery" label="Thumb Gallery" />
<inputType name="gallery_popup" label="Thumb Gallery Popup" />
<inputType name="gallery_multi_select" label="Thumb Gallery Multi Select" />
</option>

</config>




3. Override file MagentoCatalogUiDataProviderProductFormModifierCustomOptions to add new custom option :
app/code/Vendor/Module/etc/di.xml :



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCatalogUiDataProviderProductFormModifierCustomOptions" type="VendorModuleUiDataProviderProductFormModifierCustomOptions" />
</config>


app/code/Vendor/Module/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php



<?php


namespace VendorModuleUiDataProviderProductFormModifier;

use [...];

class CustomOptions extends MagentoCatalogUiDataProviderProductFormModifierAbstractModifier

const FIELD_IMAGE = 'image';
const FIELD_COLOR = 'color';
[...]
protected function getSelectTypeGridConfig($sortOrder)

$options = [...];

return [],
'children' => [
'record' => [
'arguments' => [...],
'children' => [
static::FIELD_TITLE_NAME => $this->getTitleFieldConfig(
10,
$this->locator->getProduct()->getStoreId() ? $options : []
),
static::FIELD_PRICE_NAME => $this->getPriceFieldConfigForSelectType(20),
static::FIELD_PRICE_TYPE_NAME => $this->getPriceTypeFieldConfig(30, ['fit' => true]),
static::FIELD_SKU_NAME => $this->getSkuFieldConfig(40),
static::FIELD_IMAGE => $this->getImageFieldConfig(50),
static::FIELD_COLOR => $this->getColorFieldConfig(70),
static::FIELD_SORT_ORDER_NAME => $this->getPositionFieldConfig(92),
static::FIELD_IS_DELETE => $this->getIsDeleteFieldConfig(95)
]
]
]
];

protected function getImageFieldConfig($sortOrder)

return [
'arguments' => [
'data' => [
'config' => [
'label' => __('Upload'),
'componentType' => Field::NAME,
'formElement' => MagentoUiComponentFormElementDataTypeMediaImage::NAME,
'dataScope' => static::FIELD_IMAGE,
'dataType' => MagentoUiComponentFormElementDataTypeMediaImage::NAME,
'sortOrder' => $sortOrder,
],
],
],
];

[...]



Now, you can select image to upload, but image not save file name on database. what is mistake in my code.. Thanks!










share|improve this question




























    1















    I want to add new custom option to upload image like extension : https://shop.emiprotechnologies.com/documentation/custom-option-image-for-magento-2 .
    So basically , i override some file to add new custom and function to upload, but image not save in pub/media and save name file on database


    1. Create module :

    2. Declare your new product option : app/code/Vendor/Module/etc/product_options.xml



    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/product_options.xsd">
    <option name="select" label="Select" renderer="MagentoCatalogBlockAdminhtmlProductEditTabOptionsTypeSelect">
    <inputType name="gallery" label="Thumb Gallery" />
    <inputType name="gallery_popup" label="Thumb Gallery Popup" />
    <inputType name="gallery_multi_select" label="Thumb Gallery Multi Select" />
    </option>

    </config>




    3. Override file MagentoCatalogUiDataProviderProductFormModifierCustomOptions to add new custom option :
    app/code/Vendor/Module/etc/di.xml :



    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="MagentoCatalogUiDataProviderProductFormModifierCustomOptions" type="VendorModuleUiDataProviderProductFormModifierCustomOptions" />
    </config>


    app/code/Vendor/Module/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php



    <?php


    namespace VendorModuleUiDataProviderProductFormModifier;

    use [...];

    class CustomOptions extends MagentoCatalogUiDataProviderProductFormModifierAbstractModifier

    const FIELD_IMAGE = 'image';
    const FIELD_COLOR = 'color';
    [...]
    protected function getSelectTypeGridConfig($sortOrder)

    $options = [...];

    return [],
    'children' => [
    'record' => [
    'arguments' => [...],
    'children' => [
    static::FIELD_TITLE_NAME => $this->getTitleFieldConfig(
    10,
    $this->locator->getProduct()->getStoreId() ? $options : []
    ),
    static::FIELD_PRICE_NAME => $this->getPriceFieldConfigForSelectType(20),
    static::FIELD_PRICE_TYPE_NAME => $this->getPriceTypeFieldConfig(30, ['fit' => true]),
    static::FIELD_SKU_NAME => $this->getSkuFieldConfig(40),
    static::FIELD_IMAGE => $this->getImageFieldConfig(50),
    static::FIELD_COLOR => $this->getColorFieldConfig(70),
    static::FIELD_SORT_ORDER_NAME => $this->getPositionFieldConfig(92),
    static::FIELD_IS_DELETE => $this->getIsDeleteFieldConfig(95)
    ]
    ]
    ]
    ];

    protected function getImageFieldConfig($sortOrder)

    return [
    'arguments' => [
    'data' => [
    'config' => [
    'label' => __('Upload'),
    'componentType' => Field::NAME,
    'formElement' => MagentoUiComponentFormElementDataTypeMediaImage::NAME,
    'dataScope' => static::FIELD_IMAGE,
    'dataType' => MagentoUiComponentFormElementDataTypeMediaImage::NAME,
    'sortOrder' => $sortOrder,
    ],
    ],
    ],
    ];

    [...]



    Now, you can select image to upload, but image not save file name on database. what is mistake in my code.. Thanks!










    share|improve this question
























      1












      1








      1








      I want to add new custom option to upload image like extension : https://shop.emiprotechnologies.com/documentation/custom-option-image-for-magento-2 .
      So basically , i override some file to add new custom and function to upload, but image not save in pub/media and save name file on database


      1. Create module :

      2. Declare your new product option : app/code/Vendor/Module/etc/product_options.xml



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/product_options.xsd">
      <option name="select" label="Select" renderer="MagentoCatalogBlockAdminhtmlProductEditTabOptionsTypeSelect">
      <inputType name="gallery" label="Thumb Gallery" />
      <inputType name="gallery_popup" label="Thumb Gallery Popup" />
      <inputType name="gallery_multi_select" label="Thumb Gallery Multi Select" />
      </option>

      </config>




      3. Override file MagentoCatalogUiDataProviderProductFormModifierCustomOptions to add new custom option :
      app/code/Vendor/Module/etc/di.xml :



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
      <preference for="MagentoCatalogUiDataProviderProductFormModifierCustomOptions" type="VendorModuleUiDataProviderProductFormModifierCustomOptions" />
      </config>


      app/code/Vendor/Module/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php



      <?php


      namespace VendorModuleUiDataProviderProductFormModifier;

      use [...];

      class CustomOptions extends MagentoCatalogUiDataProviderProductFormModifierAbstractModifier

      const FIELD_IMAGE = 'image';
      const FIELD_COLOR = 'color';
      [...]
      protected function getSelectTypeGridConfig($sortOrder)

      $options = [...];

      return [],
      'children' => [
      'record' => [
      'arguments' => [...],
      'children' => [
      static::FIELD_TITLE_NAME => $this->getTitleFieldConfig(
      10,
      $this->locator->getProduct()->getStoreId() ? $options : []
      ),
      static::FIELD_PRICE_NAME => $this->getPriceFieldConfigForSelectType(20),
      static::FIELD_PRICE_TYPE_NAME => $this->getPriceTypeFieldConfig(30, ['fit' => true]),
      static::FIELD_SKU_NAME => $this->getSkuFieldConfig(40),
      static::FIELD_IMAGE => $this->getImageFieldConfig(50),
      static::FIELD_COLOR => $this->getColorFieldConfig(70),
      static::FIELD_SORT_ORDER_NAME => $this->getPositionFieldConfig(92),
      static::FIELD_IS_DELETE => $this->getIsDeleteFieldConfig(95)
      ]
      ]
      ]
      ];

      protected function getImageFieldConfig($sortOrder)

      return [
      'arguments' => [
      'data' => [
      'config' => [
      'label' => __('Upload'),
      'componentType' => Field::NAME,
      'formElement' => MagentoUiComponentFormElementDataTypeMediaImage::NAME,
      'dataScope' => static::FIELD_IMAGE,
      'dataType' => MagentoUiComponentFormElementDataTypeMediaImage::NAME,
      'sortOrder' => $sortOrder,
      ],
      ],
      ],
      ];

      [...]



      Now, you can select image to upload, but image not save file name on database. what is mistake in my code.. Thanks!










      share|improve this question














      I want to add new custom option to upload image like extension : https://shop.emiprotechnologies.com/documentation/custom-option-image-for-magento-2 .
      So basically , i override some file to add new custom and function to upload, but image not save in pub/media and save name file on database


      1. Create module :

      2. Declare your new product option : app/code/Vendor/Module/etc/product_options.xml



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/product_options.xsd">
      <option name="select" label="Select" renderer="MagentoCatalogBlockAdminhtmlProductEditTabOptionsTypeSelect">
      <inputType name="gallery" label="Thumb Gallery" />
      <inputType name="gallery_popup" label="Thumb Gallery Popup" />
      <inputType name="gallery_multi_select" label="Thumb Gallery Multi Select" />
      </option>

      </config>




      3. Override file MagentoCatalogUiDataProviderProductFormModifierCustomOptions to add new custom option :
      app/code/Vendor/Module/etc/di.xml :



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
      <preference for="MagentoCatalogUiDataProviderProductFormModifierCustomOptions" type="VendorModuleUiDataProviderProductFormModifierCustomOptions" />
      </config>


      app/code/Vendor/Module/Ui/DataProvider/Product/Form/Modifier/CustomOptions.php



      <?php


      namespace VendorModuleUiDataProviderProductFormModifier;

      use [...];

      class CustomOptions extends MagentoCatalogUiDataProviderProductFormModifierAbstractModifier

      const FIELD_IMAGE = 'image';
      const FIELD_COLOR = 'color';
      [...]
      protected function getSelectTypeGridConfig($sortOrder)

      $options = [...];

      return [],
      'children' => [
      'record' => [
      'arguments' => [...],
      'children' => [
      static::FIELD_TITLE_NAME => $this->getTitleFieldConfig(
      10,
      $this->locator->getProduct()->getStoreId() ? $options : []
      ),
      static::FIELD_PRICE_NAME => $this->getPriceFieldConfigForSelectType(20),
      static::FIELD_PRICE_TYPE_NAME => $this->getPriceTypeFieldConfig(30, ['fit' => true]),
      static::FIELD_SKU_NAME => $this->getSkuFieldConfig(40),
      static::FIELD_IMAGE => $this->getImageFieldConfig(50),
      static::FIELD_COLOR => $this->getColorFieldConfig(70),
      static::FIELD_SORT_ORDER_NAME => $this->getPositionFieldConfig(92),
      static::FIELD_IS_DELETE => $this->getIsDeleteFieldConfig(95)
      ]
      ]
      ]
      ];

      protected function getImageFieldConfig($sortOrder)

      return [
      'arguments' => [
      'data' => [
      'config' => [
      'label' => __('Upload'),
      'componentType' => Field::NAME,
      'formElement' => MagentoUiComponentFormElementDataTypeMediaImage::NAME,
      'dataScope' => static::FIELD_IMAGE,
      'dataType' => MagentoUiComponentFormElementDataTypeMediaImage::NAME,
      'sortOrder' => $sortOrder,
      ],
      ],
      ],
      ];

      [...]



      Now, you can select image to upload, but image not save file name on database. what is mistake in my code.. Thanks!







      magento2 product custom-options catalog






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jun 28 at 6:59









      wightmanwightman

      115 bronze badges




      115 bronze badges




















          0






          active

          oldest

          votes














          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f280005%2fadd-image-options-programmatically-in-custom-attribute-not-working%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f280005%2fadd-image-options-programmatically-in-custom-attribute-not-working%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

          Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

          Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림