I’m trying to get select attribute values with $listing->get_value…(). With this method it gets text input value for example, but it returns empty values while getting select2 values. Is there any way to get select2 attribute values?
Yes, if you already have the listing object and you know the attribute name, please try this code:
$term_ids = $listing->get_attributename__id();
This way you can get term IDs of a custom selectable attribute. If this attribute is not based on terms (e.g. if you added it to the form via the code customizations) then this code should work:
$values = $listing->get_attributename();
Okay, it gets IDs of attribute with this line $listing->get_attributename__id(), but is it possible to get value names instead of ids? I mean selected values for example value a, value b.
Yes, you can try using
display instead of
$labels = $listing->display_attributename();
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.