protected function getAmmountBycityName($city) { try { $wsdl = ''; if ($this->getConfigData('sandbox_mode') == 0) { $wsdl = $this->getConfigData('production_webservices_url'); } else { $wsdl = $this->getConfigData('sandbox_webservices_url'); } $soapclient = new \SoapClient($wsdl); //Use the functions of the client, the params of the function are in //the associative array $params = array('login' => $this->getConfigData('account'), 'password' => $this->getConfigData('password'), 'contractID' => $this->getConfigData('contract_id')); $flag = 0; $response = $soapclient->getDeliveryCities($params); foreach ($response->GetDeliveryCitiesReply->Cities->string as $key => $value) { if ($value == $city) { $flag = 1; } } if ($flag == 0) { return false; } $params['cityName'] = $city; $params['type'] = 'Самовывоз'; $variants = $soapclient->GetDeliveryVariantList($params); $variant_id = $variants->GetDeliveryVariantReply->Items->DeliveryVariant->Id; unset($params['cityName']); unset($params['type']); $params['deliveryVariantID'] = $variant_id; $params['weight'] = 111; $amm = $soapclient->CalculateTariff($params); return $amm->CalculateTariffReply->Ammount; } catch (Exception $e) { return false; } return false; }