function updateForAjax(array $js) { parent::updateForAjax($js); self::apply_min_max(); if (is_array(self::$ids_of_items_adjusted) && count(self::$ids_of_items_adjusted)) { $items = OrderItem::get()->filter(array('ID' => self::$ids_of_items_adjusted)); if ($items->count()) { foreach ($items as $item) { $item->updateForAjax($js); } } } return $js; }
/** * * @param Array $js javascript array * @return Array for AJAX JSON **/ function updateForAjax(array $js) { $js = parent::updateForAjax($js); $jsonOptions = array(); $liveOptions = $this->LiveOptions(); if ($liveOptions && $liveOptions->count()) { $optionsArray = $liveOptions->map('ID', 'Name'); if ($optionsArray && !is_array($optionsArray)) { $optionsArray = $optionsArray->toArray(); } if ($optionsArray && count($optionsArray)) { foreach ($optionsArray as $id => $name) { $jsonOptions[] = array('id' => $id, 'name' => $name); } } } $js[] = array('t' => 'dropdown', 's' => 'PickupOrDeliveryType', 'p' => $this->LiveOptionID(), 'v' => $jsonOptions); return $js; }