If you need to assign your custom attribute in all attribute set programmatically then you can used below steps:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $attributeCode = 'is_featured'; $attributeGroup = 'General'; $eavSetup = $objectManager->create(\Magento\Eav\Setup\EavSetup::class); $config = $objectManager->get(\Magento\Catalog\Model\Config::class); $attributeManagement = $objectManager->get(\Magento\Eav\Api\AttributeManagementInterface::class); $entityTypeId = $eavSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); $attributeSetIds = $eavSetup->getAllAttributeSetIds($entityTypeId); foreach ($attributeSetIds as $attributeSetId) { if ($attributeSetId) { $group_id = $config->getAttributeGroupId($attributeSetId, $attributeGroup); if(empty($group_id)){ continue; } $attributeManagement->assign( 'catalog_product', $attributeSetId, $group_id, $attributeCode, 100 ); } } |
Here, we performed the task using objectManager. But You can perform it via module.
If you want get query string params in controller file,...
Create di.xml and add the below code Magemonkey/Redirect/etc/frontend/di.xml [crayon-62845aea8ad74521490979/] Create...
You can try below code to change local date to...
Step 1: First you need to add registration.php file in...
Step1 : Override message.js in current theme file on the...