Display selected attribute
Permalink
In an autonav I'm trying to display a select attribute option. An value only needs to display when the value is selected.
What I found displays all the values, selected or not. How can I display only a selected value?
This code displays all values:
What I found displays all the values, selected or not. How can I display only a selected value?
This code displays all values:
Loader::model('attribute/type'); Loader::model('attribute/categories/collection'); $ak = CollectionAttributeKey::getByHandle('parochieId'); $sa = new SelectAttributeTypeController(AttributeType::getByHandle('select')); $sa->setAttributeKey($ak); $values = $sa->getOptions(); foreach ($values as $v) { echo $v->value; }
$your_handle = $cobj->getCollectionAttributeValue('your_handle ');
And print this way:
<?php echo "" . $your_handle; ?>
Very easy but i cry to find this too.