public function actionUpdatePositionCount() { $cart = new EShoppingCart(); $cart->init(); $positions = $cart->getPositions(); $cart->updateCount($positions[$_POST['positionId']], $_POST['newCount']); $totalPrice = 0; foreach ($positions as $position) { $totalPrice += $position->priceForThisCount; } $return = array(); $return["totalPrice"] = $totalPrice; $return["priceForThisCount"] = $positions[$_POST['positionId']]->priceForThisCount; echo json_encode($return); }