public function actionAddAgreementProducts($ids, $data, $optId) { if ($ids != null && $data != null) { $costbookDatas = explode(',', $data); foreach ($costbookDatas as $costbookData) { list($id, $quantity, $frequency) = explode(':', $costbookData); $costbook = Costbook::getById($id); AgreementProductUtils::addAgreementProductsCalculation($costbook, $quantity, $frequency, $optId); } } $this->redirect(array('/agreements/default/details?id=' . $optId)); }