Add generic 'geo-zones' a full list of country specific regions and the ability to categorise them into zones
Adds a list of ISO-3166-2 "Subdivisions" and allows for these to be divided up into "Zones" (which can be used for geographical identicifation)
The initial list is generated based on data provided by the Debian project. more at:
NOTE This module just provides data that you can then work with on your SilverStripe
Easiest is to install via composer:
composer require silvercommerce/geozones
All GeoZone settings are linked to
SiteConfig, to setup new Zones, or add new regions, you can
do this by visit site settings and selecting the "GeoZones" tab.
This module also provides a
RegionSelectionField which is a simple ajax powered form
field that can be used to filter the regions list by a pre-defined country code.
You can add a
RegionSelectionField to your code via the following:
use SilverCommerce\GeoZones\Forms\RegionSelectionField; $form = Form::create( $this, 'PostageForm', $fields = FieldList::create( DropdownField::create( 'Country', 'Country', array_change_key_case( i18n::getData()->getCountries(), CASE_UPPER ) ), RegionSelectionField::create( "Region", "County/State", "Country" // name of the field in this form responsible for setting a country code ) ), $actions = FieldList::create( FormAction::create( "doSetPostage", _t('SilverCommerce\ShoppingCart.Search', "Search") ) ), $required = RequiredFields::create(array( "Country", "Region" )) );
NOTE You must add a field to the same form that is responsible for setting a valid
country code (ISO 3166 2 character) for
RegionSelectionField to work.
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem