I am adding attribute example
. I don’t add to any group, so it’s not present in Deafualt attribute set.
$eavSetup->addAttribute(
ProductAttributeInterface::ENTITY_TYPE_CODE,
'example',
[
'type' => 'example',
'input' => 'textarea',
'frontend_class' => 'no-whitespace validate-no-html-tags',
'label' => 'example',
'group' => '',
'sort_order' => '',
'backend' => '',
'frontend' => '',
'source' => '',
'default' => '',
'wysiwyg_enabled' => false,
'is_html_allowed_on_front' => false,
'used_for_sort_by' => false,
'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'searchable' => true,
'visible_in_advanced_search' => true,
'search_weight' => 5,
'filterable' => false,
'filterable_in_search' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => '',
'used_for_promo_rules' => true,
'is_used_in_grid' => false,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => false,
'is_required_in_admin_store' => '',
'system' => 0
]
);`
Next I add set Test
:
$this->attributeSetFactory->create() ->setEntityTypeId($this->_entityTypeId) ->setAttributeSetName('Test') ->setSortOrder(50) ->initFromSkeleton($this->_defaultAttributeSetId) ->save();
Next I add example
to Test
:
$attributeSetId = $eavSetup->getAttributeSetId($this->_entityTypeId, 'Test');
$groupId = $eavSetup->getAttributeGroupId($this->_entityTypeId, $attributeSetId, 'product details');
$attributeId = $eavSetup->getAttributeId($this->_entityTypeId, 'example');
$eavSetup->addAttributeToSet($this->_entityTypeId, $attributeSetId, $groupId, $attributeId, 50);
Effect is:
example
is not in default - so it’s ok.
example
is inTest
- that’s what I want to achieve!
But if I enter new/edit product - I can’t see my attribute, neither in Default
nor in Test
:
They would be visible if I add attribute also to Default
(have already tested that), but then it doesn’t make sense to use Attribute Sets at all.
Am I correct - if I have my example
in Test
, when I enter new/edit Product page and change attribute set (then page reloads dynamically) also example should be visible?
Of course after adding attribute to set I tried many times reindexing, cache cleaning and so on. Does anyone has a clue, where I should look or what I should check?