Skip to content

Commit 9ed96db

Browse files
author
Sven Axelsson
committed
Add a default method for fetching dropdown eav attribute options
1 parent 747aacd commit 9ed96db

File tree

1 file changed

+24
-0
lines changed
  • src/app/code/community/FireGento/GridControl/Model

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
class FireGento_GridControl_Model_Utility
4+
{
5+
public function getDropdownAttributeLabelOptionArray($attribute)
6+
{
7+
$map = array();
8+
9+
if (is_array($attribute)) {
10+
$attribute = reset($attribute);
11+
}
12+
13+
if ($attribute) {
14+
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $attribute);
15+
$options = $attribute->getSource()->getAllOptions(false);
16+
17+
foreach ($options as $option) {
18+
$map[$option['value']] = $option['label'];
19+
}
20+
}
21+
22+
return $map;
23+
}
24+
}

0 commit comments

Comments
 (0)