Создайте новую группу атрибутов в magento


В Magento атрибуты продуктов назначаются в группах в соответствии с набором атрибутов. Я пытаюсь создать новую группу атрибутов, такую как General, Price.

  • Я хочу назначить новый атрибут продукта этой новой группе атрибутов, а не "Общему"

enter image description here

Мой вывод до сих пор таков:

  • Группы атрибутов хранятся в таблице eav_attribute_group

enter image description here

Как этого можно достичь программно? Любая помощь будет оценена по достоинству.

Author: Manashvi Birla, 2016-05-04

1 answers

$entityTypeId = Mage::getModel('catalog/product')->getResource()->getTypeId();
$sets = Mage::getModel('eav/entity_attribute_set')->getResourceCollection()
    ->addFilter('entity_type_id', $entityTypeId);

foreach ($sets as $set){
    //create attribute group instance
    $modelGroup = Mage::getModel('eav/entity_attribute_group');
    //set the group name
    $modelGroup->setAttributeGroupName('Some group name here')
    //link to the current set
    ->setAttributeSetId($set->getId())
    //set the order in the set
    ->setSortOrder(15);
    $modelGroup->save();
}

Проверьте здесь для получения дополнительной информации: Создайте и добавьте группу атрибутов с атрибутами во все наборы атрибутов

 1
Author: Anil Suthar, 2017-04-13 12:55:05