Beispiel #1
0
 /**
  * Update attribute sets and groups
  *
  * @param array $data
  *
  * @return void
  */
 protected function _updateAttributeSets(array $data)
 {
     $entityTypeId = $this->_catalogProductEntityTypeId;
     foreach ($data as $attributeSet) {
         $attrSetName = $attributeSet['attribute_set_name'];
         $sortOrder = $attributeSet['sort_order'];
         $attributeGroups = $attributeSet;
         unset($attributeGroups['attribute_set_name']);
         unset($attributeGroups['sort_order']);
         $this->_setup->addAttributeSet($entityTypeId, $attrSetName, $sortOrder);
         $attrSetId = $this->_setup->getAttributeSet($entityTypeId, $attrSetName, 'attribute_set_id');
         $currentGroups = $this->_getAttributeGroups($attrSetId);
         $groupsToRemove = array_keys(array_diff_key($currentGroups, $attributeGroups));
         foreach ($groupsToRemove as $groupToRemoveName) {
             unset($currentGroups[$groupToRemoveName]);
         }
         foreach ($attributeGroups as $groupName => $groupSortOrder) {
             $this->_setup->addAttributeGroup($entityTypeId, $attrSetId, $groupName, $groupSortOrder);
         }
     }
 }