getNode('stores/'.$store); if (!$storeNode) { return false; } $storeIds[] = (int)$storeNode->system->store->id; } } } return $storeIds; } public function getStoreCode($storeId) { return Mage::app()->getStore($storeId?$storeId:0)->getCode(); } public function loadAttributeSets($entityTypeId) { $attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection') ->setEntityTypeFilter($entityTypeId) ->load(); $this->_attributeSetsById = array(); $this->_attributeSetsByName = array(); foreach ($attributeSetCollection as $id=>$attributeSet) { $name = $attributeSet->getAttributeSetName(); $this->_attributeSetsById[$id] = $name; $this->_attributeSetsByName[$name] = $id; } return $this; } public function getAttributeSetName($entityTypeId, $id) { if (!$this->_attributeSetsById) { $this->loadAttributeSets($entityTypeId); } return isset($this->_attributeSetsById[$id]) ? $this->_attributeSetsById[$id] : false; } public function getAttributeSetId($entityTypeId, $name) { if (!$this->_attributeSetsByName) { $this->loadAttributeSets($entityTypeId); } return isset($this->_attributeSetsByName[$name]) ? $this->_attributeSetsByName[$name] : false; } public function getSourceOptionId(Mage_Eav_Model_Entity_Attribute_Source_Interface $source, $value) { foreach ($source->getAllOptions() as $option) { if (strcasecmp($option['label'], $value)==0) { return $option['value']; } } return null; } }