I'm writing a custom display for certain attributes based on its label. Within the 'configurable.phtml' file, it has the following lines:
$_product = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
I can loop through the attributes array and check the label no problem:
$special_attr = false;
foreach ($_attributes as $_attribute) {
echo $_attribute->getLabel().'<br>';
if ($_attribute->getLabel() === 'FooBar') {
$special_attr = $_attribute;
}
}
This will print out all of the labels ("Color", "Size", etc.). I'm trying to get a list of all options and their values given this special attribute now, and I'm completely stumped. All of the other questions I have found have said something along the lines of using ->getSource()->getAllOptions(false)
, however, calling getSource()
on this attribute just returns null.
How can I get all options given this special attribute?
if ($special_attr) {
$options = $special_attr->??????
// list all options??
}