public function onBeforeWrite()
    {
        parent::onBeforeWrite();

        if (isset($_POST['ProductAttributes']) && is_array($_POST['ProductAttributes'])) {
            $this->AttributeValues()->setByIDList(array_values($_POST['ProductAttributes']));
        }

        $img = $this->Image();

        if ($img && $img->exists()) {
            $img->doPublish();
        }
    }
public function onBeforeWrite()
    {
        parent::onBeforeWrite();

        if (isset($_POST['ProductAttributes']) && is_array($_POST['ProductAttributes'])) {
            $this->AttributeValues()->setByIDList(array_values($_POST['ProductAttributes']));
        }

        $img = $this->Image();

        if ($img && $img->exists()) {
            $img->doPublish();
        }
    }
public function onBeforeWrite ( ) { parent :: onBeforeWrite ( ) ; if ( isset ( $ _POST [ 'ProductAttributes' ] ) && is_array ( $ _POST [ 'ProductAttributes' ] ) ) { $ this -> AttributeValues ( ) -> setByIDList ( array_values ( $ _POST [ 'ProductAttributes' ] ) ) ; } $ img = $ this -> Image ( ) ; if ( $ img && $ img -> exists ( ) ) { $ img -> doPublish ( ) ; } }
Save selected attributes - somewhat of a hack.
Save selected attributes - somewhat of a hack .