setAttribute Help
Permalink
I am attempting to save an attribute(select) to a collection, from a composer screen.
Can anyone help me out? I am able to save as a text attribute, so I assume I am doing something glaringly obvious here but I can not work it out.
I have also tried setting the attribute against the collection object.
All just set the attribute as being blank? can anyone point me in the correct location this is driving me bonkers.
Thanks
Sean
Can anyone help me out? I am able to save as a text attribute, so I assume I am doing something glaringly obvious here but I can not work it out.
$c = Page::getByID($_REQUEST['entryID']); Loader::model('attribute/categories/collection'); if (!is_object($ak)) { $ak = CollectionAttributeKey::getByHandle($ak); } //Select Attribute, Value $selectedOption = $_REQUEST['akID'][$ak->akID]['atSelectOptionID']; $pak->setAttribute($c, $selectedOption); //$selectedOption = [0]->111
I have also tried setting the attribute against the collection object.
$c->setAttribute($ak->getAttributeKeyHandle(),$selectedOption); //and $c->setAttribute($ak,$selectedOption);
All just set the attribute as being blank? can anyone point me in the correct location this is driving me bonkers.
Thanks
Sean