Help for Attribute Type Select
Permalink 1 user found helpful
Hello everyone,
How do i filter using the values in my Select Attribute Type. This used to work like this in concrete5 version 5.4.0.5:
kompetencer is the Attribute Handle and $c->getCollectionName() is the select box values. I am filtering by headline. That is the reason why i use $c->getCollectionName(). How come this doesn't work in concrete5 version 5.4.1 ?
Thank you in advance
How do i filter using the values in my Select Attribute Type. This used to work like this in concrete5 version 5.4.0.5:
if ($cobj->getCollectionAttributeValue('kompetencer') == $c->getCollectionName()):
kompetencer is the Attribute Handle and $c->getCollectionName() is the select box values. I am filtering by headline. That is the reason why i use $c->getCollectionName(). How come this doesn't work in concrete5 version 5.4.1 ?
Thank you in advance
try this
Yes it worked !...
Thank you so much. :)
Thank you so much. :)
hello again,
i have changed my select attribute to allow multiple options to be chosen.
When 2 or more options are selected at the same time, only the first selected option is working. How do I make my filter check for all the selected options. ?
I used the code ChadStrat made, and modified it a bit to check if all the options are saved, but it doesn't work:
Can anyone help me solve this problem. :)
Thank you in advance.
i have changed my select attribute to allow multiple options to be chosen.
When 2 or more options are selected at the same time, only the first selected option is working. How do I make my filter check for all the selected options. ?
I used the code ChadStrat made, and modified it a bit to check if all the options are saved, but it doesn't work:
Can anyone help me solve this problem. :)
Thank you in advance.
A simple modification to your code should set things in order. getOptions() will return an array with the selected options. For further reference, in your concrete5 install, see 'concrete/models/attribute/types/select/controller.php' specifically the SelectAttributeTypeOptionList class is the object that you are working with.
$ak = CollectionAttributeKey::getByHandle('kompetencer'); $values = $cobj->getCollectionAttributeValue($ak)->getOptions(); foreach ($values as $value) { $myValues[] = $value; echo $value; }