====== Область и город по умолчанию при оформлении заказа ====== Чтобы при оформлении заказа на странице «Адрес доставки» по умолчанию выбирались требуемые значения необходимо: - В ТДС ''Интернет-магазин корзина'' на шаге 1 после создания объекта ''Shop_Address_Controller_Show'' добавить следующий код, который выведет в XML необходимые данные: shop_country_id); if ($oShopCountry) { $aoShopCountryLocations = $oShopCountry ->Shop_Country_Locations ->findAll(); if (count($aoShopCountryLocations) > 0) { $oShopCountryLocation = $defaultLocation !== NULL ? $defaultLocation : $aoShopCountryLocations[0]; if ($oShopCountryLocation) { $aoShopCountryLocationCities = $oShopCountryLocation ->Shop_Country_Location_Cities ->findAll(); $Shop_Address_Controller_Show ->addEntities($aoShopCountryLocations) ->addEntity( Core::factory('Core_Xml_Entity') ->name('current_shop_country_location_id') ->value($oShopCountryLocation->id) ); if (count($aoShopCountryLocationCities) > 0) { $oShopCountryLocationCity = $defaultCity !== NULL ? $defaultCity : $aoShopCountryLocationCities[0]; $Shop_Address_Controller_Show ->addEntities($aoShopCountryLocationCities) ->addEntity( Core::factory('Core_Xml_Entity') ->name('current_shop_country_location_city_id') ->value($oShopCountryLocationCity->id) ); } } } } Переменные ''$defaultLocation'' и ''$defaultCity'' задают область и город по умолчанию. - Затем в XSL шаблоне ''МагазинАдресДоставки'' добавить код для вывода областей и городов в выпадающих списках, если такой отстуствует в шаблоне:
Область:
*
Город:
... и сами шаблоны (также при отсутствии):