Saving Select Attributes with API
Permalink
Hi, I've been adding all the attributes from an attribute set to a single page like this:
and then on the single page controller I have been saving those attribute like this:
This is working fine for all attribute types except for Select Attributes, like the Tags attribute, the selected values do not get saved to the page. Anyone know why the select values do not save when you do it this way?
thanks
and then on the single page controller I have been saving those attribute like this:
$atSet = AttributeSet::getByHandle('attribute_set_handle'); $atKeys = $atSet->getAttributeKeys(); foreach($atKeys as $ak) { $ak = CollectionAttributeKey::getByHandle($ak->akHandle); $ak->saveAttributeForm($page); }
This is working fine for all attribute types except for Select Attributes, like the Tags attribute, the selected values do not get saved to the page. Anyone know why the select values do not save when you do it this way?
thanks
I don't see anything else different here than saving the attribute on the page object instead of the page version object.
This is how it's done in core (modified to fit your code above):
Don't know if this is the reason but maybe worth to try...?