Public Member Functions | |
__construct () | |
items () | |
options ($attributeId, $store=null) |
Definition at line 34 of file Api.php.
__construct | ( | ) |
items | ( | ) |
Retrieve category attributes
Definition at line 46 of file Api.php.
00047 { 00048 $attributes = Mage::getModel('catalog/category')->getAttributes(); 00049 $result = array(); 00050 00051 foreach ($attributes as $attribute) { 00052 /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */ 00053 if ($this->_isAllowedAttribute($attribute)) { 00054 if (!$attribute->getId() || $attribute->isScopeGlobal()) { 00055 $scope = 'global'; 00056 } elseif ($attribute->isScopeWebsite()) { 00057 $scope = 'website'; 00058 } else { 00059 $scope = 'store'; 00060 } 00061 00062 $result[] = array( 00063 'attribute_id' => $attribute->getId(), 00064 'code' => $attribute->getAttributeCode(), 00065 'type' => $attribute->getFrontendInput(), 00066 'required' => $attribute->getIsRequired(), 00067 'scope' => $scope 00068 ); 00069 } 00070 } 00071 00072 return $result; 00073 }
options | ( | $ | attributeId, | |
$ | store = null | |||
) |
Retrieve category attribute options
int|string | $attributeId | |
string|int | $store |
Definition at line 82 of file Api.php.
00083 { 00084 $attribute = Mage::getModel('catalog/category') 00085 ->setStoreId($this->_getStoreId($store)) 00086 ->getResource() 00087 ->getAttribute($attributeId); 00088 00089 if (!$attribute) { 00090 $this->_fault('not_exists'); 00091 } 00092 00093 $result = array(); 00094 if ($attribute->usesSource()) { 00095 foreach ($attribute->getSource()->getAllOptions() as $optionId=>$optionValue) { 00096 if (is_array($optionValue)) { 00097 $result[] = $optionValue; 00098 } else { 00099 $result[] = array( 00100 'value' => $optionId, 00101 'label' => $optionValue 00102 ); 00103 } 00104 } 00105 } 00106 00107 return $result; 00108 }