Example #1
0
 /**
  * The zones settings view
  */
 static function view_settings_zones()
 {
     self::$objTemplate->addBlockfile('SHOP_SETTINGS_FILE', 'settings_block', 'module_shop_settings_zones.html');
     $arrZones = Zones::getZoneArray();
     $selectFirst = false;
     $strZoneOptions = '';
     foreach ($arrZones as $zone_id => $arrZone) {
         // Skip zone "All"
         if ($zone_id == 1) {
             continue;
         }
         $strZoneOptions .= '<option value="' . $zone_id . '"' . ($selectFirst ? '' : \Html::ATTRIBUTE_SELECTED) . '>' . $arrZone['name'] . "</option>\n";
         $arrCountryInZone = \Cx\Core\Country\Controller\Country::getArraysByZoneId($zone_id);
         $strSelectedCountries = '';
         foreach ($arrCountryInZone['in'] as $country_id => $arrCountry) {
             $strSelectedCountries .= '<option value="' . $country_id . '">' . $arrCountry['name'] . "</option>\n";
         }
         $strCountryList = '';
         foreach ($arrCountryInZone['out'] as $country_id => $arrCountry) {
             $strCountryList .= '<option value="' . $country_id . '">' . $arrCountry['name'] . "</option>\n";
         }
         self::$objTemplate->setVariable(array('SHOP_ZONE_ID' => $zone_id, 'ZONE_ACTIVE_STATUS' => $arrZone['active'] ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_ZONE_NAME' => $arrZone['name'], 'SHOP_ZONE_DISPLAY_STYLE' => $selectFirst ? 'display: none;' : 'display: block;', 'SHOP_ZONE_SELECTED_COUNTRIES_OPTIONS' => $strSelectedCountries, 'SHOP_COUNTRY_LIST_OPTIONS' => $strCountryList));
         self::$objTemplate->parse('shopZones');
         $selectFirst = true;
     }
     self::$objTemplate->setVariable(array('SHOP_ZONES_OPTIONS' => $strZoneOptions, 'SHOP_ZONE_COUNTRY_LIST' => \Cx\Core\Country\Controller\Country::getMenuoptions()));
 }