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;
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
add a comment |
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
add a comment |
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
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
magento2 product custom-options catalog
asked Jun 28 at 6:59
wightmanwightman
115 bronze badges
115 bronze badges
add a comment |
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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