# Город для расчета

Если вы все сделали как в [Настройки макета](/megapost/nastroiki-maketa.md) и указали код **MegaPost\_GeoIp::getCountryLocationCity()**, то при первом заходе в сессию (ASMP\_City) посетителя сохраняется вся информацию по его местоположению для дальнейшего расчета доставок, при любом изменении города сессия перезаписывается

{% code lineNumbers="true" fullWidth="true" %}

```php
print_r($_SESSION['ASMP_City']);

/*
Array
(
    [ip] => 192.168.0.1
    [city] => Екатеринбург
    [region] => Свердловская область
    [country_iso] => RU
    [country] => Россия
    [shop_country_id] => 175
    [shop_country_location_id] => 55
    [region_id] => 66
    [region_kladr] => 6600000000000
    [shop_country_location_city_id] => 1888
    [postcode] => 620033
    [kladr] => 6600000100000
)
*/
```

{% endcode %}

Если вы хотите подставить свой город, то можно сделать следующее, после вызова **MegaPost\_GeoIp::getCountryLocationCity()**, разместите следующий код

{% tabs %}
{% tab title="из справочника HostCMS" %}
{% code lineNumbers="true" fullWidth="true" %}

```php
if(!isset($_SESSION['ASMP_City']))
{
    $oShop_Country_Location_City = Core_Entity::factory('Shop_Country_Location_City', 123); // где 123 - ID города
    $_SESSION['ASMP_City'] = MegaPost_GeoIp::makeCity($oShop_Country_Location_City);
}

MegaPost_GeoIp::getCountryLocationCity();
```

{% endcode %}
{% endtab %}

{% tab title="любой другой город" %}
{% code lineNumbers="true" fullWidth="true" %}

```php
if(!isset($_SESSION['ASMP_City']))
{
    $aReturn = array(
        'city' => 'Екатеринбург',
        'region' => 'Свердловская область',
        'country' => 'Россия',
        'country_iso' => 'RU',
        'kladr' => 6600000100000,
        'region_kladr' => 6600000000000,
        'region_id' => 66,
    );
    
    $_SESSION['ASMP_City'] = $aReturn;
}

MegaPost_GeoIp::getCountryLocationCity();
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.morozovpimnev.ru/megapost/gorod-dlya-rascheta.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
