burnbright/silverstripe-regionaldata 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

burnbright/silverstripe-regionaldata

Composer 安装命令:

composer require burnbright/silverstripe-regionaldata

包简介

Provides country and country subdivision datamodels, along with data.

README 文档

README

Provides reusable models, data, and fields for hierarichal geographical region classification of countries, and their subdivisons. The module should help to close the gap between known data, and arbitrary (possibly invalid) data entered by visitors.

A strong focus has been put on following the ISO 3166 standard.

This module is not intended to replace zend_locale.

Installation

  • Unzip to your silverstripe root / regionaldata.
  • Visit yoursite.tld/dev/tasks/LoadRegionalData

You should now be able to see countries and subdivisions in yoursite.tld/admin/regions

Possible Uses

  • Auto-completion country and state fields
  • Drop-down fields for entering valid data
  • Connect with other models for regionalisation
  • Addressing systems

Javascript Field Updater

Require the following script to templates / forms which have Country and State fields: regionaldata/javascript/updater.jquery.js

If you are using the shop module, a good place to include this is in an extension of Address:

function updateFormFields(FieldList $fields, $nameprefix = ""){
    Requirements::javascript('regionaldata/javascript/updater.jquery.js');
}

Provided Data Set

2nd level subdivisons have different names, eg: area, district, parish, county.

Most data has been sourced from commondatahub.com.

In the provided dataset, some countries have multiple types of subregion. There aer about 100 different subregions all toegether. In one case (United Kingdom), 11 types of sub region are present. This results in a very confusing 'Region/State' dropdown.You will probably not want to make every type available to users, so some cleanup will be needed.

This query will identify every type of sub region:

	SELECT DISTINCT `Type`
	FROM `CountrySubdivison` WHERE 1
	ORDER BY `Type`

Running this query will show the countries with multiple subregion types:

	SELECT *, COUNT(DISTINCT `Type`) as `Types`
	FROM `CountrySubdivison`
	GROUP BY `CountryID`
	HAVING `Types` > 1
	ORDER BY `Types` DESC

Future TODO / Ideas

  • Write a SQL query to clean up data set
  • Store address formats. Some countries don't require all address fields, others do.
  • Translation of names
  • 3rd-level post/zip code storage model

统计信息

  • 总下载量: 347
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2014-07-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固