$form = Loader::helper('form'); $json = Loader::helper('json'); if ($akSelectAllowMultipleValues && $akSelectAllowOtherValues) { // display autocomplete form $attrKeyID = $this->attributeKey->getAttributeKeyID(); ?> <div class="ccm-attribute-type-select-autocomplete"> <div id="selectedAttrValueRows_<?php echo $attrKeyID; ?> "> <?php foreach ($selectedOptions as $optID) { $opt = SelectAttributeTypeOption::getByID($optID); ?> <div class="existingAttrValue"> <?php echo $form->hidden($this->field('atSelectOptionID') . '[]', $opt->getSelectAttributeOptionID(), array('style' => 'position:relative;')); ?> <?php echo $opt->getSelectAttributeOptionValue(); ?> <a href="javascript:void(0);" onclick="$(this).parent().remove()">x</a> </div> <?php } // now we get items from the post $vals = $this->post('atSelectNewOption'); if (is_array($vals)) {
public function saveOrCreate($ak) { if ($this->tempID != false || $this->ID==0) { return SelectAttributeTypeOption::add($ak, $this->value); } else { $db = Loader::db(); $db->Execute('update atSelectOptions set value = ? where ID = ?', array($this->value, $this->ID)); return SelectAttributeTypeOption::getByID($this->ID); } }