re: Page Attributes with multiple values
Permalink 2 users found helpful
Hi guys,
I've set up my site so certain products can be grouped/categorised. I used the select attribute type, allowing multiple options to be chosen.
My problem is how do I check if the category value exists within the page attribute?
I am generally just using an if statement to check if the string exist and if so present some text and url. Its easy to have the one value, but not sure how to check when you have multiple values.
I tried this method to no affect:
<?php if ($c->getCollectionAttributeValue('category') == "Cats") { ?>
Thanks in advance.
cheers,
Ritch
I've set up my site so certain products can be grouped/categorised. I used the select attribute type, allowing multiple options to be chosen.
My problem is how do I check if the category value exists within the page attribute?
I am generally just using an if statement to check if the string exist and if so present some text and url. Its easy to have the one value, but not sure how to check when you have multiple values.
I tried this method to no affect:
<?php if ($c->getCollectionAttributeValue('category') == "Cats") { ?>
Thanks in advance.
cheers,
Ritch
Thanks for the response..figured it out with using combination of foreach and if statements to check every value.
Hello,
im having the same problem, could you please enlightened me on how you solved the problem. ? :)
thank you in advance.
im having the same problem, could you please enlightened me on how you solved the problem. ? :)
thank you in advance.
Hi
Use foreach and if statement inside the foreach to check the values.
Hope you understand
Use foreach and if statement inside the foreach to check the values.
foreach($attributes as $attribute){ if($attribute == "choose1"){ do something } }
Hope you understand
Hello OpenJuiceVijay,
Thank you for your answer,
Very usefull. :)
Thank you for your answer,
Very usefull. :)
Hi 87up,
Can you mark it as answer?
Can you mark it as answer?
Hello OpenJuiceVijay,
I think roa123 need to mark it as an answer.
I think roa123 need to mark it as an answer.
If the value is not null that if should let you do something