Created
January 19, 2022 17:35
-
-
Save magefast/f11f8f2bb61556f6089796df26dd1e3d to your computer and use it in GitHub Desktop.
Revisions
-
magefast created this gist
Jan 19, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ <?php $locale = 'en_US'; Mage::getSingleton('core/session')->setMyLang($langCode); $locale = Mage::getSingleton('core/session')->getMyLang(); Mage::getSingleton('core/translate')->setLocale($locale)->init('frontend', true); $defaultStore = Mage::app()->getStore()->getCode(); Mage::app()->setCurrentStore($defaultStore); Mage::app()->getLocale()->setLocale($locale); Mage::app()->getTranslator()->init('frontend', true); $entityType = Mage::getModel('catalog/product')->getResource()->getTypeId(); $attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection'); $attributeSetCollection->setEntityTypeFilter($entityType); foreach ($attributeSetCollection as $attributeSet) { $name = $attributeSet->getAttributeSetName(); $attributeSetId = $attributeSet->getId(); addToAttributeSet('name_ukr', $name, 'Основна'); echo '+<br>'; } function addToAttributeSet($code, $attributeSetName = 'Default', $groupName = 'Details') { $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $attributeSetId = $setup->getAttributeSetId('catalog_product', $attributeSetName); $attributeGroupId = $setup->getAttributeGroupId('catalog_product', $attributeSetId, $groupName); $attributeId = $setup->getAttributeId('catalog_product', $code); $setup->addAttributeToSet($entityTypeId = 'catalog_product', $attributeSetId, $attributeGroupId, $attributeId, 1); }