Product attribute create issue magento 2
I am using below script to create product attribute with options.
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$setup = $objectManager->get('MagentoFrameworkSetupModuleDataSetupInterface');
$eav_setup_factory = $obj->get('MagentoEavSetupEavSetupFactory');
$setup->startSetup();
$eavSetup = $eav_setup_factory->create(['setup' => $setup]);
// Product Attribute
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'customattribute',
[
'type' => 'int',
'label' => 'Custom Attribute Label',
'backend' => '',
'input' => 'select',
'wysiwyg_enabled' => false,
'source' => '',
'required' => false,
'filterable' => true,
'sort_order' => 3,
'global' => MagentoCatalogModelResourceModelEavAttribute::SCOPE_GLOBAL,
'group' => 'custom attribute group',
'used_in_product_listing' => true,
'visible_on_front' => true,
'option' => [
'values' => [
0 => 'Small',
1 => 'Medium',
2 => 'Large',
]
],
]
);
The options are not getting created with the above code. How can we create options?
The attribute is created once used the above code. Also, can we specify the attribute set to this code? by default, it is adding to the Default attribute set.
Can anybody help me with the above issue?
magento2 product-attribute installer
add a comment |
I am using below script to create product attribute with options.
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$setup = $objectManager->get('MagentoFrameworkSetupModuleDataSetupInterface');
$eav_setup_factory = $obj->get('MagentoEavSetupEavSetupFactory');
$setup->startSetup();
$eavSetup = $eav_setup_factory->create(['setup' => $setup]);
// Product Attribute
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'customattribute',
[
'type' => 'int',
'label' => 'Custom Attribute Label',
'backend' => '',
'input' => 'select',
'wysiwyg_enabled' => false,
'source' => '',
'required' => false,
'filterable' => true,
'sort_order' => 3,
'global' => MagentoCatalogModelResourceModelEavAttribute::SCOPE_GLOBAL,
'group' => 'custom attribute group',
'used_in_product_listing' => true,
'visible_on_front' => true,
'option' => [
'values' => [
0 => 'Small',
1 => 'Medium',
2 => 'Large',
]
],
]
);
The options are not getting created with the above code. How can we create options?
The attribute is created once used the above code. Also, can we specify the attribute set to this code? by default, it is adding to the Default attribute set.
Can anybody help me with the above issue?
magento2 product-attribute installer
add a comment |
I am using below script to create product attribute with options.
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$setup = $objectManager->get('MagentoFrameworkSetupModuleDataSetupInterface');
$eav_setup_factory = $obj->get('MagentoEavSetupEavSetupFactory');
$setup->startSetup();
$eavSetup = $eav_setup_factory->create(['setup' => $setup]);
// Product Attribute
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'customattribute',
[
'type' => 'int',
'label' => 'Custom Attribute Label',
'backend' => '',
'input' => 'select',
'wysiwyg_enabled' => false,
'source' => '',
'required' => false,
'filterable' => true,
'sort_order' => 3,
'global' => MagentoCatalogModelResourceModelEavAttribute::SCOPE_GLOBAL,
'group' => 'custom attribute group',
'used_in_product_listing' => true,
'visible_on_front' => true,
'option' => [
'values' => [
0 => 'Small',
1 => 'Medium',
2 => 'Large',
]
],
]
);
The options are not getting created with the above code. How can we create options?
The attribute is created once used the above code. Also, can we specify the attribute set to this code? by default, it is adding to the Default attribute set.
Can anybody help me with the above issue?
magento2 product-attribute installer
I am using below script to create product attribute with options.
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$setup = $objectManager->get('MagentoFrameworkSetupModuleDataSetupInterface');
$eav_setup_factory = $obj->get('MagentoEavSetupEavSetupFactory');
$setup->startSetup();
$eavSetup = $eav_setup_factory->create(['setup' => $setup]);
// Product Attribute
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'customattribute',
[
'type' => 'int',
'label' => 'Custom Attribute Label',
'backend' => '',
'input' => 'select',
'wysiwyg_enabled' => false,
'source' => '',
'required' => false,
'filterable' => true,
'sort_order' => 3,
'global' => MagentoCatalogModelResourceModelEavAttribute::SCOPE_GLOBAL,
'group' => 'custom attribute group',
'used_in_product_listing' => true,
'visible_on_front' => true,
'option' => [
'values' => [
0 => 'Small',
1 => 'Medium',
2 => 'Large',
]
],
]
);
The options are not getting created with the above code. How can we create options?
The attribute is created once used the above code. Also, can we specify the attribute set to this code? by default, it is adding to the Default attribute set.
Can anybody help me with the above issue?
magento2 product-attribute installer
magento2 product-attribute installer
edited 2 days ago
Evince Development
1,092319
1,092319
asked 2 days ago
jafar pinjarjafar pinjar
576412
576412
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
First we need to create a installer file name InstallData.php in our custom module Setup folder
app/code/Vendor/Module/Setup
<?php
namespace VendorModuleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
{
$this->eavSetupFactory = $eavSetupFactory;
}
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
/** @var EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
/**
* Add attributes to the eav/attribute
*/
$eavSetup->removeAttribute(MagentoCatalogModelProduct::ENTITY,'yourcustomattribute_id');
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'yourcustomattribute_id',
[
'group' => 'Product Details',
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Your Custom Attribute Label',
'input' => 'select',
'class' => '',
'source' => 'VendorModuleModelConfigSourceOptions',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false
]
);
}
}
Now we create option source file class Options for custom attribute options list
app/code/Vendor/Module/Model/Config/Source/Options.php
<?php
namespace VendorModuleModelConfigSource;
use MagentoEavModelResourceModelEntityAttributeOptionFactory;
use MagentoFrameworkDBDdlTable;
class Options extends MagentoEavModelEntityAttributeSourceAbstractSource
{
public function getAllOptions()
{
/* your Attribute options list*/
$this->_options = [
['label' => 'Select Options', 'value' => ''],
['label' => 'Option1', 'value' => '1'],
['label' => 'Option2', 'value' => '2'],
['label' => 'Option3', 'value' => '3'],
];
return $this->_options;
}
public function getOptionText($value)
{
foreach ($this->getAllOptions() as $option) {
if ($option['value'] == $value) {
return $option['label'];
}
}
return false;
}
public function getFlatColumns()
{
$attributeCode = $this->getAttribute()->getAttributeCode();
return [
$attributeCode => [
'unsigned' => false,
'default' => null,
'extra' => null,
'type' => Table::TYPE_INTEGER,
'nullable' => true,
'comment' => 'Custom Attribute Options ' . $attributeCode . ' column',
],
];
}
}
Reference
i mam reading option from json, how to parse it? below is the json "Attribute": "Test Attribute", "data_type" :"text", "OptionValues": { "Value": "Advanced Diploma" }
– jafar pinjar
2 days ago
$json_decoded = $this->jsonHelper->jsonDecode($json_encoded); It will return array then you can read it.
– Rohan Hapani
2 days ago
, can we not create attribute with custom rest api? like this magento.stackexchange.com/questions/257047/…
– jafar pinjar
2 days ago
I will look it and give update soon.
– Rohan Hapani
2 days ago
okay thanks Rohan
– jafar pinjar
2 days ago
|
show 2 more comments
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%2f257480%2fproduct-attribute-create-issue-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
First we need to create a installer file name InstallData.php in our custom module Setup folder
app/code/Vendor/Module/Setup
<?php
namespace VendorModuleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
{
$this->eavSetupFactory = $eavSetupFactory;
}
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
/** @var EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
/**
* Add attributes to the eav/attribute
*/
$eavSetup->removeAttribute(MagentoCatalogModelProduct::ENTITY,'yourcustomattribute_id');
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'yourcustomattribute_id',
[
'group' => 'Product Details',
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Your Custom Attribute Label',
'input' => 'select',
'class' => '',
'source' => 'VendorModuleModelConfigSourceOptions',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false
]
);
}
}
Now we create option source file class Options for custom attribute options list
app/code/Vendor/Module/Model/Config/Source/Options.php
<?php
namespace VendorModuleModelConfigSource;
use MagentoEavModelResourceModelEntityAttributeOptionFactory;
use MagentoFrameworkDBDdlTable;
class Options extends MagentoEavModelEntityAttributeSourceAbstractSource
{
public function getAllOptions()
{
/* your Attribute options list*/
$this->_options = [
['label' => 'Select Options', 'value' => ''],
['label' => 'Option1', 'value' => '1'],
['label' => 'Option2', 'value' => '2'],
['label' => 'Option3', 'value' => '3'],
];
return $this->_options;
}
public function getOptionText($value)
{
foreach ($this->getAllOptions() as $option) {
if ($option['value'] == $value) {
return $option['label'];
}
}
return false;
}
public function getFlatColumns()
{
$attributeCode = $this->getAttribute()->getAttributeCode();
return [
$attributeCode => [
'unsigned' => false,
'default' => null,
'extra' => null,
'type' => Table::TYPE_INTEGER,
'nullable' => true,
'comment' => 'Custom Attribute Options ' . $attributeCode . ' column',
],
];
}
}
Reference
i mam reading option from json, how to parse it? below is the json "Attribute": "Test Attribute", "data_type" :"text", "OptionValues": { "Value": "Advanced Diploma" }
– jafar pinjar
2 days ago
$json_decoded = $this->jsonHelper->jsonDecode($json_encoded); It will return array then you can read it.
– Rohan Hapani
2 days ago
, can we not create attribute with custom rest api? like this magento.stackexchange.com/questions/257047/…
– jafar pinjar
2 days ago
I will look it and give update soon.
– Rohan Hapani
2 days ago
okay thanks Rohan
– jafar pinjar
2 days ago
|
show 2 more comments
First we need to create a installer file name InstallData.php in our custom module Setup folder
app/code/Vendor/Module/Setup
<?php
namespace VendorModuleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
{
$this->eavSetupFactory = $eavSetupFactory;
}
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
/** @var EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
/**
* Add attributes to the eav/attribute
*/
$eavSetup->removeAttribute(MagentoCatalogModelProduct::ENTITY,'yourcustomattribute_id');
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'yourcustomattribute_id',
[
'group' => 'Product Details',
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Your Custom Attribute Label',
'input' => 'select',
'class' => '',
'source' => 'VendorModuleModelConfigSourceOptions',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false
]
);
}
}
Now we create option source file class Options for custom attribute options list
app/code/Vendor/Module/Model/Config/Source/Options.php
<?php
namespace VendorModuleModelConfigSource;
use MagentoEavModelResourceModelEntityAttributeOptionFactory;
use MagentoFrameworkDBDdlTable;
class Options extends MagentoEavModelEntityAttributeSourceAbstractSource
{
public function getAllOptions()
{
/* your Attribute options list*/
$this->_options = [
['label' => 'Select Options', 'value' => ''],
['label' => 'Option1', 'value' => '1'],
['label' => 'Option2', 'value' => '2'],
['label' => 'Option3', 'value' => '3'],
];
return $this->_options;
}
public function getOptionText($value)
{
foreach ($this->getAllOptions() as $option) {
if ($option['value'] == $value) {
return $option['label'];
}
}
return false;
}
public function getFlatColumns()
{
$attributeCode = $this->getAttribute()->getAttributeCode();
return [
$attributeCode => [
'unsigned' => false,
'default' => null,
'extra' => null,
'type' => Table::TYPE_INTEGER,
'nullable' => true,
'comment' => 'Custom Attribute Options ' . $attributeCode . ' column',
],
];
}
}
Reference
i mam reading option from json, how to parse it? below is the json "Attribute": "Test Attribute", "data_type" :"text", "OptionValues": { "Value": "Advanced Diploma" }
– jafar pinjar
2 days ago
$json_decoded = $this->jsonHelper->jsonDecode($json_encoded); It will return array then you can read it.
– Rohan Hapani
2 days ago
, can we not create attribute with custom rest api? like this magento.stackexchange.com/questions/257047/…
– jafar pinjar
2 days ago
I will look it and give update soon.
– Rohan Hapani
2 days ago
okay thanks Rohan
– jafar pinjar
2 days ago
|
show 2 more comments
First we need to create a installer file name InstallData.php in our custom module Setup folder
app/code/Vendor/Module/Setup
<?php
namespace VendorModuleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
{
$this->eavSetupFactory = $eavSetupFactory;
}
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
/** @var EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
/**
* Add attributes to the eav/attribute
*/
$eavSetup->removeAttribute(MagentoCatalogModelProduct::ENTITY,'yourcustomattribute_id');
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'yourcustomattribute_id',
[
'group' => 'Product Details',
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Your Custom Attribute Label',
'input' => 'select',
'class' => '',
'source' => 'VendorModuleModelConfigSourceOptions',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false
]
);
}
}
Now we create option source file class Options for custom attribute options list
app/code/Vendor/Module/Model/Config/Source/Options.php
<?php
namespace VendorModuleModelConfigSource;
use MagentoEavModelResourceModelEntityAttributeOptionFactory;
use MagentoFrameworkDBDdlTable;
class Options extends MagentoEavModelEntityAttributeSourceAbstractSource
{
public function getAllOptions()
{
/* your Attribute options list*/
$this->_options = [
['label' => 'Select Options', 'value' => ''],
['label' => 'Option1', 'value' => '1'],
['label' => 'Option2', 'value' => '2'],
['label' => 'Option3', 'value' => '3'],
];
return $this->_options;
}
public function getOptionText($value)
{
foreach ($this->getAllOptions() as $option) {
if ($option['value'] == $value) {
return $option['label'];
}
}
return false;
}
public function getFlatColumns()
{
$attributeCode = $this->getAttribute()->getAttributeCode();
return [
$attributeCode => [
'unsigned' => false,
'default' => null,
'extra' => null,
'type' => Table::TYPE_INTEGER,
'nullable' => true,
'comment' => 'Custom Attribute Options ' . $attributeCode . ' column',
],
];
}
}
Reference
First we need to create a installer file name InstallData.php in our custom module Setup folder
app/code/Vendor/Module/Setup
<?php
namespace VendorModuleSetup;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallData implements InstallDataInterface
{
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
{
$this->eavSetupFactory = $eavSetupFactory;
}
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
/** @var EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
/**
* Add attributes to the eav/attribute
*/
$eavSetup->removeAttribute(MagentoCatalogModelProduct::ENTITY,'yourcustomattribute_id');
$eavSetup->addAttribute(
MagentoCatalogModelProduct::ENTITY,
'yourcustomattribute_id',
[
'group' => 'Product Details',
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Your Custom Attribute Label',
'input' => 'select',
'class' => '',
'source' => 'VendorModuleModelConfigSourceOptions',
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false
]
);
}
}
Now we create option source file class Options for custom attribute options list
app/code/Vendor/Module/Model/Config/Source/Options.php
<?php
namespace VendorModuleModelConfigSource;
use MagentoEavModelResourceModelEntityAttributeOptionFactory;
use MagentoFrameworkDBDdlTable;
class Options extends MagentoEavModelEntityAttributeSourceAbstractSource
{
public function getAllOptions()
{
/* your Attribute options list*/
$this->_options = [
['label' => 'Select Options', 'value' => ''],
['label' => 'Option1', 'value' => '1'],
['label' => 'Option2', 'value' => '2'],
['label' => 'Option3', 'value' => '3'],
];
return $this->_options;
}
public function getOptionText($value)
{
foreach ($this->getAllOptions() as $option) {
if ($option['value'] == $value) {
return $option['label'];
}
}
return false;
}
public function getFlatColumns()
{
$attributeCode = $this->getAttribute()->getAttributeCode();
return [
$attributeCode => [
'unsigned' => false,
'default' => null,
'extra' => null,
'type' => Table::TYPE_INTEGER,
'nullable' => true,
'comment' => 'Custom Attribute Options ' . $attributeCode . ' column',
],
];
}
}
Reference
answered 2 days ago
Rohan HapaniRohan Hapani
5,92321662
5,92321662
i mam reading option from json, how to parse it? below is the json "Attribute": "Test Attribute", "data_type" :"text", "OptionValues": { "Value": "Advanced Diploma" }
– jafar pinjar
2 days ago
$json_decoded = $this->jsonHelper->jsonDecode($json_encoded); It will return array then you can read it.
– Rohan Hapani
2 days ago
, can we not create attribute with custom rest api? like this magento.stackexchange.com/questions/257047/…
– jafar pinjar
2 days ago
I will look it and give update soon.
– Rohan Hapani
2 days ago
okay thanks Rohan
– jafar pinjar
2 days ago
|
show 2 more comments
i mam reading option from json, how to parse it? below is the json "Attribute": "Test Attribute", "data_type" :"text", "OptionValues": { "Value": "Advanced Diploma" }
– jafar pinjar
2 days ago
$json_decoded = $this->jsonHelper->jsonDecode($json_encoded); It will return array then you can read it.
– Rohan Hapani
2 days ago
, can we not create attribute with custom rest api? like this magento.stackexchange.com/questions/257047/…
– jafar pinjar
2 days ago
I will look it and give update soon.
– Rohan Hapani
2 days ago
okay thanks Rohan
– jafar pinjar
2 days ago
i mam reading option from json, how to parse it? below is the json "Attribute": "Test Attribute", "data_type" :"text", "OptionValues": { "Value": "Advanced Diploma" }
– jafar pinjar
2 days ago
i mam reading option from json, how to parse it? below is the json "Attribute": "Test Attribute", "data_type" :"text", "OptionValues": { "Value": "Advanced Diploma" }
– jafar pinjar
2 days ago
$json_decoded = $this->jsonHelper->jsonDecode($json_encoded); It will return array then you can read it.
– Rohan Hapani
2 days ago
$json_decoded = $this->jsonHelper->jsonDecode($json_encoded); It will return array then you can read it.
– Rohan Hapani
2 days ago
, can we not create attribute with custom rest api? like this magento.stackexchange.com/questions/257047/…
– jafar pinjar
2 days ago
, can we not create attribute with custom rest api? like this magento.stackexchange.com/questions/257047/…
– jafar pinjar
2 days ago
I will look it and give update soon.
– Rohan Hapani
2 days ago
I will look it and give update soon.
– Rohan Hapani
2 days ago
okay thanks Rohan
– jafar pinjar
2 days ago
okay thanks Rohan
– jafar pinjar
2 days ago
|
show 2 more comments
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%2f257480%2fproduct-attribute-create-issue-magento-2%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