mirror of
https://github.com/10h30/woo-viet.git
synced 2026-07-12 03:06:29 +09:00
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f694d19ffb | |||
| 621f52167b | |||
| 5d06fda9a9 | |||
| 5cff285182 | |||
| 941438dda8 | |||
| 8df0f11869 | |||
| 6c76275499 | |||
| 69c7dfae3c | |||
| 44c0a34fe8 | |||
| a33745b850 | |||
| dc226abb88 | |||
| 4f73556b27 | |||
| 58022a6650 | |||
| 9fe23bd609 | |||
| 0d07ecca4c | |||
| 0e252a978a | |||
| 70d2182b50 | |||
| cb989175a5 | |||
| 5f43aeb47d | |||
| 3eeb71bf69 | |||
| 7f87b70d6c | |||
| b61c2499df | |||
| 5150d9ad17 | |||
| 7083167c33 | |||
| def805022d | |||
| c83e429e41 | |||
| 1736fa1207 | |||
| 58fee75673 | |||
| bcb811c7e7 | |||
| c0392e40d3 | |||
| 173367c1ba | |||
| d66524ae35 | |||
| aff1b92105 | |||
| f524fe1385 | |||
| 1367213f25 | |||
| 4c6f02f4ec | |||
| de81124fe0 | |||
| 16a12b59ae | |||
| b3eb79cc3f |
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@@ -5,7 +5,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the admin page under wp-admin -> WooCommerce -> WooCommerce for Vietnam
|
||||
* Create the admin page under wp-admin -> WooCommerce -> Woo Viet
|
||||
*
|
||||
* @author htdat
|
||||
* @since 1.0
|
||||
@@ -36,33 +36,33 @@ class WooViet_Admin_Page {
|
||||
*/
|
||||
public function save_settings() {
|
||||
if ( wp_verify_nonce( $_REQUEST['wooviet_nonce'], 'wooviet_save_settings' ) ) {
|
||||
update_option( 'woocommerce-for-vietnam', $_REQUEST['settings'] );
|
||||
update_option( 'woo-viet', $_REQUEST['settings'] );
|
||||
|
||||
$this->message =
|
||||
'<div class="updated notice"><p><strong>' .
|
||||
__( 'Settings saved', 'woocommerce-for-vietnam' ) .
|
||||
__( 'Settings saved', 'woo-viet' ) .
|
||||
'</p></strong></div>';
|
||||
|
||||
} else {
|
||||
|
||||
$this->message =
|
||||
'<div class="error notice"><p><strong>' .
|
||||
__( 'Can not save settings! Please refresh this page.', 'woocommerce-for-vietnam' ) .
|
||||
__( 'Can not save settings! Please refresh this page.', 'woo-viet' ) .
|
||||
'</p></strong></div>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the sub-menu under "WooCommerce"
|
||||
* Link: http://my-site.com/wp-admin/admin.php?page=woocommerce-for-vietnam
|
||||
* Link: http://my-site.com/wp-admin/admin.php?page=woo-viet
|
||||
*/
|
||||
public function register_submenu_page() {
|
||||
add_submenu_page(
|
||||
'woocommerce',
|
||||
'WooCommerce for Vietnam Settings',
|
||||
'WooCommerce for Vietnam',
|
||||
__( 'Woo Viet Settings', 'woo-viet' ),
|
||||
'Woo Viet',
|
||||
'manage_options',
|
||||
'woocommerce-for-vietnam',
|
||||
'woo-viet',
|
||||
array( $this, 'admin_page_html' )
|
||||
);
|
||||
}
|
||||
@@ -89,61 +89,100 @@ class WooViet_Admin_Page {
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Add provinces for Vietnam', 'woocommerce-for-vietnam' ) ?></th>
|
||||
<th scope="row"><?php _e( 'Add the OnePay Domestic Gateway', 'woo-viet' ) ?></th>
|
||||
<td>
|
||||
<input name="settings[add_onepay_domestic][enabled]" type="hidden" value="no">
|
||||
<input name="settings[add_onepay_domestic][enabled]" type="checkbox"
|
||||
id="add_onepay_domestic" value="yes"
|
||||
<?php if ( 'yes' == $settings['add_onepay_domestic']['enabled'] )
|
||||
echo 'checked="checked"' ?>>
|
||||
<label for="add_onepay_domestic"><?php _e( 'Enabled', 'woo-viet' ) ?></label>
|
||||
<br/>
|
||||
<br/>
|
||||
<label for="">
|
||||
<?php
|
||||
echo sprintf( __( 'Your store currency is <code>%s</code>. ', 'woo-viet' ), get_woocommerce_currency() );
|
||||
// Handle whether or not the store current is VND
|
||||
if ( 'VND' == get_woocommerce_currency() ) {
|
||||
_e( 'OnePay can work on your site.', 'woo-viet' );
|
||||
echo '<br/>';
|
||||
echo sprintf( __( 'Please configure this gateway under <a href="%s">WooCommerce -> Settings -> Checkout</a>.', 'woo-viet' ), admin_url( 'admin.php?page=wc-settings&tab=checkout' ) );
|
||||
} else {
|
||||
_e( '<span style="color: red" ">This gateway is not active on your site. Because OnePay supports VND only.</span>', 'woo-viet' );
|
||||
}
|
||||
|
||||
?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Add provinces for Vietnam', 'woo-viet' ) ?></th>
|
||||
<td>
|
||||
<input name="settings[add_province][enabled]" type="hidden" value="no">
|
||||
<input name="settings[add_province][enabled]" type="checkbox" id="add_province" value="yes"
|
||||
<?php if ( 'yes' == $settings['add_province']['enabled'] )
|
||||
echo 'checked="checked"' ?>>
|
||||
<label for="add_province"><?php _e( 'Enabled', 'woocommerce-for-vietnam' ) ?></label>
|
||||
<label for="add_province"><?php _e( 'Enabled', 'woo-viet' ) ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Change VND currency symbol', 'woocommerce-for-vietnam' ) ?></th>
|
||||
<th scope="row"><?php _e( 'Add districts for Vietnam', 'woo-viet' ) ?><br/>
|
||||
<i><?php _e( 'Require "Add provinces for Vietnam" active', 'woo-viet' ) ?></i>
|
||||
</th>
|
||||
<td>
|
||||
<input name="settings[add_city][enabled]" type="hidden" value="no">
|
||||
<input name="settings[add_city][enabled]" type="checkbox" id="add_city" value="yes"
|
||||
<?php if ( 'yes' == $settings['add_city']['enabled'] )
|
||||
echo 'checked="checked"' ?>>
|
||||
<label for="add_city"><?php _e( 'Enabled', 'woo-viet' ) ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Change VND currency symbol', 'woo-viet' ) ?></th>
|
||||
<td>
|
||||
<input name="settings[change_currency_symbol][enabled]" type="hidden" value="no">
|
||||
<input name="settings[change_currency_symbol][enabled]" type="checkbox"
|
||||
id="change_currency_symbol" value="yes"
|
||||
<?php if ( 'yes' == $settings['change_currency_symbol']['enabled'] )
|
||||
echo 'checked="checked"' ?>>
|
||||
<label for="change_currency_symbol"><?php _e( 'Enabled', 'woocommerce-for-vietnam' ) ?></label>
|
||||
<label for="change_currency_symbol"><?php _e( 'Enabled', 'woo-viet' ) ?></label>
|
||||
<br/>
|
||||
<br/>
|
||||
<input type="text" name="settings[change_currency_symbol][text]"
|
||||
value="<?php echo $settings['change_currency_symbol']['text'] ?>"
|
||||
id="change_currency_symbol_text" class="small-text">
|
||||
<label for="change_currency_symbol_text"><?php _e( 'Insert a text to change the default symbol <code>đ</code>', 'woocommerce-for-vietnam' ) ?></label>
|
||||
<label for="change_currency_symbol_text"><?php _e( 'Insert a text to change the default symbol <code>đ</code>', 'woo-viet' ) ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Convert <code>000</code> of prices to K (or anything)', 'woocommerce-for-vietnam' ) ?></th>
|
||||
<th scope="row"><?php _e( 'Convert <code>000</code> of prices to K (or anything)', 'woo-viet' ) ?></th>
|
||||
<td>
|
||||
<input name="settings[convert_price][enabled]" type="hidden" value="no">
|
||||
<input name="settings[convert_price][enabled]" type="checkbox" id="convert_price"
|
||||
value="yes"
|
||||
<?php if ( 'yes' == $settings['convert_price']['enabled'] )
|
||||
echo 'checked="checked"' ?>>
|
||||
<label for="convert_price"><?php _e( 'Enabled', 'woocommerce-for-vietnam' ) ?></label>
|
||||
<label for="convert_price"><?php _e( 'Enabled', 'woo-viet' ) ?></label>
|
||||
|
||||
<fieldset><br/>
|
||||
<input type="text" name="settings[convert_price][text]"
|
||||
value="<?php echo $settings['convert_price']['text'] ?>"
|
||||
id="convert_price_text" class="small-text">
|
||||
<label for="convert_price_text"><?php _e( 'Choose what you want to change. E.g:', 'woocommerce-for-vietnam' ) ?>
|
||||
<label for="convert_price_text"><?php _e( 'Choose what you want to change. E.g:', 'woo-viet' ) ?>
|
||||
<code>K</code>, <code>nghìn</code>, <code>ngàn</code></label>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php printf( __( 'Support VND for <a href="%s">the PayPal Standard gateway</a>', 'woocommerce-for-vietnam' ), 'https://docs.woocommerce.com/document/paypal-standard/' ) ?></th>
|
||||
<th scope="row"><?php printf( __( 'Support VND for <a href="%s">the PayPal Standard gateway</a>', 'woo-viet' ), 'https://docs.woocommerce.com/document/paypal-standard/' ) ?></th>
|
||||
<td>
|
||||
<input name="settings[vnd_paypal_standard][enabled]" type="hidden" value="no">
|
||||
<input name="settings[vnd_paypal_standard][enabled]" type="checkbox"
|
||||
id="vnd_paypal_standard" value="yes"
|
||||
<?php if ( 'yes' == $settings['vnd_paypal_standard']['enabled'] )
|
||||
echo 'checked="checked"' ?>>
|
||||
<label for="vnd_paypal_standard"><?php _e( 'Enabled', 'woocommerce-for-vietnam' ) ?></label>
|
||||
<label for="vnd_paypal_standard"><?php _e( 'Enabled', 'woo-viet' ) ?></label>
|
||||
|
||||
<fieldset><br/>
|
||||
<select name="settings[vnd_paypal_standard][currency]"
|
||||
@@ -188,14 +227,14 @@ class WooViet_Admin_Page {
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<label for="vnd_paypal_standard_currency"><?php _e( 'Select a PayPal supported currency (like USD, EUR, etc), which is used to convert VND prices', 'woocommerce-for-vietnam' ) ?></label>
|
||||
<label for="vnd_paypal_standard_currency"><?php _e( 'Select a PayPal supported currency (like USD, EUR, etc), which is used to convert VND prices', 'woo-viet' ) ?></label>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<input name="settings[vnd_paypal_standard][rate]" type="number" step="1" min="100"
|
||||
id="vnd_paypal_standard_rate" style="width: 70px;"
|
||||
value="<?php echo $settings['vnd_paypal_standard']['rate'] ?>"
|
||||
<label for="vnd_paypal_standard_rate"><?php _e( 'Insert the exchange rate of this currency to VND', 'woocommerce-for-vietnam' ) ?></label>
|
||||
<label for="vnd_paypal_standard_rate"><?php _e( 'Insert the exchange rate of this currency to VND', 'woo-viet' ) ?></label>
|
||||
</fieldset>
|
||||
|
||||
</td>
|
||||
|
||||
@@ -0,0 +1,887 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Vietnam Cities to WooCommerce
|
||||
*
|
||||
* @credit: https://github.com/8manos/wc-city-select
|
||||
* @author htdat
|
||||
* @since 1.2
|
||||
*
|
||||
*
|
||||
*/
|
||||
class WooViet_Cities {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
/**
|
||||
* Load the 'WC City Select' class if this plugin is NOT active
|
||||
*/
|
||||
if ( ! class_exists( 'WC_City_Select' ) ) {
|
||||
include( WOO_VIET_DIR . 'lib/wc-city-select/wc-city-select.php' );
|
||||
}
|
||||
|
||||
add_filter( 'wc_city_select_cities', array( $this, 'add_cities' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Vietnam Cities
|
||||
*
|
||||
* @param $cities
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add_cities( $cities ) {
|
||||
/**
|
||||
* @source: https://github.com/htdat/woo-viet/issues/4#issuecomment-277449462
|
||||
* @source: https://gist.github.com/10h30/7e9307d405ff9ef88cf7d226c90a5d13
|
||||
*/
|
||||
$cities['VN'] = array(
|
||||
'AN-GIANG' => array(
|
||||
'Huyện An Phú',
|
||||
'Huyện Châu Phú',
|
||||
'Huyện Châu Thành',
|
||||
'Huyện Chợ Mới',
|
||||
'Huyện Phú Tân',
|
||||
'Huyện Thoại Sơn',
|
||||
'Huyện Tịnh Biên',
|
||||
'Huyện Tri Tôn',
|
||||
'Thành phố Châu Đốc',
|
||||
'Thành phố Long Xuyên',
|
||||
'Thị xã Tân Châu'
|
||||
),
|
||||
'BA-RIA-VUNG-TAU' => array(
|
||||
'Huyện Châu Đức',
|
||||
'Huyện Côn Đảo',
|
||||
'Huyện Đất Đỏ',
|
||||
'Huyện Long Điền',
|
||||
'Huyện Tân Thành',
|
||||
'Huyện Xuyên Mộc',
|
||||
'Thành phố Bà Rịa',
|
||||
'Thành phố Vũng Tàu'
|
||||
),
|
||||
'BAC-LIEU' => array(
|
||||
'Huyện Đông Hải',
|
||||
'Huyện Hoà Bình',
|
||||
'Huyện Hồng Dân',
|
||||
'Huyện Phước Long',
|
||||
'Huyện Vĩnh Lợi',
|
||||
'Thành phố Bạc Liêu',
|
||||
'Thị xã Giá Rai'
|
||||
),
|
||||
'BAC-KAN' => array(
|
||||
'Huyện Ba Bể',
|
||||
'Huyện Bạch Thông',
|
||||
'Huyện Chợ Đồn',
|
||||
'Huyện Chợ Mới',
|
||||
'Huyện Na Rì',
|
||||
'Huyện Ngân Sơn',
|
||||
'Huyện Pác Nặm',
|
||||
'Thành Phố Bắc Kạn',
|
||||
),
|
||||
'BAC-GIANG' => array(
|
||||
'Huyện Hiệp Hòa',
|
||||
'Huyện Lạng Giang',
|
||||
'Huyện Lục Nam',
|
||||
'Huyện Lục Ngạn',
|
||||
'Huyện Sơn Động',
|
||||
'Huyện Tân Yên',
|
||||
'Huyện Việt Yên',
|
||||
'Huyện Yên Dũng',
|
||||
'Huyện Yên Thế',
|
||||
'Thành phố Bắc Giang'
|
||||
),
|
||||
'BAC-NINH' => array(
|
||||
'Huyện Gia Bình',
|
||||
'Huyện Lương Tài',
|
||||
'Huyện Quế Võ',
|
||||
'Huyện Thuận Thành',
|
||||
'Huyện Tiên Du',
|
||||
'Huyện Yên Phong',
|
||||
'Thành phố Bắc Ninh',
|
||||
'Thị xã Từ Sơn'
|
||||
),
|
||||
'BEN-TRE' => array(
|
||||
'Huyện Ba Tri',
|
||||
'Huyện Bình Đại',
|
||||
'Huyện Châu Thành',
|
||||
'Huyện Chợ Lách',
|
||||
'Huyện Giồng Trôm',
|
||||
'Huyện Mỏ Cày Bắc',
|
||||
'Huyện Mỏ Cày Nam',
|
||||
'Huyện Thạnh Phú',
|
||||
'Thành phố Bến Tre'
|
||||
),
|
||||
'BINH-DUONG' => array(
|
||||
'Huyện Bắc Tân Uyên',
|
||||
'Huyện Bàu Bàng',
|
||||
'Huyện Dầu Tiếng',
|
||||
'Huyện Phú Giáo',
|
||||
'Thành phố Thủ Dầu Một',
|
||||
'Thị xã Bến Cát',
|
||||
'Thị xã Dĩ An',
|
||||
'Thị xã Tân Uyên',
|
||||
'Thị xã Thuận An'
|
||||
),
|
||||
'BINH-DINH' => array(
|
||||
'Huyện An Lão',
|
||||
'Huyện Hoài Ân',
|
||||
'Huyện Hoài Nhơn',
|
||||
'Huyện Phù Cát',
|
||||
'Huyện Phù Mỹ',
|
||||
'Huyện Tây Sơn',
|
||||
'Huyện Tuy Phước',
|
||||
'Huyện Vân Canh',
|
||||
'Huyện Vĩnh Thạnh',
|
||||
'Thành phố Qui Nhơn',
|
||||
'Thị xã An Nhơn'
|
||||
),
|
||||
'BINH-PHUOC' => array(
|
||||
'Huyện Bù Đăng',
|
||||
'Huyện Bù Đốp',
|
||||
'Huyện Bù Gia Mập',
|
||||
'Huyện Chơn Thành',
|
||||
'Huyện Đồng Phú',
|
||||
'Huyện Hớn Quản',
|
||||
'Huyện Lộc Ninh',
|
||||
'Huyện Phú Riềng',
|
||||
'Thị xã Bình Long',
|
||||
'Thị xã Đồng Xoài',
|
||||
'Thị xã Phước Long'
|
||||
),
|
||||
'BINH-THUAN' => array(
|
||||
'Huyện Bắc Bình',
|
||||
'Huyện Đức Linh',
|
||||
'Huyện Hàm Tân',
|
||||
'Huyện Hàm Thuận Bắc',
|
||||
'Huyện Hàm Thuận Nam',
|
||||
'Huyện Phú Quí',
|
||||
'Huyện Tánh Linh',
|
||||
'Huyện Tuy Phong',
|
||||
'Thành phố Phan Thiết',
|
||||
'Thị xã La Gi'
|
||||
),
|
||||
'CA-MAU' => array(
|
||||
'Huyện Cái Nước',
|
||||
'Huyện Đầm Dơi',
|
||||
'Huyện Năm Căn',
|
||||
'Huyện Ngọc Hiển',
|
||||
'Huyện Phú Tân',
|
||||
'Huyện Thới Bình',
|
||||
'Huyện Trần Văn Thời',
|
||||
'Huyện U Minh',
|
||||
'Thành phố Cà Mau'
|
||||
),
|
||||
'CAO-BANG' => array(
|
||||
'Huyện Bảo Lạc',
|
||||
'Huyện Bảo Lâm',
|
||||
'Huyện Hạ Lang',
|
||||
'Huyện Hà Quảng',
|
||||
'Huyện Hoà An',
|
||||
'Huyện Nguyên Bình',
|
||||
'Huyện Phục Hoà',
|
||||
'Huyện Quảng Uyên',
|
||||
'Huyện Thạch An',
|
||||
'Huyện Thông Nông',
|
||||
'Huyện Trà Lĩnh',
|
||||
'Huyện Trùng Khánh',
|
||||
'Thành phố Cao Bằng'
|
||||
),
|
||||
'CAN-THO' => array(
|
||||
'Huyện Cờ Đỏ',
|
||||
'Huyện Phong Điền',
|
||||
'Huyện Thới Lai',
|
||||
'Huyện Vĩnh Thạnh',
|
||||
'Quận Bình Thuỷ',
|
||||
'Quận Cái Răng',
|
||||
'Quận Ninh Kiều',
|
||||
'Quận Ô Môn',
|
||||
'Quận Thốt Nốt',
|
||||
),
|
||||
'DA-NANG' => array(
|
||||
'Huyện Hòa Vang',
|
||||
'Huyện Hoàng Sa',
|
||||
'Quận Cẩm Lệ',
|
||||
'Quận Hải Châu',
|
||||
'Quận Liên Chiểu',
|
||||
'Quận Ngũ Hành Sơn',
|
||||
'Quận Sơn Trà',
|
||||
'Quận Thanh Khê',
|
||||
),
|
||||
'DAK-LAK' => array(
|
||||
'Huyện Buôn Đôn',
|
||||
'Huyện Cư Kuin',
|
||||
'Huyện Cư M gar',
|
||||
'Huyện Ea H leo',
|
||||
'Huyện Ea Kar',
|
||||
'Huyện Ea Súp',
|
||||
'Huyện Krông A Na',
|
||||
'Huyện Krông Bông',
|
||||
'Huyện Krông Búk',
|
||||
'Huyện Krông Năng',
|
||||
'Huyện Krông Pắc',
|
||||
'Huyện Lắk',
|
||||
'Huyện M Đrắk',
|
||||
'Thành phố Buôn Ma Thuột',
|
||||
'Thị Xã Buôn Hồ'
|
||||
),
|
||||
'DAK-NONG' => array(
|
||||
'Huyện Cư Jút',
|
||||
'Huyện Đăk Glong',
|
||||
'Huyện Đắk Mil',
|
||||
'Huyện Đắk R Lấp',
|
||||
'Huyện Đắk Song',
|
||||
'Huyện Krông Nô',
|
||||
'Huyện Tuy Đức',
|
||||
'Thị xã Gia Nghĩa'
|
||||
),
|
||||
'DONG-NAI' => array(
|
||||
'Huyện Cẩm Mỹ',
|
||||
'Huyện Định Quán',
|
||||
'Huyện Long Thành',
|
||||
'Huyện Nhơn Trạch',
|
||||
'Huyện Tân Phú',
|
||||
'Huyện Thống Nhất',
|
||||
'Huyện Trảng Bom',
|
||||
'Huyện Vĩnh Cửu',
|
||||
'Huyện Xuân Lộc',
|
||||
'Thành phố Biên Hòa',
|
||||
'Thị xã Long Khánh'
|
||||
),
|
||||
'DONG-THAP' => array(
|
||||
'Huyện Cao Lãnh',
|
||||
'Huyện Châu Thành',
|
||||
'Huyện Hồng Ngự',
|
||||
'Huyện Lai Vung',
|
||||
'Huyện Lấp Vò',
|
||||
'Huyện Tam Nông',
|
||||
'Huyện Tân Hồng',
|
||||
'Huyện Thanh Bình',
|
||||
'Huyện Tháp Mười',
|
||||
'Thành phố Cao Lãnh',
|
||||
'Thành phố Sa Đéc',
|
||||
'Thị xã Hồng Ngự'
|
||||
),
|
||||
'DIEN-BIEN' => array(
|
||||
'Huyện Điện Biên',
|
||||
'Huyện Điện Biên Đông',
|
||||
'Huyện Mường Ảng',
|
||||
'Huyện Mường Chà',
|
||||
'Huyện Mường Nhé',
|
||||
'Huyện Nậm Pồ',
|
||||
'Huyện Tủa Chùa',
|
||||
'Huyện Tuần Giáo',
|
||||
'Thành phố Điện Biên Phủ',
|
||||
'Thị Xã Mường Lay'
|
||||
),
|
||||
'GIA-LAI' => array(
|
||||
'Huyện Chư Păh',
|
||||
'Huyện Chư Prông',
|
||||
'Huyện Chư Pưh',
|
||||
'Huyện Chư Sê',
|
||||
'Huyện Đăk Đoa',
|
||||
'Huyện Đăk Pơ',
|
||||
'Huyện Đức Cơ',
|
||||
'Huyện Ia Grai',
|
||||
'Huyện Ia Pa',
|
||||
'Huyện KBang',
|
||||
'Huyện Kông Chro',
|
||||
'Huyện Krông Pa',
|
||||
'Huyện Mang Yang',
|
||||
'Huyện Phú Thiện',
|
||||
'Thành phố Pleiku',
|
||||
'Thị xã An Khê',
|
||||
'Thị xã Ayun Pa'
|
||||
),
|
||||
'HA-GIANG' => array(
|
||||
'Huyện Bắc Mê',
|
||||
'Huyện Bắc Quang',
|
||||
'Huyện Đồng Văn',
|
||||
'Huyện Hoàng Su Phì',
|
||||
'Huyện Mèo Vạc',
|
||||
'Huyện Quản Bạ',
|
||||
'Huyện Quang Bình',
|
||||
'Huyện Vị Xuyên',
|
||||
'Huyện Xín Mần',
|
||||
'Huyện Yên Minh',
|
||||
'Thành phố Hà Giang'
|
||||
),
|
||||
'HA-NAM' => array(
|
||||
'Huyện Bình Lục',
|
||||
'Huyện Duy Tiên',
|
||||
'Huyện Kim Bảng',
|
||||
'Huyện Lý Nhân',
|
||||
'Huyện Thanh Liêm',
|
||||
'Thành phố Phủ Lý'
|
||||
),
|
||||
'HA-NOI' => array(
|
||||
'Huyện Ba Vì',
|
||||
'Huyện Chương Mỹ',
|
||||
'Huyện Đan Phượng',
|
||||
'Huyện Đông Anh',
|
||||
'Huyện Gia Lâm',
|
||||
'Huyện Hoài Đức',
|
||||
'Huyện Mê Linh',
|
||||
'Huyện Mỹ Đức',
|
||||
'Huyện Phú Xuyên',
|
||||
'Huyện Phúc Thọ',
|
||||
'Huyện Quốc Oai',
|
||||
'Huyện Sóc Sơn',
|
||||
'Huyện Thạch Thất',
|
||||
'Huyện Thanh Oai',
|
||||
'Huyện Thanh Trì',
|
||||
'Huyện Thường Tín',
|
||||
'Huyện Ứng Hòa',
|
||||
'Quận Ba Đình',
|
||||
'Quận Bắc Từ Liêm',
|
||||
'Quận Cầu Giấy',
|
||||
'Quận Đống Đa',
|
||||
'Quận Hà Đông',
|
||||
'Quận Hai Bà Trưng',
|
||||
'Quận Hoàn Kiếm',
|
||||
'Quận Hoàng Mai',
|
||||
'Quận Long Biên',
|
||||
'Quận Nam Từ Liêm',
|
||||
'Quận Tây Hồ',
|
||||
'Quận Thanh Xuân',
|
||||
'Thị xã Sơn Tây'
|
||||
),
|
||||
'HA-TINH' => array(
|
||||
'Huyện Cẩm Xuyên',
|
||||
'Huyện Can Lộc',
|
||||
'Huyện Đức Thọ',
|
||||
'Huyện Hương Khê',
|
||||
'Huyện Hương Sơn',
|
||||
'Huyện Kỳ Anh',
|
||||
'Huyện Lộc Hà',
|
||||
'Huyện Nghi Xuân',
|
||||
'Huyện Thạch Hà',
|
||||
'Huyện Vũ Quang',
|
||||
'Thành phố Hà Tĩnh',
|
||||
'Thị xã Hồng Lĩnh',
|
||||
'Thị xã Kỳ Anh'
|
||||
),
|
||||
'HAI-DUONG' => array(
|
||||
'Huyện Bình Giang',
|
||||
'Huyện Cẩm Giàng',
|
||||
'Huyện Gia Lộc',
|
||||
'Huyện Kim Thành',
|
||||
'Huyện Kinh Môn',
|
||||
'Huyện Nam Sách',
|
||||
'Huyện Ninh Giang',
|
||||
'Huyện Thanh Hà',
|
||||
'Huyện Thanh Miện',
|
||||
'Huyện Tứ Kỳ',
|
||||
'Thành phố Hải Dương',
|
||||
'Thị xã Chí Linh'
|
||||
),
|
||||
'HAI-PHONG' => array(
|
||||
'Huyện An Dương',
|
||||
'Huyện An Lão',
|
||||
'Huyện Bạch Long Vĩ',
|
||||
'Huyện Cát Hải',
|
||||
'Huyện Kiến Thuỵ',
|
||||
'Huyện Thuỷ Nguyên',
|
||||
'Huyện Tiên Lãng',
|
||||
'Huyện Vĩnh Bảo',
|
||||
'Quận Đồ Sơn',
|
||||
'Quận Dương Kinh',
|
||||
'Quận Hải An',
|
||||
'Quận Hồng Bàng',
|
||||
'Quận Kiến An',
|
||||
'Quận Lê Chân',
|
||||
'Quận Ngô Quyền'
|
||||
),
|
||||
'HOA-BINH' => array(
|
||||
'Huyện Cao Phong',
|
||||
'Huyện Đà Bắc',
|
||||
'Huyện Kim Bôi',
|
||||
'Huyện Kỳ Sơn',
|
||||
'Huyện Lạc Sơn',
|
||||
'Huyện Lạc Thủy',
|
||||
'Huyện Lương Sơn',
|
||||
'Huyện Mai Châu',
|
||||
'Huyện Tân Lạc',
|
||||
'Huyện Yên Thủy',
|
||||
'Thành phố Hòa Bình'
|
||||
),
|
||||
'HAU-GIANG' => array(
|
||||
'Huyện Châu Thành',
|
||||
'Huyện Châu Thành A',
|
||||
'Huyện Long Mỹ',
|
||||
'Huyện Phụng Hiệp',
|
||||
'Huyện Vị Thuỷ',
|
||||
'Thành phố Vị Thanh',
|
||||
'Thị xã Long Mỹ',
|
||||
'Thị xã Ngã Bảy'
|
||||
),
|
||||
'HUNG-YEN' => array(
|
||||
'Huyện Ân Thi',
|
||||
'Huyện Khoái Châu',
|
||||
'Huyện Kim Động',
|
||||
'Huyện Mỹ Hào',
|
||||
'Huyện Phù Cừ',
|
||||
'Huyện Tiên Lữ',
|
||||
'Huyện Văn Giang',
|
||||
'Huyện Văn Lâm',
|
||||
'Huyện Yên Mỹ',
|
||||
'Thành phố Hưng Yên'
|
||||
),
|
||||
'HO-CHI-MINH' => array(
|
||||
'Huyện Bình Chánh',
|
||||
'Huyện Cần Giờ',
|
||||
'Huyện Củ Chi',
|
||||
'Huyện Hóc Môn',
|
||||
'Huyện Nhà Bè',
|
||||
'Quận 1',
|
||||
'Quận 10',
|
||||
'Quận 11',
|
||||
'Quận 12',
|
||||
'Quận 2',
|
||||
'Quận 3',
|
||||
'Quận 4',
|
||||
'Quận 5',
|
||||
'Quận 6',
|
||||
'Quận 7',
|
||||
'Quận 8',
|
||||
'Quận 9',
|
||||
'Quận Bình Tân',
|
||||
'Quận Bình Thạnh',
|
||||
'Quận Gò Vấp',
|
||||
'Quận Phú Nhuận',
|
||||
'Quận Tân Bình',
|
||||
'Quận Tân Phú',
|
||||
'Quận Thủ Đức'
|
||||
),
|
||||
'KHANH-HOA' => array(
|
||||
'Huyện Cam Lâm',
|
||||
'Huyện Diên Khánh',
|
||||
'Huyện Khánh Sơn',
|
||||
'Huyện Khánh Vĩnh',
|
||||
'Huyện Trường Sa',
|
||||
'Huyện Vạn Ninh',
|
||||
'Thành phố Cam Ranh',
|
||||
'Thành phố Nha Trang',
|
||||
'Thị xã Ninh Hòa'
|
||||
),
|
||||
'KIEN-GIANG' => array(
|
||||
'Huyện An Biên',
|
||||
'Huyện An Minh',
|
||||
'Huyện Châu Thành',
|
||||
'Huyện Giang Thành',
|
||||
'Huyện Giồng Riềng',
|
||||
'Huyện Gò Quao',
|
||||
'Huyện Hòn Đất',
|
||||
'Huyện Kiên Hải',
|
||||
'Huyện Kiên Lương',
|
||||
'Huyện Phú Quốc',
|
||||
'Huyện Tân Hiệp',
|
||||
'Huyện U Minh Thượng',
|
||||
'Huyện Vĩnh Thuận',
|
||||
'Thành phố Rạch Giá',
|
||||
'Thị xã Hà Tiên'
|
||||
),
|
||||
'KON-TUM' => array(
|
||||
'Huyện Đắk Glei',
|
||||
'Huyện Đắk Hà',
|
||||
'Huyện Đắk Tô',
|
||||
'Huyện Ia H Drai',
|
||||
'Huyện Kon Plông',
|
||||
'Huyện Kon Rẫy',
|
||||
'Huyện Ngọc Hồi',
|
||||
'Huyện Sa Thầy',
|
||||
'Huyện Tu Mơ Rông',
|
||||
'Thành phố Kon Tum'
|
||||
),
|
||||
'LAI-CHAU' => array(
|
||||
'Huyện Mường Tè',
|
||||
'Huyện Nậm Nhùn',
|
||||
'Huyện Phong Thổ',
|
||||
'Huyện Sìn Hồ',
|
||||
'Huyện Tam Đường',
|
||||
'Huyện Tân Uyên',
|
||||
'Huyện Than Uyên',
|
||||
'Thành phố Lai Châu'
|
||||
),
|
||||
'LAO-CAI' => array(
|
||||
'Huyện Bắc Hà',
|
||||
'Huyện Bảo Thắng',
|
||||
'Huyện Bảo Yên',
|
||||
'Huyện Bát Xát',
|
||||
'Huyện Mường Khương',
|
||||
'Huyện Sa Pa',
|
||||
'Huyện Si Ma Cai',
|
||||
'Huyện Văn Bàn',
|
||||
'Thành phố Lào Cai'
|
||||
),
|
||||
'LANG-SON' => array(
|
||||
'Huyện Bắc Sơn',
|
||||
'Huyện Bình Gia',
|
||||
'Huyện Cao Lộc',
|
||||
'Huyện Chi Lăng',
|
||||
'Huyện Đình Lập',
|
||||
'Huyện Hữu Lũng',
|
||||
'Huyện Lộc Bình',
|
||||
'Huyện Tràng Định',
|
||||
'Huyện Văn Lãng',
|
||||
'Huyện Văn Quan',
|
||||
'Thành phố Lạng Sơn'
|
||||
),
|
||||
'LAM-DONG' => array(
|
||||
'Huyện Bảo Lâm',
|
||||
'Huyện Cát Tiên',
|
||||
'Huyện Đạ Huoai',
|
||||
'Huyện Đạ Tẻh',
|
||||
'Huyện Đam Rông',
|
||||
'Huyện Di Linh',
|
||||
'Huyện Đơn Dương',
|
||||
'Huyện Đức Trọng',
|
||||
'Huyện Lạc Dương',
|
||||
'Huyện Lâm Hà',
|
||||
'Thành phố Bảo Lộc',
|
||||
'Thành phố Đà Lạt'
|
||||
),
|
||||
'LONG-AN' => array(
|
||||
'Huyện Bến Lức',
|
||||
'Huyện Cần Đước',
|
||||
'Huyện Cần Giuộc',
|
||||
'Huyện Châu Thành',
|
||||
'Huyện Đức Hòa',
|
||||
'Huyện Đức Huệ',
|
||||
'Huyện Mộc Hóa',
|
||||
'Huyện Tân Hưng',
|
||||
'Huyện Tân Thạnh',
|
||||
'Huyện Tân Trụ',
|
||||
'Huyện Thạnh Hóa',
|
||||
'Huyện Thủ Thừa',
|
||||
'Huyện Vĩnh Hưng',
|
||||
'Thành phố Tân An',
|
||||
'Thị xã Kiến Tường'
|
||||
),
|
||||
'NAM-DINH' => array(
|
||||
'Huyện Giao Thủy',
|
||||
'Huyện Hải Hậu',
|
||||
'Huyện Mỹ Lộc',
|
||||
'Huyện Nam Trực',
|
||||
'Huyện Nghĩa Hưng',
|
||||
'Huyện Trực Ninh',
|
||||
'Huyện Vụ Bản',
|
||||
'Huyện Xuân Trường',
|
||||
'Huyện Ý Yên',
|
||||
'Thành phố Nam Định'
|
||||
),
|
||||
'NGHE-AN' => array(
|
||||
'Huyện Anh Sơn',
|
||||
'Huyện Con Cuông',
|
||||
'Huyện Diễn Châu',
|
||||
'Huyện Đô Lương',
|
||||
'Huyện Hưng Nguyên',
|
||||
'Huyện Kỳ Sơn',
|
||||
'Huyện Nam Đàn',
|
||||
'Huyện Nghi Lộc',
|
||||
'Huyện Nghĩa Đàn',
|
||||
'Huyện Quế Phong',
|
||||
'Huyện Quỳ Châu',
|
||||
'Huyện Quỳ Hợp',
|
||||
'Huyện Quỳnh Lưu',
|
||||
'Huyện Tân Kỳ',
|
||||
'Huyện Thanh Chương',
|
||||
'Huyện Tương Dương',
|
||||
'Huyện Yên Thành',
|
||||
'Thành phố Vinh',
|
||||
'Thị xã Cửa Lò',
|
||||
'Thị xã Hoàng Mai',
|
||||
'Thị xã Thái Hoà'
|
||||
),
|
||||
'NINH-BINH' => array(
|
||||
'Huyện Gia Viễn',
|
||||
'Huyện Hoa Lư',
|
||||
'Huyện Kim Sơn',
|
||||
'Huyện Nho Quan',
|
||||
'Huyện Yên Khánh',
|
||||
'Huyện Yên Mô',
|
||||
'Thành phố Ninh Bình',
|
||||
'Thành phố Tam Điệp'
|
||||
),
|
||||
'NINH-THUAN' => array(
|
||||
'Huyện Bác Ái',
|
||||
'Huyện Ninh Hải',
|
||||
'Huyện Ninh Phước',
|
||||
'Huyện Ninh Sơn',
|
||||
'Huyện Thuận Bắc',
|
||||
'Huyện Thuận Nam',
|
||||
'Thành phố Phan Rang-Tháp Chàm'
|
||||
),
|
||||
'PHU-THO' => array(
|
||||
'Huyện Cẩm Khê',
|
||||
'Huyện Đoan Hùng',
|
||||
'Huyện Hạ Hoà',
|
||||
'Huyện Lâm Thao',
|
||||
'Huyện Phù Ninh',
|
||||
'Huyện Tam Nông',
|
||||
'Huyện Tân Sơn',
|
||||
'Huyện Thanh Ba',
|
||||
'Huyện Thanh Sơn',
|
||||
'Huyện Thanh Thuỷ',
|
||||
'Huyện Yên Lập',
|
||||
'Thành phố Việt Trì',
|
||||
'Thị xã Phú Thọ'
|
||||
),
|
||||
'PHU-YEN' => array(
|
||||
'Huyện Đông Hòa',
|
||||
'Huyện Đồng Xuân',
|
||||
'Huyện Phú Hoà',
|
||||
'Huyện Sơn Hòa',
|
||||
'Huyện Sông Hinh',
|
||||
'Huyện Tây Hoà',
|
||||
'Huyện Tuy An',
|
||||
'Thành phố Tuy Hoà',
|
||||
'Thị xã Sông Cầu'
|
||||
),
|
||||
'QUANG-BINH' => array(
|
||||
'Huyện Bố Trạch',
|
||||
'Huyện Lệ Thủy',
|
||||
'Huyện Minh Hóa',
|
||||
'Huyện Quảng Ninh',
|
||||
'Huyện Quảng Trạch',
|
||||
'Huyện Tuyên Hóa',
|
||||
'Thành Phố Đồng Hới',
|
||||
'Thị xã Ba Đồn'
|
||||
),
|
||||
'QUANG-NAM' => array(
|
||||
'Huyện Bắc Trà My',
|
||||
'Huyện Đại Lộc',
|
||||
'Huyện Đông Giang',
|
||||
'Huyện Duy Xuyên',
|
||||
'Huyện Hiệp Đức',
|
||||
'Huyện Nam Giang',
|
||||
'Huyện Nam Trà My',
|
||||
'Huyện Nông Sơn',
|
||||
'Huyện Núi Thành',
|
||||
'Huyện Phú Ninh',
|
||||
'Huyện Phước Sơn',
|
||||
'Huyện Quế Sơn',
|
||||
'Huyện Tây Giang',
|
||||
'Huyện Thăng Bình',
|
||||
'Huyện Tiên Phước',
|
||||
'Thành phố Hội An',
|
||||
'Thành phố Tam Kỳ',
|
||||
'Thị xã Điện Bàn'
|
||||
),
|
||||
'QUANG-NGAI' => array(
|
||||
'Huyện Ba Tơ',
|
||||
'Huyện Bình Sơn',
|
||||
'Huyện Đức Phổ',
|
||||
'Huyện Lý Sơn',
|
||||
'Huyện Minh Long',
|
||||
'Huyện Mộ Đức',
|
||||
'Huyện Nghĩa Hành',
|
||||
'Huyện Sơn Hà',
|
||||
'Huyện Sơn Tây',
|
||||
'Huyện Sơn Tịnh',
|
||||
'Huyện Tây Trà',
|
||||
'Huyện Trà Bồng',
|
||||
'Huyện Tư Nghĩa',
|
||||
'Thành phố Quảng Ngãi'
|
||||
),
|
||||
'QUANG-NINH' => array(
|
||||
'Huyện Ba Chẽ',
|
||||
'Huyện Bình Liêu',
|
||||
'Huyện Cô Tô',
|
||||
'Huyện Đầm Hà',
|
||||
'Huyện Hải Hà',
|
||||
'Huyện Hoành Bồ',
|
||||
'Huyện Tiên Yên',
|
||||
'Huyện Vân Đồn',
|
||||
'Thành phố Cẩm Phả',
|
||||
'Thành phố Hạ Long',
|
||||
'Thành phố Móng Cái',
|
||||
'Thành phố Uông Bí',
|
||||
'Thị xã Đông Triều',
|
||||
'Thị xã Quảng Yên'
|
||||
),
|
||||
'QUANG-TRI' => array(
|
||||
'Huyện Cam Lộ',
|
||||
'Huyện Cồn Cỏ',
|
||||
'Huyện Đa Krông',
|
||||
'Huyện Gio Linh',
|
||||
'Huyện Hải Lăng',
|
||||
'Huyện Hướng Hóa',
|
||||
'Huyện Triệu Phong',
|
||||
'Huyện Vĩnh Linh',
|
||||
'Thành phố Đông Hà',
|
||||
'Thị xã Quảng Trị'
|
||||
),
|
||||
'SOC-TRANG' => array(
|
||||
'Huyện Châu Thành',
|
||||
'Huyện Cù Lao Dung',
|
||||
'Huyện Kế Sách',
|
||||
'Huyện Long Phú',
|
||||
'Huyện Mỹ Tú',
|
||||
'Huyện Mỹ Xuyên',
|
||||
'Huyện Thạnh Trị',
|
||||
'Huyện Trần Đề',
|
||||
'Thành phố Sóc Trăng',
|
||||
'Thị xã Ngã Năm',
|
||||
'Thị xã Vĩnh Châu'
|
||||
),
|
||||
'SON-LA' => array(
|
||||
'Huyện Bắc Yên',
|
||||
'Huyện Mai Sơn',
|
||||
'Huyện Mộc Châu',
|
||||
'Huyện Mường La',
|
||||
'Huyện Phù Yên',
|
||||
'Huyện Quỳnh Nhai',
|
||||
'Huyện Sông Mã',
|
||||
'Huyện Sốp Cộp',
|
||||
'Huyện Thuận Châu',
|
||||
'Huyện Vân Hồ',
|
||||
'Huyện Yên Châu',
|
||||
'Thành phố Sơn La'
|
||||
),
|
||||
'TAY-NINH' => array(
|
||||
'Huyện Bến Cầu',
|
||||
'Huyện Châu Thành',
|
||||
'Huyện Dương Minh Châu',
|
||||
'Huyện Gò Dầu',
|
||||
'Huyện Hòa Thành',
|
||||
'Huyện Tân Biên',
|
||||
'Huyện Tân Châu',
|
||||
'Huyện Trảng Bàng',
|
||||
'Thành phố Tây Ninh'
|
||||
),
|
||||
'THAI-BINH' => array(
|
||||
'Huyện Đông Hưng',
|
||||
'Huyện Hưng Hà',
|
||||
'Huyện Kiến Xương',
|
||||
'Huyện Quỳnh Phụ',
|
||||
'Huyện Thái Thụy',
|
||||
'Huyện Tiền Hải',
|
||||
'Huyện Vũ Thư',
|
||||
'Thành phố Thái Bình'
|
||||
),
|
||||
'THAI-NGUYEN' => array(
|
||||
'Huyện Đại Từ',
|
||||
'Huyện Định Hóa',
|
||||
'Huyện Đồng Hỷ',
|
||||
'Huyện Phú Bình',
|
||||
'Huyện Phú Lương',
|
||||
'Huyện Võ Nhai',
|
||||
'Thành phố Sông Công',
|
||||
'Thành phố Thái Nguyên',
|
||||
'Thị xã Phổ Yên'
|
||||
),
|
||||
'THANH-HOA' => array(
|
||||
'Huyện Bá Thước',
|
||||
'Huyện Cẩm Thủy',
|
||||
'Huyện Đông Sơn',
|
||||
'Huyện Hà Trung',
|
||||
'Huyện Hậu Lộc',
|
||||
'Huyện Hoằng Hóa',
|
||||
'Huyện Lang Chánh',
|
||||
'Huyện Mường Lát',
|
||||
'Huyện Nga Sơn',
|
||||
'Huyện Ngọc Lặc',
|
||||
'Huyện Như Thanh',
|
||||
'Huyện Như Xuân',
|
||||
'Huyện Nông Cống',
|
||||
'Huyện Quan Hóa',
|
||||
'Huyện Quan Sơn',
|
||||
'Huyện Quảng Xương',
|
||||
'Huyện Thạch Thành',
|
||||
'Huyện Thiệu Hóa',
|
||||
'Huyện Thọ Xuân',
|
||||
'Huyện Thường Xuân',
|
||||
'Huyện Tĩnh Gia',
|
||||
'Huyện Triệu Sơn',
|
||||
'Huyện Vĩnh Lộc',
|
||||
'Huyện Yên Định',
|
||||
'Thành phố Thanh Hóa',
|
||||
'Thị xã Bỉm Sơn',
|
||||
'Thị xã Sầm Sơn'
|
||||
),
|
||||
'THUA-THIEN-HUE' => array(
|
||||
'Huyện A Lưới',
|
||||
'Huyện Nam Đông',
|
||||
'Huyện Phong Điền',
|
||||
'Huyện Phú Lộc',
|
||||
'Huyện Phú Vang',
|
||||
'Huyện Quảng Điền',
|
||||
'Thành phố Huế',
|
||||
'Thị xã Hương Thủy',
|
||||
'Thị xã Hương Trà'
|
||||
),
|
||||
'TIEN-GIANG' => array(
|
||||
'Huyện Cái Bè',
|
||||
'Huyện Cai Lậy',
|
||||
'Huyện Châu Thành',
|
||||
'Huyện Chợ Gạo',
|
||||
'Huyện Gò Công Đông',
|
||||
'Huyện Gò Công Tây',
|
||||
'Huyện Tân Phú Đông',
|
||||
'Huyện Tân Phước',
|
||||
'Thành phố Mỹ Tho',
|
||||
'Thị xã Cai Lậy',
|
||||
'Thị xã Gò Công'
|
||||
),
|
||||
'TRA-VINH' => array(
|
||||
'Huyện Càng Long',
|
||||
'Huyện Cầu Kè',
|
||||
'Huyện Cầu Ngang',
|
||||
'Huyện Châu Thành',
|
||||
'Huyện Duyên Hải',
|
||||
'Huyện Tiểu Cần',
|
||||
'Huyện Trà Cú',
|
||||
'Thành phố Trà Vinh',
|
||||
'Thị xã Duyên Hải'
|
||||
),
|
||||
'TUYEN-QUANG' => array(
|
||||
'Huyện Chiêm Hóa',
|
||||
'Huyện Hàm Yên',
|
||||
'Huyện Lâm Bình',
|
||||
'Huyện Nà Hang',
|
||||
'Huyện Sơn Dương',
|
||||
'Huyện Yên Sơn',
|
||||
'Thành phố Tuyên Quang'
|
||||
),
|
||||
'VINH-LONG' => array(
|
||||
'Huyện Vũng Liêm',
|
||||
'Huyện Bình Tân',
|
||||
'Huyện Long Hồ',
|
||||
'Huyện Mang Thít',
|
||||
'Huyện Tam Bình',
|
||||
'Huyện Trà Ôn',
|
||||
'Thành phố Vĩnh Long',
|
||||
'Thị xã Bình Minh'
|
||||
),
|
||||
'VINH-PHUC' => array(
|
||||
'Huyện Bình Xuyên',
|
||||
'Huyện Lập Thạch',
|
||||
'Huyện Sông Lô',
|
||||
'Huyện Tam Đảo',
|
||||
'Huyện Tam Dương',
|
||||
'Huyện Vĩnh Tường',
|
||||
'Huyện Yên Lạc',
|
||||
'Thành phố Vĩnh Yên',
|
||||
'Thị xã Phúc Yên'
|
||||
),
|
||||
'YEN-BAI' => array(
|
||||
'Huyện Lục Yên',
|
||||
'Huyện Mù Căng Chải',
|
||||
'Huyện Trạm Tấu',
|
||||
'Huyện Trấn Yên',
|
||||
'Huyện Văn Chấn',
|
||||
'Huyện Văn Yên',
|
||||
'Huyện Yên Bình',
|
||||
'Thành phố Yên Bái',
|
||||
'Thị xã Nghĩa Lộ'
|
||||
),
|
||||
);
|
||||
|
||||
return $cities;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,403 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* The class to handle the domestic OnePay gateway https://mtf.onepay.vn/developer/?page=modul_noidia
|
||||
*
|
||||
*
|
||||
* @author htdat
|
||||
* @since 1.3
|
||||
*
|
||||
*/
|
||||
class WooViet_OnePay_Domestic extends WC_Payment_Gateway {
|
||||
/**
|
||||
* Constructor for the gateway.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->id = strtolower( __CLASS__ );
|
||||
$this->has_fields = false;
|
||||
$this->order_button_text = __( 'Proceed to OnePay', 'woo-viet' );
|
||||
$this->method_title = __( 'OnePay Domestic Gateway (by Woo Viet)', 'woo-viet' );
|
||||
$this->method_description = __( 'OnePay supports all major bank ATMs in Vietnam.', 'woo-viet' );
|
||||
$this->supports = array(
|
||||
'products',
|
||||
);
|
||||
|
||||
// Load the settings.
|
||||
$this->init_form_fields();
|
||||
$this->init_settings();
|
||||
|
||||
// Define user set variables.
|
||||
$this->title = $this->get_option( 'title' );
|
||||
$this->description = $this->get_option( 'description' ) . sprintf( '<br/><div align="center"><img src="%s"></div>', WOO_VIET_URL . 'assets/onepay_domestic.png' );
|
||||
|
||||
$this->testmode = 'yes' === $this->get_option( 'testmode', 'no' );
|
||||
$this->merchant_id = $this->get_option( 'merchant_id' );
|
||||
$this->access_code = $this->get_option( 'access_code' );
|
||||
$this->secure_secret = $this->get_option( 'secure_secret' );
|
||||
$this->user = $this->get_option( 'user' );
|
||||
$this->password = $this->get_option( 'password' );
|
||||
|
||||
// Process the admin options
|
||||
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array(
|
||||
$this,
|
||||
'process_admin_options'
|
||||
) );
|
||||
|
||||
add_action( 'woocommerce_thankyou_' . $this->id, array( $this, 'handle_onepay_return_url' ) );
|
||||
|
||||
add_action( 'woocommerce_api_' . strtolower( __CLASS__ ), array( $this, 'handle_onepay_ipn' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise Gateway Settings Form Fields.
|
||||
*/
|
||||
public function init_form_fields() {
|
||||
$this->form_fields = include( 'onepay/domestic-settings.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the IPN URL for OnePay
|
||||
* Format: http://my-site.com/wc-api/WooViet_OnePay_Domestic/
|
||||
*/
|
||||
static function get_onepay_ipn_url() {
|
||||
return WC()->api_request_url( __CLASS__ );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the payment
|
||||
*
|
||||
* @param int $order_id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function process_payment( $order_id ) {
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
return array(
|
||||
'result' => 'success',
|
||||
'redirect' => $this->get_pay_url( $order )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the OnePay pay URL for an order
|
||||
* AND set the queryDR cron for this transaction
|
||||
*
|
||||
* @param WC_Order $order
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_pay_url( $order ) {
|
||||
$args = array(
|
||||
'Title' => __( 'OnePay Payment Title', 'woo-viet' ),
|
||||
'vpc_Merchant' => $this->merchant_id,
|
||||
'vpc_AccessCode' => $this->access_code,
|
||||
'vpc_MerchTxnRef' => sprintf( '%1$s_%2$s', $order->id, date( 'YmdHis' ) ),
|
||||
'vpc_OrderInfo' => substr(
|
||||
sprintf( 'Order #%1$s - %2$s', $order->id, get_home_url() ),
|
||||
0,
|
||||
32 ), // Limit 32 characters
|
||||
'vpc_Amount' => $order->get_total() * 100, // Multiplying 100 is a requirement from OnePay
|
||||
'vpc_ReturnURL' => $this->get_return_url( $order ),
|
||||
'vpc_Version' => '2',
|
||||
'vpc_Command' => 'pay',
|
||||
'vpc_Locale' => ( 'vi' == get_locale() ) ? 'vn' : 'en',
|
||||
'vpc_Currency' => 'VND',
|
||||
'vpc_TicketNo' => $_SERVER['REMOTE_ADDR'],
|
||||
);
|
||||
|
||||
// Set the queryDR cron for this transaction
|
||||
$this->set_onepay_querydr_cron( $args['vpc_MerchTxnRef'] );
|
||||
|
||||
// Get the secure hash
|
||||
$vpc_SecureHash = $this->create_vpc_SecureHash( $args );
|
||||
|
||||
// Add the secure hash to the args
|
||||
$args['vpc_SecureHash'] = $vpc_SecureHash;
|
||||
$http_args = http_build_query( $args, '', '&' );
|
||||
|
||||
if ( $this->testmode ) {
|
||||
return 'https://mtf.onepay.vn/onecomm-pay/vpc.op?' . $http_args;
|
||||
} else {
|
||||
return 'https://onepay.vn/onecomm-pay/vpc.op?' . $http_args;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cron job running queryDR in 20 mintues
|
||||
* Because the OnePay payment timeout is 15 minutes
|
||||
*
|
||||
* @param string $vpc_MerchTxnRef
|
||||
*/
|
||||
public function set_onepay_querydr_cron( $vpc_MerchTxnRef ) {
|
||||
|
||||
wp_schedule_single_event(
|
||||
time() + 20 * 60,
|
||||
'wooviet_handle_onepay_querydr',
|
||||
array( $vpc_MerchTxnRef )
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the vpc_SecureHash value.
|
||||
* @see https://mtf.onepay.vn/developer/?page=modul_noidia_php
|
||||
*
|
||||
* @param array $args
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function create_vpc_SecureHash( $args ) {
|
||||
$stringHashData = "";
|
||||
|
||||
// arrange array data a-z before make a hash
|
||||
ksort( $args );
|
||||
|
||||
foreach ( $args as $key => $value ) {
|
||||
|
||||
if ( strlen( $value ) > 0 ) {
|
||||
if ( ( strlen( $value ) > 0 ) && ( ( substr( $key, 0, 4 ) == "vpc_" ) || ( substr( $key, 0, 5 ) == "user_" ) ) ) {
|
||||
$stringHashData .= $key . "=" . $value . "&";
|
||||
}
|
||||
}
|
||||
}
|
||||
//Remove the last character "&"
|
||||
$stringHashData = rtrim( $stringHashData, "&" );
|
||||
|
||||
return strtoupper( hash_hmac( 'SHA256', $stringHashData, pack( 'H*', $this->secure_secret ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the return URL - GET request from OnePay
|
||||
*/
|
||||
public function handle_onepay_return_url() {
|
||||
|
||||
if ( isset( $_GET['vpc_SecureHash'] ) ) {
|
||||
|
||||
$this->process_onepay_response_data( $_GET, 'return' );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the repsonse data from OnePay
|
||||
*
|
||||
* @param string $args the response data from OnePay
|
||||
* @param string $type
|
||||
*/
|
||||
public function process_onepay_response_data( $args, $type ) {
|
||||
$types_accepted = array(
|
||||
'return',
|
||||
'ipn',
|
||||
'querydr',
|
||||
);
|
||||
|
||||
// Do nothing if the type is wrong
|
||||
if ( ! in_array( $type, $types_accepted ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$is_secure = false;
|
||||
$is_querydr_exists = false;
|
||||
|
||||
if ( 'return' == $type OR 'ipn' == $type ) {
|
||||
$vpc_SecureHash = $args['vpc_SecureHash'];
|
||||
|
||||
// Remove the parameter "vpc_SecureHash" for validating SecureHash
|
||||
unset( $args['vpc_SecureHash'] );
|
||||
|
||||
$is_secure = $this->check_vpc_SecureHash( $args, $vpc_SecureHash );
|
||||
|
||||
} elseif ( 'querydr' == $type ) {
|
||||
$is_querydr_exists = ( 'Y' == $args['vpc_DRExists'] );
|
||||
|
||||
}
|
||||
|
||||
// Process the data
|
||||
if ( $is_secure OR $is_querydr_exists ) {
|
||||
/**
|
||||
* $vpc_MerchTxnRef looks like this "139_20170418101843" or {order_id}_{date_time}
|
||||
* @see $this->get_pay_url();
|
||||
*/
|
||||
$vpc_MerchTxnRef = $args['vpc_MerchTxnRef'];
|
||||
$vpc_TxnResponseCode = $args['vpc_TxnResponseCode'];
|
||||
|
||||
// Get the order_id part only
|
||||
$order_id = substr( $vpc_MerchTxnRef, 0, strrpos( $vpc_MerchTxnRef, '_' ) );
|
||||
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
// Add the order note for the reference
|
||||
$order_note = sprintf(
|
||||
__( 'OnePay Domestic Gateway Info | Code: %1$s | Message: %2$s | MerchantTxnRef: %3$s | Type: %4$s', 'woo-viet' ),
|
||||
$vpc_TxnResponseCode,
|
||||
$this->OnePay_getResponseDescription( $vpc_TxnResponseCode ),
|
||||
$vpc_MerchTxnRef,
|
||||
$type
|
||||
);
|
||||
$order->add_order_note( $order_note );
|
||||
|
||||
// If the payment is successful, update the order
|
||||
if ( "0" == $vpc_TxnResponseCode ) {
|
||||
$order->payment_complete();
|
||||
}
|
||||
|
||||
switch ( $type ) {
|
||||
|
||||
case 'return':
|
||||
wp_redirect( $this->get_return_url( $order ) );
|
||||
break;
|
||||
|
||||
case 'ipn':
|
||||
exit( 'responsecode=1&desc=confirm-success' );
|
||||
break;
|
||||
|
||||
case 'querydr':
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( 'ipn' == $type ) {
|
||||
exit( 'responsecode=0&desc=confirm-success' );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not the arguments and a provided $vpc_SecureHash are the same
|
||||
*
|
||||
* @see https://mtf.onepay.vn/developer/?page=modul_noidia_php
|
||||
*
|
||||
* @param $args
|
||||
* @param $vpc_SecureHash
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function check_vpc_SecureHash( $args, $vpc_SecureHash ) {
|
||||
// Generate the "vpc_SecureHash" value from $args
|
||||
$vpc_SecureHash_from_args = $this->create_vpc_SecureHash( $args );
|
||||
|
||||
if ( $vpc_SecureHash_from_args == $vpc_SecureHash ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the response description based on the response code
|
||||
* This is code is from OnePay
|
||||
*
|
||||
* @param string $responseCode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function OnePay_getResponseDescription( $responseCode ) {
|
||||
|
||||
switch ( $responseCode ) {
|
||||
case "0" :
|
||||
$result = "Giao dịch thành công - Approved";
|
||||
break;
|
||||
case "1" :
|
||||
$result = "Ngân hàng từ chối giao dịch - Bank Declined";
|
||||
break;
|
||||
case "3" :
|
||||
$result = "Mã đơn vị không tồn tại - Merchant not exist";
|
||||
break;
|
||||
case "4" :
|
||||
$result = "Không đúng access code - Invalid access code";
|
||||
break;
|
||||
case "5" :
|
||||
$result = "Số tiền không hợp lệ - Invalid amount";
|
||||
break;
|
||||
case "6" :
|
||||
$result = "Mã tiền tệ không tồn tại - Invalid currency code";
|
||||
break;
|
||||
case "7" :
|
||||
$result = "Lỗi không xác định - Unspecified Failure ";
|
||||
break;
|
||||
case "8" :
|
||||
$result = "Số thẻ không đúng - Invalid card Number";
|
||||
break;
|
||||
case "9" :
|
||||
$result = "Tên chủ thẻ không đúng - Invalid card name";
|
||||
break;
|
||||
case "10" :
|
||||
$result = "Thẻ hết hạn/Thẻ bị khóa - Expired Card";
|
||||
break;
|
||||
case "11" :
|
||||
$result = "Thẻ chưa đăng ký sử dụng dịch vụ - Card Not Registed Service(internet banking)";
|
||||
break;
|
||||
case "12" :
|
||||
$result = "Ngày phát hành/Hết hạn không đúng - Invalid card date";
|
||||
break;
|
||||
case "13" :
|
||||
$result = "Vượt quá hạn mức thanh toán - Exist Amount";
|
||||
break;
|
||||
case "21" :
|
||||
$result = "Số tiền không đủ để thanh toán - Insufficient fund";
|
||||
break;
|
||||
case "99" :
|
||||
$result = "Người sủ dụng hủy giao dịch - User cancel";
|
||||
break;
|
||||
default :
|
||||
$result = "Giao dịch thất bại - Failured";
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the IPN POST request from OnePay
|
||||
*/
|
||||
public function handle_onepay_ipn() {
|
||||
|
||||
if ( isset( $_REQUEST['vpc_SecureHash'] ) ) {
|
||||
|
||||
$this->process_onepay_response_data( $_REQUEST, 'ipn' );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the queryDR request
|
||||
*
|
||||
* @param string $vpc_MerchTxnRef
|
||||
*/
|
||||
public function handle_onepay_querydr( $vpc_MerchTxnRef ) {
|
||||
// Build the queryDR link
|
||||
$args = array(
|
||||
'vpc_Command' => 'queryDR',
|
||||
'vpc_Version' => '1',
|
||||
'vpc_MerchTxnRef' => $vpc_MerchTxnRef,
|
||||
'vpc_Merchant' => $this->merchant_id,
|
||||
'vpc_AccessCode' => $this->access_code,
|
||||
'vpc_User' => $this->user,
|
||||
'vpc_Password' => $this->password,
|
||||
);
|
||||
|
||||
$http_args = http_build_query( $args, '', '&' );
|
||||
|
||||
if ( $this->testmode ) {
|
||||
$http_link = 'https://mtf.onepay.vn/onecomm-pay/Vpcdps.op?' . $http_args;
|
||||
} else {
|
||||
$http_link = 'https://onepay.vn/onecomm-pay/Vpcdps.op?' . $http_args;
|
||||
}
|
||||
|
||||
// Connect to OnePay to get the queryDR info
|
||||
$http_response = wp_remote_get( $http_link );
|
||||
parse_str( wp_remote_retrieve_body( $http_response ), $args_response );
|
||||
|
||||
// Process the data
|
||||
$this->process_onepay_response_data( $args_response, 'querydr' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,10 +46,10 @@ class WooViet_Provinces {
|
||||
* @return array
|
||||
*/
|
||||
public function edit_vn_locale( $array ) {
|
||||
$array['VN']['state']['label'] = __( 'Province', 'woocommerce' );
|
||||
$array['VN']['state']['label'] = __( 'Province', 'woo-viet' );
|
||||
$array['VN']['state']['required'] = true;
|
||||
|
||||
$array['VN']['city']['label'] = __( 'District', 'woocommerce' );
|
||||
$array['VN']['city']['label'] = __( 'District', 'woo-viet' );
|
||||
$array['VN']['postcode']['hidden'] = true;
|
||||
|
||||
return $array;
|
||||
@@ -68,69 +68,69 @@ class WooViet_Provinces {
|
||||
* @source: https://vi.wikipedia.org/wiki/Tỉnh_thành_Việt_Nam and https://en.wikipedia.org/wiki/Provinces_of_Vietnam
|
||||
*/
|
||||
$states['VN'] = array(
|
||||
'AN-GIANG' => __( 'An Giang', 'woocommerce-for-vietnam' ),
|
||||
'BA-RIA-VUNG-TAU' => __( 'Ba Ria - Vung Tau', 'woocommerce-for-vietnam' ),
|
||||
'BAC-LIEU' => __( 'Bac Lieu', 'woocommerce-for-vietnam' ),
|
||||
'BAC-KAN' => __( 'Bac Kan', 'woocommerce-for-vietnam' ),
|
||||
'BAC-GIANG' => __( 'Bac Giang', 'woocommerce-for-vietnam' ),
|
||||
'BAC-NINH' => __( 'Bac Ninh', 'woocommerce-for-vietnam' ),
|
||||
'BEN-TRE' => __( 'Ben Tre', 'woocommerce-for-vietnam' ),
|
||||
'BINH-DUONG' => __( 'Binh Duong', 'woocommerce-for-vietnam' ),
|
||||
'BINH-DINH' => __( 'Binh Dinh', 'woocommerce-for-vietnam' ),
|
||||
'BINH-PHUOC' => __( 'Binh Phuoc', 'woocommerce-for-vietnam' ),
|
||||
'BINH-THUAN' => __( 'Binh Thuan', 'woocommerce-for-vietnam' ),
|
||||
'CA-MAU' => __( 'Ca Mau', 'woocommerce-for-vietnam' ),
|
||||
'CAO-BANG' => __( 'Cao Bang', 'woocommerce-for-vietnam' ),
|
||||
'CAN-THO' => __( 'Can Tho', 'woocommerce-for-vietnam' ),
|
||||
'DA-NANG' => __( 'Da Nang', 'woocommerce-for-vietnam' ),
|
||||
'DAK-LAK' => __( 'Dak Lak', 'woocommerce-for-vietnam' ),
|
||||
'DAK-NONG' => __( 'Dak Nong', 'woocommerce-for-vietnam' ),
|
||||
'DONG-NAI' => __( 'Dong Nai', 'woocommerce-for-vietnam' ),
|
||||
'DONG-THAP' => __( 'Dong Thap', 'woocommerce-for-vietnam' ),
|
||||
'DIEN-BIEN' => __( 'Dien Bien', 'woocommerce-for-vietnam' ),
|
||||
'GIA-LAI' => __( 'Gia Lai', 'woocommerce-for-vietnam' ),
|
||||
'HA-GIANG' => __( 'Ha Giang', 'woocommerce-for-vietnam' ),
|
||||
'HA-NAM' => __( 'Ha Nam', 'woocommerce-for-vietnam' ),
|
||||
'HA-NOI' => __( 'Ha Noi', 'woocommerce-for-vietnam' ),
|
||||
'HA-TINH' => __( 'Ha Tinh', 'woocommerce-for-vietnam' ),
|
||||
'HAI-DUONG' => __( 'Hai Duong', 'woocommerce-for-vietnam' ),
|
||||
'HAI-PHONG' => __( 'Hai Phong', 'woocommerce-for-vietnam' ),
|
||||
'HOA-BINH' => __( 'Hoa Binh', 'woocommerce-for-vietnam' ),
|
||||
'HAU-GIANG' => __( 'Hau Giang', 'woocommerce-for-vietnam' ),
|
||||
'HUNG-YEN' => __( 'Hung Yen', 'woocommerce-for-vietnam' ),
|
||||
'HO-CHI-MINH' => __( 'Ho Chi Minh', 'woocommerce-for-vietnam' ),
|
||||
'KHANH-HOA' => __( 'Khanh Hoa', 'woocommerce-for-vietnam' ),
|
||||
'KIEN-GIANG' => __( 'Kien Giang', 'woocommerce-for-vietnam' ),
|
||||
'KON-TUM' => __( 'Kon Tum', 'woocommerce-for-vietnam' ),
|
||||
'LAI-CHAU' => __( 'Lai Chau', 'woocommerce-for-vietnam' ),
|
||||
'LAO-CAI' => __( 'Lao Cai', 'woocommerce-for-vietnam' ),
|
||||
'LANG-SON' => __( 'Lang Son', 'woocommerce-for-vietnam' ),
|
||||
'LAM-DONG' => __( 'Lam Dong', 'woocommerce-for-vietnam' ),
|
||||
'LONG-AN' => __( 'Long An', 'woocommerce-for-vietnam' ),
|
||||
'NAM-DINH' => __( 'Nam Dinh', 'woocommerce-for-vietnam' ),
|
||||
'NGHE-AN' => __( 'Nghe An', 'woocommerce-for-vietnam' ),
|
||||
'NINH-BINH' => __( 'Ninh Binh', 'woocommerce-for-vietnam' ),
|
||||
'NINH-THUAN' => __( 'Ninh Thuan', 'woocommerce-for-vietnam' ),
|
||||
'PHU-THO' => __( 'Phu Tho', 'woocommerce-for-vietnam' ),
|
||||
'PHU-YEN' => __( 'Phu Yen', 'woocommerce-for-vietnam' ),
|
||||
'QUANG-BINH' => __( 'Quang Binh', 'woocommerce-for-vietnam' ),
|
||||
'QUANG-NAM' => __( 'Quang Nam', 'woocommerce-for-vietnam' ),
|
||||
'QUANG-NGAI' => __( 'Quang Ngai', 'woocommerce-for-vietnam' ),
|
||||
'QUANG-NINH' => __( 'Quang Ninh', 'woocommerce-for-vietnam' ),
|
||||
'QUANG-TRI' => __( 'Quang Tri', 'woocommerce-for-vietnam' ),
|
||||
'SOC-TRANG' => __( 'Soc Trang', 'woocommerce-for-vietnam' ),
|
||||
'SON-LA' => __( 'Son La', 'woocommerce-for-vietnam' ),
|
||||
'TAY-NINH' => __( 'Tay Ninh', 'woocommerce-for-vietnam' ),
|
||||
'THAI-BINH' => __( 'Thai Binh', 'woocommerce-for-vietnam' ),
|
||||
'THAI-NGUYEN' => __( 'Thai Nguyen', 'woocommerce-for-vietnam' ),
|
||||
'THANH-HOA' => __( 'Thanh Hoa', 'woocommerce-for-vietnam' ),
|
||||
'THUA-THIEN-HUE' => __( 'Thua Thien - Hue', 'woocommerce-for-vietnam' ),
|
||||
'TIEN-GIANG' => __( 'Tien Giang', 'woocommerce-for-vietnam' ),
|
||||
'TRA-VINH' => __( 'Tra Vinh', 'woocommerce-for-vietnam' ),
|
||||
'TUYEN-QUANG' => __( 'Tuyen Quang', 'woocommerce-for-vietnam' ),
|
||||
'VINH-LONG' => __( 'Vinh Long', 'woocommerce-for-vietnam' ),
|
||||
'VINH-PHUC' => __( 'Vinh Phuc', 'woocommerce-for-vietnam' ),
|
||||
'YEN-BAI' => __( 'Yen Bai', 'woocommerce-for-vietnam' ),
|
||||
'AN-GIANG' => __( 'An Giang', 'woo-viet' ),
|
||||
'BA-RIA-VUNG-TAU' => __( 'Ba Ria - Vung Tau', 'woo-viet' ),
|
||||
'BAC-LIEU' => __( 'Bac Lieu', 'woo-viet' ),
|
||||
'BAC-KAN' => __( 'Bac Kan', 'woo-viet' ),
|
||||
'BAC-GIANG' => __( 'Bac Giang', 'woo-viet' ),
|
||||
'BAC-NINH' => __( 'Bac Ninh', 'woo-viet' ),
|
||||
'BEN-TRE' => __( 'Ben Tre', 'woo-viet' ),
|
||||
'BINH-DUONG' => __( 'Binh Duong', 'woo-viet' ),
|
||||
'BINH-DINH' => __( 'Binh Dinh', 'woo-viet' ),
|
||||
'BINH-PHUOC' => __( 'Binh Phuoc', 'woo-viet' ),
|
||||
'BINH-THUAN' => __( 'Binh Thuan', 'woo-viet' ),
|
||||
'CA-MAU' => __( 'Ca Mau', 'woo-viet' ),
|
||||
'CAO-BANG' => __( 'Cao Bang', 'woo-viet' ),
|
||||
'CAN-THO' => __( 'Can Tho', 'woo-viet' ),
|
||||
'DA-NANG' => __( 'Da Nang', 'woo-viet' ),
|
||||
'DAK-LAK' => __( 'Dak Lak', 'woo-viet' ),
|
||||
'DAK-NONG' => __( 'Dak Nong', 'woo-viet' ),
|
||||
'DONG-NAI' => __( 'Dong Nai', 'woo-viet' ),
|
||||
'DONG-THAP' => __( 'Dong Thap', 'woo-viet' ),
|
||||
'DIEN-BIEN' => __( 'Dien Bien', 'woo-viet' ),
|
||||
'GIA-LAI' => __( 'Gia Lai', 'woo-viet' ),
|
||||
'HA-GIANG' => __( 'Ha Giang', 'woo-viet' ),
|
||||
'HA-NAM' => __( 'Ha Nam', 'woo-viet' ),
|
||||
'HA-NOI' => __( 'Ha Noi', 'woo-viet' ),
|
||||
'HA-TINH' => __( 'Ha Tinh', 'woo-viet' ),
|
||||
'HAI-DUONG' => __( 'Hai Duong', 'woo-viet' ),
|
||||
'HAI-PHONG' => __( 'Hai Phong', 'woo-viet' ),
|
||||
'HOA-BINH' => __( 'Hoa Binh', 'woo-viet' ),
|
||||
'HAU-GIANG' => __( 'Hau Giang', 'woo-viet' ),
|
||||
'HUNG-YEN' => __( 'Hung Yen', 'woo-viet' ),
|
||||
'HO-CHI-MINH' => __( 'Ho Chi Minh', 'woo-viet' ),
|
||||
'KHANH-HOA' => __( 'Khanh Hoa', 'woo-viet' ),
|
||||
'KIEN-GIANG' => __( 'Kien Giang', 'woo-viet' ),
|
||||
'KON-TUM' => __( 'Kon Tum', 'woo-viet' ),
|
||||
'LAI-CHAU' => __( 'Lai Chau', 'woo-viet' ),
|
||||
'LAO-CAI' => __( 'Lao Cai', 'woo-viet' ),
|
||||
'LANG-SON' => __( 'Lang Son', 'woo-viet' ),
|
||||
'LAM-DONG' => __( 'Lam Dong', 'woo-viet' ),
|
||||
'LONG-AN' => __( 'Long An', 'woo-viet' ),
|
||||
'NAM-DINH' => __( 'Nam Dinh', 'woo-viet' ),
|
||||
'NGHE-AN' => __( 'Nghe An', 'woo-viet' ),
|
||||
'NINH-BINH' => __( 'Ninh Binh', 'woo-viet' ),
|
||||
'NINH-THUAN' => __( 'Ninh Thuan', 'woo-viet' ),
|
||||
'PHU-THO' => __( 'Phu Tho', 'woo-viet' ),
|
||||
'PHU-YEN' => __( 'Phu Yen', 'woo-viet' ),
|
||||
'QUANG-BINH' => __( 'Quang Binh', 'woo-viet' ),
|
||||
'QUANG-NAM' => __( 'Quang Nam', 'woo-viet' ),
|
||||
'QUANG-NGAI' => __( 'Quang Ngai', 'woo-viet' ),
|
||||
'QUANG-NINH' => __( 'Quang Ninh', 'woo-viet' ),
|
||||
'QUANG-TRI' => __( 'Quang Tri', 'woo-viet' ),
|
||||
'SOC-TRANG' => __( 'Soc Trang', 'woo-viet' ),
|
||||
'SON-LA' => __( 'Son La', 'woo-viet' ),
|
||||
'TAY-NINH' => __( 'Tay Ninh', 'woo-viet' ),
|
||||
'THAI-BINH' => __( 'Thai Binh', 'woo-viet' ),
|
||||
'THAI-NGUYEN' => __( 'Thai Nguyen', 'woo-viet' ),
|
||||
'THANH-HOA' => __( 'Thanh Hoa', 'woo-viet' ),
|
||||
'THUA-THIEN-HUE' => __( 'Thua Thien - Hue', 'woo-viet' ),
|
||||
'TIEN-GIANG' => __( 'Tien Giang', 'woo-viet' ),
|
||||
'TRA-VINH' => __( 'Tra Vinh', 'woo-viet' ),
|
||||
'TUYEN-QUANG' => __( 'Tuyen Quang', 'woo-viet' ),
|
||||
'VINH-LONG' => __( 'Vinh Long', 'woo-viet' ),
|
||||
'VINH-PHUC' => __( 'Vinh Phuc', 'woo-viet' ),
|
||||
'YEN-BAI' => __( 'Yen Bai', 'woo-viet' ),
|
||||
);
|
||||
|
||||
return $states;
|
||||
|
||||
@@ -97,7 +97,7 @@ class WooViet_VND_PayPal_Standard {
|
||||
|
||||
$value['description'] .= '<br />';
|
||||
$value['description'] .=
|
||||
sprintf( __( 'The prices will be converted to %1$s in the PayPal pages with the exchange rate %2$s.', 'woocommerce-for-vietnam' ),
|
||||
sprintf( __( 'The prices will be converted to %1$s in the PayPal pages with the exchange rate %2$s.', 'woo-viet' ),
|
||||
"<span style='color:red'> $this->paypal_currency</span>",
|
||||
"<span style='color:red'> $this->paypal_currency / VND = $this->exchange_rate_to_vnd</span>"
|
||||
);
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings for 1Pay Gateway.
|
||||
* @since 1.3
|
||||
*/
|
||||
return array(
|
||||
'enabled' => array(
|
||||
'title' => __( 'Enable/Disable', 'woo-viet' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'OnePay Domestic Gateway (by Woo Viet)', 'woo-viet' ),
|
||||
'default' => 'no'
|
||||
),
|
||||
'testmode' => array(
|
||||
'title' => __( 'OnePay Sandbox', 'woocommerce' ),
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable OnePay sandbox (testing)', 'woocommerce' ),
|
||||
'default' => 'no',
|
||||
'description' => sprintf( __( 'OnePay sandbox can be used to test payments. See <a href="%s">the testing info</a>.', 'woocommerce' ), 'https://mtf.onepay.vn/developer/?page=modul_noidia' ),
|
||||
//@todo: add the logo https://mtf.onepay.vn/developer/?page=logo
|
||||
),
|
||||
'title' => array(
|
||||
'title' => __( 'Title', 'woo-viet' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'This controls the title which the user sees during checkout.', 'woo-viet' ),
|
||||
'default' => __( 'OnePay Domestic Gateway', 'woo-viet' ),
|
||||
'desc_tip' => true,
|
||||
),
|
||||
'description' => array(
|
||||
'title' => __( 'Description', 'woo-viet' ),
|
||||
'type' => 'textarea',
|
||||
'desc_tip' => true,
|
||||
'description' => __( 'This controls the description which the user sees during checkout.', 'woo-viet' ),
|
||||
'default' => __( 'With OnePay, you can make payment by using any local Vietnam ATM card.', 'woo-viet' )
|
||||
),
|
||||
'api_details' => array(
|
||||
'title' => __( 'API Credentials', 'woo-viet' ),
|
||||
'type' => 'title',
|
||||
'description' => sprintf( __( 'Enter your OnePay API credentials. Contact OnePay to have your credentials %shere%s.', 'woo-viet' ), '<a href="http://onepay.com.vn/home/en/contact-us.html">', '</a>' ),
|
||||
),
|
||||
'merchant_id' => array(
|
||||
'title' => __( 'Merchant ID', 'woo-viet' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'Get your Merchant ID from OnePay.', 'woo-viet' ),
|
||||
'default' => '',
|
||||
'desc_tip' => true,
|
||||
'placeholder' => __( 'Required. Provided by OnePay.', 'woo-viet' )
|
||||
),
|
||||
'access_code' => array(
|
||||
'title' => __( 'Access Code', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'Get your Access Code from OnePay.', 'woo-viet' ),
|
||||
'default' => '',
|
||||
'desc_tip' => true,
|
||||
'placeholder' => __( 'Required. Provided by OnePay.', 'woo-viet' )
|
||||
),
|
||||
'secure_secret' => array(
|
||||
'title' => __( 'Secure Secret', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'Get your Secure Secret from OnePay.', 'woo-viet' ),
|
||||
'default' => '',
|
||||
'desc_tip' => true,
|
||||
'placeholder' => __( 'Required. Provided by OnePay.', 'woo-viet' )
|
||||
),
|
||||
'user' => array(
|
||||
'title' => __( 'User for queryDR. Test value: op01', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'Get your user info from OnePay.', 'woo-viet' ),
|
||||
'default' => '',
|
||||
'desc_tip' => true,
|
||||
'placeholder' => __( 'Required. Provided by OnePay', 'woo-viet' )
|
||||
),
|
||||
'password' => array(
|
||||
'title' => __( 'Password for queryDR. Test value: op123456', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'description' => __( 'Get your password info from OnePay.', 'woo-viet' ),
|
||||
'default' => '',
|
||||
'desc_tip' => true,
|
||||
'placeholder' => __( 'Required. Provided by OnePay.', 'woo-viet' )
|
||||
),
|
||||
'more_info' => array(
|
||||
'title' => __( 'Instant Payment Notification (IPN)', 'woo-viet' ),
|
||||
'type' => 'title',
|
||||
'description' =>
|
||||
sprintf( 'URL: <code>%s</code>', WooViet_OnePay_Domestic::get_onepay_ipn_url() ) . '<p/>' .
|
||||
sprintf( __( '%sContact OnePay%s to configure this URL on its site. <strong>This is required based on its guidelines.</strong>', 'woo-viet' ), '<a href="http://onepay.com.vn/home/en/contact-us.html">', '</a>' ),
|
||||
),
|
||||
|
||||
);
|
||||
@@ -1,349 +0,0 @@
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-01-01 12:58+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: \n"
|
||||
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Loco https://localise.biz/"
|
||||
|
||||
#: woocommerce-for-vietnam.php:87
|
||||
msgid ""
|
||||
"WooCommerce for Vietnam is not running because WooCommerce is not active. "
|
||||
"Please activate both plugins"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-admin-page.php:43
|
||||
msgid "Settings saved"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-admin-page.php:50
|
||||
msgid "Can not save settings! Please refresh this page."
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-admin-page.php:92
|
||||
msgid "Add provinces for Vietnam"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-admin-page.php:98 inc/class-wooviet-admin-page.php:110
|
||||
#: inc/class-wooviet-admin-page.php:127 inc/class-wooviet-admin-page.php:146
|
||||
msgid "Enabled"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-admin-page.php:103
|
||||
msgid "Change VND currency symbol"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-admin-page.php:116
|
||||
msgid "Insert a text to change the default symbol <code>đ</code>"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-admin-page.php:120
|
||||
msgid "Convert <code>000</code> of prices to K (or anything)"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-admin-page.php:133
|
||||
msgid "Choose what you want to change. E.g:"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-admin-page.php:139
|
||||
#, php-format
|
||||
msgid "Support VND for <a href=\"%s\">the PayPal Standard gateway</a>"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-admin-page.php:191
|
||||
msgid ""
|
||||
"Select a PayPal supported currency (like USD, EUR, etc), which is used to "
|
||||
"convert VND prices"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-admin-page.php:198
|
||||
msgid "Insert the exchange rate of this currency to VND"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:71
|
||||
msgid "An Giang"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:72
|
||||
msgid "Ba Ria - Vung Tau"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:73
|
||||
msgid "Bac Lieu"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:74
|
||||
msgid "Bac Kan"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:75
|
||||
msgid "Bac Giang"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:76
|
||||
msgid "Bac Ninh"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:77
|
||||
msgid "Ben Tre"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:78
|
||||
msgid "Binh Duong"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:79
|
||||
msgid "Binh Dinh"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:80
|
||||
msgid "Binh Phuoc"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:81
|
||||
msgid "Binh Thuan"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:82
|
||||
msgid "Ca Mau"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:83
|
||||
msgid "Cao Bang"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:84
|
||||
msgid "Can Tho"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:85
|
||||
msgid "Da Nang"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:86
|
||||
msgid "Dak Lak"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:87
|
||||
msgid "Dak Nong"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:88
|
||||
msgid "Dong Nai"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:89
|
||||
msgid "Dong Thap"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:90
|
||||
msgid "Dien Bien"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:91
|
||||
msgid "Gia Lai"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:92
|
||||
msgid "Ha Giang"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:93
|
||||
msgid "Ha Nam"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:94
|
||||
msgid "Ha Noi"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:95
|
||||
msgid "Ha Tinh"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:96
|
||||
msgid "Hai Duong"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:97
|
||||
msgid "Hai Phong"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:98
|
||||
msgid "Hoa Binh"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:99
|
||||
msgid "Hau Giang"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:100
|
||||
msgid "Hung Yen"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:101
|
||||
msgid "Ho Chi Minh"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:102
|
||||
msgid "Khanh Hoa"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:103
|
||||
msgid "Kien Giang"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:104
|
||||
msgid "Kon Tum"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:105
|
||||
msgid "Lai Chau"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:106
|
||||
msgid "Lao Cai"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:107
|
||||
msgid "Lang Son"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:108
|
||||
msgid "Lam Dong"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:109
|
||||
msgid "Long An"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:110
|
||||
msgid "Nam Dinh"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:111
|
||||
msgid "Nghe An"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:112
|
||||
msgid "Ninh Binh"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:113
|
||||
msgid "Ninh Thuan"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:114
|
||||
msgid "Phu Tho"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:115
|
||||
msgid "Phu Yen"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:116
|
||||
msgid "Quang Binh"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:117
|
||||
msgid "Quang Nam"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:118
|
||||
msgid "Quang Ngai"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:119
|
||||
msgid "Quang Ninh"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:120
|
||||
msgid "Quang Tri"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:121
|
||||
msgid "Soc Trang"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:122
|
||||
msgid "Son La"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:123
|
||||
msgid "Tay Ninh"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:124
|
||||
msgid "Thai Binh"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:125
|
||||
msgid "Thai Nguyen"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:126
|
||||
msgid "Thanh Hoa"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:127
|
||||
msgid "Thua Thien - Hue"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:128
|
||||
msgid "Tien Giang"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:129
|
||||
msgid "Tra Vinh"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:130
|
||||
msgid "Tuyen Quang"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:131
|
||||
msgid "Vinh Long"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:132
|
||||
msgid "Vinh Phuc"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-provinces.php:133
|
||||
msgid "Yen Bai"
|
||||
msgstr ""
|
||||
|
||||
#: inc/class-wooviet-vnd-paypal-standard.php:100
|
||||
#, php-format
|
||||
msgid ""
|
||||
"The prices will be converted to %1$s in the PayPal pages with the exchange "
|
||||
"rate %2$s."
|
||||
msgstr ""
|
||||
|
||||
#. Name of the plugin
|
||||
msgid "WooCommerce for Vietnam"
|
||||
msgstr ""
|
||||
|
||||
#. Description of the plugin
|
||||
msgid ""
|
||||
"This plugin provides features and integrations specifically for Vietnam."
|
||||
msgstr ""
|
||||
|
||||
#. URI of the plugin
|
||||
msgid "https://github.com/htdat/woocommerce-for-vietnam"
|
||||
msgstr ""
|
||||
|
||||
#. Author of the plugin
|
||||
msgid "htdat"
|
||||
msgstr ""
|
||||
|
||||
#. Author URI of the plugin
|
||||
msgid "https://profiles.wordpress.org/htdat"
|
||||
msgstr ""
|
||||
@@ -0,0 +1,180 @@
|
||||
jQuery( function($) {
|
||||
|
||||
// wc_city_select_params is required to continue, ensure the object exists
|
||||
// wc_country_select_params is used for select2 texts. This one is added by WC
|
||||
if ( typeof wc_country_select_params === 'undefined' || typeof wc_city_select_params === 'undefined' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getEnhancedSelectFormatString() {
|
||||
var formatString = {
|
||||
formatMatches: function( matches ) {
|
||||
if ( 1 === matches ) {
|
||||
return wc_country_select_params.i18n_matches_1;
|
||||
}
|
||||
|
||||
return wc_country_select_params.i18n_matches_n.replace( '%qty%', matches );
|
||||
},
|
||||
formatNoMatches: function() {
|
||||
return wc_country_select_params.i18n_no_matches;
|
||||
},
|
||||
formatAjaxError: function() {
|
||||
return wc_country_select_params.i18n_ajax_error;
|
||||
},
|
||||
formatInputTooShort: function( input, min ) {
|
||||
var number = min - input.length;
|
||||
|
||||
if ( 1 === number ) {
|
||||
return wc_country_select_params.i18n_input_too_short_1;
|
||||
}
|
||||
|
||||
return wc_country_select_params.i18n_input_too_short_n.replace( '%qty%', number );
|
||||
},
|
||||
formatInputTooLong: function( input, max ) {
|
||||
var number = input.length - max;
|
||||
|
||||
if ( 1 === number ) {
|
||||
return wc_country_select_params.i18n_input_too_long_1;
|
||||
}
|
||||
|
||||
return wc_country_select_params.i18n_input_too_long_n.replace( '%qty%', number );
|
||||
},
|
||||
formatSelectionTooBig: function( limit ) {
|
||||
if ( 1 === limit ) {
|
||||
return wc_country_select_params.i18n_selection_too_long_1;
|
||||
}
|
||||
|
||||
return wc_country_select_params.i18n_selection_too_long_n.replace( '%qty%', limit );
|
||||
},
|
||||
formatLoadMore: function() {
|
||||
return wc_country_select_params.i18n_load_more;
|
||||
},
|
||||
formatSearching: function() {
|
||||
return wc_country_select_params.i18n_searching;
|
||||
}
|
||||
};
|
||||
|
||||
return formatString;
|
||||
}
|
||||
|
||||
// Select2 Enhancement if it exists
|
||||
if ( $().select2 ) {
|
||||
var wc_city_select_select2 = function() {
|
||||
$( 'select.city_select:visible' ).each( function() {
|
||||
var select2_args = $.extend({
|
||||
placeholderOption: 'first',
|
||||
width: '100%'
|
||||
}, getEnhancedSelectFormatString() );
|
||||
|
||||
$( this ).select2( select2_args );
|
||||
});
|
||||
};
|
||||
|
||||
wc_city_select_select2();
|
||||
|
||||
$( document.body ).bind( 'city_to_select', function() {
|
||||
wc_city_select_select2();
|
||||
});
|
||||
}
|
||||
|
||||
/* City select boxes */
|
||||
var cities_json = wc_city_select_params.cities.replace( /"/g, '"' );
|
||||
var cities = $.parseJSON( cities_json );
|
||||
|
||||
$( 'body' ).on( 'country_to_state_changing', function(e, country, $container) {
|
||||
var $statebox = $container.find( '#billing_state, #shipping_state, #calc_shipping_state' );
|
||||
var state = $statebox.val();
|
||||
$( document.body ).trigger( 'state_changing', [country, state, $container ] );
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'change', 'select.state_select, #calc_shipping_state', function() {
|
||||
var $container = $( this ).closest( 'div' );
|
||||
var country = $container.find( '#billing_country, #shipping_country, #calc_shipping_country' ).val();
|
||||
var state = $( this ).val();
|
||||
|
||||
$( document.body ).trigger( 'state_changing', [country, state, $container ] );
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'state_changing', function(e, country, state, $container) {
|
||||
var $citybox = $container.find( '#billing_city, #shipping_city, #calc_shipping_city' );
|
||||
|
||||
if ( cities[ country ] ) {
|
||||
/* if the country has no states */
|
||||
if( cities[country] instanceof Array) {
|
||||
cityToSelect( $citybox, cities[ country ] );
|
||||
} else if ( state ) {
|
||||
if ( cities[ country ][ state ] ) {
|
||||
cityToSelect( $citybox, cities[ country ][ state ] );
|
||||
} else {
|
||||
cityToInput( $citybox );
|
||||
}
|
||||
} else {
|
||||
disableCity( $citybox );
|
||||
}
|
||||
} else {
|
||||
cityToInput( $citybox );
|
||||
}
|
||||
});
|
||||
|
||||
/* Ajax replaces .cart_totals (child of .cart-collaterals) on shipping calculator */
|
||||
if ( $( '.cart-collaterals' ).length && $( '#calc_shipping_state' ).length ) {
|
||||
var calc_observer = new MutationObserver( function() {
|
||||
$( '#calc_shipping_state' ).change();
|
||||
});
|
||||
calc_observer.observe( document.querySelector( '.cart-collaterals' ), { childList: true });
|
||||
}
|
||||
|
||||
function cityToInput( $citybox ) {
|
||||
if ( $citybox.is('input') ) {
|
||||
$citybox.prop( 'disabled', false );
|
||||
return;
|
||||
}
|
||||
|
||||
var input_name = $citybox.attr( 'name' );
|
||||
var input_id = $citybox.attr( 'id' );
|
||||
var placeholder = $citybox.attr( 'placeholder' );
|
||||
|
||||
$citybox.parent().find( '.select2-container' ).remove();
|
||||
|
||||
$citybox.replaceWith( '<input type="text" class="input-text" name="' + input_name + '" id="' + input_id + '" placeholder="' + placeholder + '" />' );
|
||||
}
|
||||
|
||||
function disableCity( $citybox ) {
|
||||
$citybox.val( '' ).change();
|
||||
$citybox.prop( 'disabled', true );
|
||||
}
|
||||
|
||||
function cityToSelect( $citybox, current_cities ) {
|
||||
var value = $citybox.val();
|
||||
|
||||
if ( $citybox.is('input') ) {
|
||||
var input_name = $citybox.attr( 'name' );
|
||||
var input_id = $citybox.attr( 'id' );
|
||||
var placeholder = $citybox.attr( 'placeholder' );
|
||||
|
||||
$citybox.replaceWith( '<select name="' + input_name + '" id="' + input_id + '" class="city_select" placeholder="' + placeholder + '"></select>' );
|
||||
//we have to assign the new object, because of replaceWith
|
||||
$citybox = $('#'+input_id);
|
||||
} else {
|
||||
$citybox.prop( 'disabled', false );
|
||||
}
|
||||
|
||||
var options = '';
|
||||
for( var index in current_cities ) {
|
||||
if ( current_cities.hasOwnProperty( index ) ) {
|
||||
var cityName = current_cities[ index ];
|
||||
options = options + '<option value="' + cityName + '">' + cityName + '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
$citybox.html( '<option value="">' + wc_city_select_params.i18n_select_city_text + '</option>' + options );
|
||||
|
||||
if ( $('option[value="'+value+'"]', $citybox).length ) {
|
||||
$citybox.val( value ).change();
|
||||
} else {
|
||||
$citybox.val( '' ).change();
|
||||
}
|
||||
|
||||
$( document.body ).trigger( 'city_to_select' );
|
||||
}
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,79 @@
|
||||
=== WC City Select ===
|
||||
Contributors: mantish
|
||||
Donate link: mailto:paypal@8manos.com
|
||||
Tags: woocommerce, cities, city, city select, cities select, city dropdown, cities dropdown, woocommerce city, woocommerce cities
|
||||
Requires at least: 4.0
|
||||
Tested up to: 4.7.3
|
||||
Stable tag: 1.0.3
|
||||
WC requires at least: 2.2
|
||||
WC tested up to: 2.7.0
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
City Select for WooCommerce. Show a dropdown select as the cities input.
|
||||
|
||||
== Description ==
|
||||
|
||||
WooCommerce uses a text input for the customers to enter the city or town. With this plugin you can provide a list of cities to be shown as a select dropdown.
|
||||
|
||||
This will be shown in checkout pages, edit addresses pages and shipping calculator if it's configured that way.
|
||||
|
||||
A list of cities has to be loaded in the functions.php file (the plugin already includes cities from Colombia and Iran). Please check the Installation section for more info.
|
||||
|
||||
### Github
|
||||
|
||||
Contribute at https://github.com/8manos/wc-city-select
|
||||
|
||||
== Installation ==
|
||||
|
||||
1. Upload to the `/wp-content/plugins/` directory
|
||||
1. Activate the plugin through the 'Plugins' menu in WordPress
|
||||
1. Use `wc_city_select_cities` filter to load your cities. This is done similarly to [adding states/provinces](https://docs.woothemes.com/document/addmodify-states/). It should be added on your functions.php or a custom plugin.
|
||||
|
||||
`
|
||||
add_filter( 'wc_city_select_cities', 'my_cities' );
|
||||
/**
|
||||
* Replace XX with the country code. Instead of YYY, ZZZ use actual state codes.
|
||||
*/
|
||||
function my_cities( $cities ) {
|
||||
$cities['XX'] = array(
|
||||
'YYY' => array(
|
||||
'City ',
|
||||
'Another City'
|
||||
),
|
||||
'ZZZ' => array(
|
||||
'City 3',
|
||||
'City 4'
|
||||
)
|
||||
);
|
||||
return $cities;
|
||||
}
|
||||
`
|
||||
|
||||
It's also possible to use a list of cities without grouping them by state:
|
||||
|
||||
`
|
||||
add_filter( 'wc_city_select_cities', 'my_cities' );
|
||||
function my_cities( $cities ) {
|
||||
$cities['XX'] = array(
|
||||
'City ',
|
||||
'Another City'
|
||||
);
|
||||
return $cities;
|
||||
}
|
||||
`
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.0.3 =
|
||||
* fix some issues when loading cities initially, that were causing warnings.
|
||||
|
||||
= 1.0.2 =
|
||||
* fix some issues with shipping calculator and other edge cases.
|
||||
* Now works with countries that have no states, only cities.
|
||||
|
||||
= 1.0.1 =
|
||||
* select2 enhancement when available. Adds a JS version of the select dropdown.
|
||||
|
||||
= 1.0 =
|
||||
* First release.
|
||||
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: WC City Select
|
||||
* Plugin URI: https://wordpress.org/plugins/wc-city-select/
|
||||
* Description: City Select for WooCommerce. Show a dropdown select as the cities input.
|
||||
* Version: 1.0.3
|
||||
* Author: 8manos
|
||||
* Author URI: http://8manos.com
|
||||
* License: GPLv2 or later
|
||||
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
// Check if WooCommerce is active
|
||||
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
||||
|
||||
class WC_City_Select {
|
||||
|
||||
// plugin version
|
||||
const VERSION = '1.0.1';
|
||||
|
||||
private $plugin_path;
|
||||
private $plugin_url;
|
||||
|
||||
private $cities;
|
||||
|
||||
public function __construct() {
|
||||
add_filter( 'woocommerce_billing_fields', array( $this, 'billing_fields' ), 10, 2 );
|
||||
add_filter( 'woocommerce_shipping_fields', array( $this, 'shipping_fields' ), 10, 2 );
|
||||
add_filter( 'woocommerce_form_field_city', array( $this, 'form_field_city' ), 10, 4 );
|
||||
|
||||
//js scripts
|
||||
add_action( 'wp_enqueue_scripts', array( $this, 'load_scripts' ) );
|
||||
}
|
||||
|
||||
public function billing_fields( $fields, $country ) {
|
||||
$fields['billing_city']['type'] = 'city';
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function shipping_fields( $fields, $country ) {
|
||||
$fields['shipping_city']['type'] = 'city';
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function get_cities( $cc = null ) {
|
||||
if ( empty( $this->cities ) ) {
|
||||
$this->load_country_cities();
|
||||
}
|
||||
|
||||
if ( ! is_null( $cc ) ) {
|
||||
return isset( $this->cities[ $cc ] ) ? $this->cities[ $cc ] : false;
|
||||
} else {
|
||||
return $this->cities;
|
||||
}
|
||||
}
|
||||
|
||||
public function load_country_cities() {
|
||||
global $cities;
|
||||
|
||||
// Load only the city files the shop owner wants/needs.
|
||||
$allowed = array_merge( WC()->countries->get_allowed_countries(), WC()->countries->get_shipping_countries() );
|
||||
|
||||
if ( $allowed ) {
|
||||
foreach ( $allowed as $code => $country ) {
|
||||
if ( ! isset( $cities[ $code ] ) && file_exists( $this->get_plugin_path() . '/cities/' . $code . '.php' ) ) {
|
||||
include( $this->get_plugin_path() . '/cities/' . $code . '.php' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->cities = apply_filters( 'wc_city_select_cities', $cities );
|
||||
}
|
||||
|
||||
public function form_field_city( $field, $key, $args, $value ) {
|
||||
|
||||
// Do we need a clear div?
|
||||
if ( ( ! empty( $args['clear'] ) ) ) {
|
||||
$after = '<div class="clear"></div>';
|
||||
} else {
|
||||
$after = '';
|
||||
}
|
||||
|
||||
// Required markup
|
||||
if ( $args['required'] ) {
|
||||
$args['class'][] = 'validate-required';
|
||||
$required = ' <abbr class="required" title="' . esc_attr__( 'required', 'woocommerce' ) . '">*</abbr>';
|
||||
} else {
|
||||
$required = '';
|
||||
}
|
||||
|
||||
// Custom attribute handling
|
||||
$custom_attributes = array();
|
||||
|
||||
if ( ! empty( $args['custom_attributes'] ) && is_array( $args['custom_attributes'] ) ) {
|
||||
foreach ( $args['custom_attributes'] as $attribute => $attribute_value ) {
|
||||
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
||||
}
|
||||
}
|
||||
|
||||
// Validate classes
|
||||
if ( ! empty( $args['validate'] ) ) {
|
||||
foreach( $args['validate'] as $validate ) {
|
||||
$args['class'][] = 'validate-' . $validate;
|
||||
}
|
||||
}
|
||||
|
||||
// field p and label
|
||||
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '_field">';
|
||||
if ( $args['label'] ) {
|
||||
$field .= '<label for="' . esc_attr( $args['id'] ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label']. $required . '</label>';
|
||||
}
|
||||
|
||||
// Get Country
|
||||
$country_key = $key == 'billing_city' ? 'billing_country' : 'shipping_country';
|
||||
$current_cc = WC()->checkout->get_value( $country_key );
|
||||
|
||||
$state_key = $key == 'billing_city' ? 'billing_state' : 'shipping_state';
|
||||
$current_sc = WC()->checkout->get_value( $state_key );
|
||||
|
||||
// Get country cities
|
||||
$cities = $this->get_cities( $current_cc );
|
||||
|
||||
if ( is_array( $cities ) ) {
|
||||
|
||||
$field .= '<select name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" class="city_select ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" ' . implode( ' ', $custom_attributes ) . ' placeholder="' . esc_attr( $args['placeholder'] ) . '">
|
||||
<option value="">'. __( 'Select an option…', 'woocommerce' ) .'</option>';
|
||||
|
||||
if ( $current_sc && $cities[ $current_sc ] ) {
|
||||
$dropdown_cities = $cities[ $current_sc ];
|
||||
} else if ( is_array( reset($cities) ) ) {
|
||||
$dropdown_cities = array_reduce( $cities, 'array_merge', array() );
|
||||
sort( $dropdown_cities );
|
||||
} else {
|
||||
$dropdown_cities = $cities;
|
||||
}
|
||||
|
||||
foreach ( $dropdown_cities as $city_name ) {
|
||||
$field .= '<option value="' . esc_attr( $city_name ) . '" '.selected( $value, $city_name, false ) . '>' . $city_name .'</option>';
|
||||
}
|
||||
|
||||
$field .= '</select>';
|
||||
|
||||
} else {
|
||||
|
||||
$field .= '<input type="text" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" value="' . esc_attr( $value ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
|
||||
}
|
||||
|
||||
// field description and close wrapper
|
||||
if ( $args['description'] ) {
|
||||
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
|
||||
}
|
||||
|
||||
$field .= '</p>' . $after;
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
public function load_scripts() {
|
||||
if ( is_cart() || is_checkout() || is_wc_endpoint_url( 'edit-address' ) ) {
|
||||
|
||||
$city_select_path = $this->get_plugin_url() . 'assets/js/city-select.js';
|
||||
wp_enqueue_script( 'wc-city-select', $city_select_path, array( 'jquery', 'woocommerce' ), self::VERSION, true );
|
||||
|
||||
$cities = json_encode( $this->get_cities() );
|
||||
wp_localize_script( 'wc-city-select', 'wc_city_select_params', array(
|
||||
'cities' => $cities,
|
||||
'i18n_select_city_text' => esc_attr__( 'Select an option…', 'woocommerce' )
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
public function get_plugin_path() {
|
||||
|
||||
if ( $this->plugin_path ) {
|
||||
return $this->plugin_path;
|
||||
}
|
||||
|
||||
return $this->plugin_path = plugin_dir_path( __FILE__ );
|
||||
}
|
||||
|
||||
public function get_plugin_url() {
|
||||
|
||||
if ( $this->plugin_url ) {
|
||||
return $this->plugin_url;
|
||||
}
|
||||
|
||||
return $this->plugin_url = plugin_dir_url( __FILE__ );
|
||||
}
|
||||
}
|
||||
|
||||
$GLOBALS['wc_city_select'] = new WC_City_Select();
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
# Woo Viet - WooCommerce for Vietnam
|
||||
|
||||
| Name | Value |
|
||||
|:---|:---|
|
||||
| Contributors | htdat |
|
||||
|Tags| WooCommerce Vietnam, vietnam, vietnamese, vietnam provinces, paypal for vietnam dong, vnd, vietnam dong, vietnam currency, vietnam customization |
|
||||
| Requires at least | 4.3 |
|
||||
| Tested up to | 4.7 |
|
||||
| Stable tag | 1.3 |
|
||||
| License | GPLv2 or later |
|
||||
| License URI | https://www.gnu.org/licenses/gpl-2.0.html |
|
||||
|
||||
Add features to WooCommerce stores having anything related to Vietnam: currency, shipping address, PayPal and more.
|
||||
|
||||
## Description
|
||||
|
||||
**"Woo Viet - WooCommerce for Vietnam" brings the features that help to run WooCommerce stores and customize them for Vietnam much easier.**
|
||||
|
||||
Xem phiên bản tiếng Việt tại đây https://vi.wordpress.org/plugins/woo-viet/
|
||||
|
||||
## FEATURES
|
||||
|
||||
* Change the VND currency symbol `đ` to anything, e.g: `VND`, `VNĐ`, `đồng`, etc.
|
||||
* Add provinces for Vietnam when visitors select Vietnam as a country of the shipping (billing) address. This is not available in WooCommerce by default.
|
||||
* Add districts to Vietnam provinces.
|
||||
* Convert `000` of prices to `K` (or anything). E.g: `50000` (VND) will be `50K` (VND), or `50 thousand` (VND).
|
||||
* Support `VND` for [the PayPal Standard gateway](https://docs.woocommerce.com/document/paypal-standard/). Convert `VND` prices to any PayPal supported currency before sending visitors to the PayPal pages.
|
||||
* Add [the OnePay domestic (local ATM cards) gateway](http://onepay.com.vn/).
|
||||
|
||||
## ROAD MAP
|
||||
|
||||
In the future, this plugin will add more and more features for the Vietnam market:
|
||||
|
||||
* Integrate all districts to Vietnam provinces.
|
||||
* Integrate at least one solution for collecting money by phone cards.
|
||||
* Integrate the Vietnam payment gateways like 1Pay, OnePay, BaoKim, Ngan Luong, etc.
|
||||
* Integrate the Vietnam shipping solutions like ShipChung, Giaohangnhanh, ViettelPost, etc.
|
||||
|
||||
## WHERE CAN I CONTRIBUTE MY CODE OR IDEA?
|
||||
|
||||
* You can report bugs or contribute code on [this GitHub repo](https://github.com/htdat/woo-viet).
|
||||
* Please also do let us know if the "bug" is just a grammar/spelling error in both English and Vietnamese. We try to make our products as perfect as possible.
|
||||
|
||||
## INSTALLATION
|
||||
|
||||
Follow these steps to install and use the plugin:
|
||||
|
||||
1. Upload the plugin files to the `/wp-content/plugins/woo-viet` directory, or install the plugin through the WordPress plugins screen directly.
|
||||
1. Activate the plugin through the `Plugins` screen in WordPress.
|
||||
1. Go to the `WooCommerce -> Woo Viet` screen and configure the plugin.
|
||||
|
||||
## Installation
|
||||
|
||||
Follow these steps to install and use the plugin:
|
||||
|
||||
1. Upload the plugin files to the `/wp-content/plugins/woo-viet` directory, or install the plugin through the WordPress plugins screen directly.
|
||||
1. Activate the plugin through the 'Plugins' screen in WordPress.
|
||||
1. Go to the `WooCommerce -> Woo Viet` screen and configure the plugin.
|
||||
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### WHERE CAN I CONTRIBUTE MY CODE OR IDEA?
|
||||
|
||||
* You can report bugs or contribute code on [this GitHub repo](https://github.com/htdat/woo-viet).
|
||||
* Please also do let us know if the "bug" is just a grammar/spelling error in both English and Vietnamese. We try to make our products as perfect as possible.
|
||||
|
||||
## Screenshots
|
||||
|
||||
1. The settings page under WooCommerce -> Woo Viet.
|
||||
2. Prices are changed to "K", and the symbol is now "VND".
|
||||
3. List provinces when selecting Vietnam.
|
||||
4. Let clients know about the currency conversion before switching to the PayPal pages.
|
||||
|
||||
## Changelog
|
||||
|
||||
### 1.3 - 2017.04.22
|
||||
* Add [the OnePay domestic (local ATM cards) gateway](http://onepay.com.vn/)
|
||||
|
||||
### 1.2 - 2017.03.03
|
||||
* Integrate all districts to Vietnam provinces. Credits: [WC City Select by 8manos](https://github.com/8manos/wc-city-select) and [the Vietnam district data by 10h30](https://github.com/htdat/woo-viet/issues/4#issuecomment-277449462)
|
||||
|
||||
### 1.1
|
||||
* Replace all “WooCommerce for Vietnam” to “Woo Viet”
|
||||
* Replace all “woocomerce-for-vietnam” to “woo-viet”
|
||||
* Re-upload to WordPress.org
|
||||
|
||||
### 1.0
|
||||
* First release.
|
||||
* Upload to WordPress.org
|
||||
+46
-42
@@ -1,9 +1,9 @@
|
||||
=== Plugin Name ===
|
||||
=== Woo Viet - WooCommerce for Vietnam ===
|
||||
Contributors: htdat
|
||||
Tags: WooCommerce Vietnam, vietnam, vietnamese, vietnam provinces, paypal for vietnam dong, vnd, vietnam dong
|
||||
Tags: OnePay WooCommerce, OnePay Vietnam, WooCommerce Vietnam, vietnam, vietnamese, vietnam provinces, paypal for vietnam dong, vnd, vietnam dong, vietnam currency, vietnam customization
|
||||
Requires at least: 4.3
|
||||
Tested up to: 4.7
|
||||
Stable tag: 1.0
|
||||
Tested up to: 4.7.4
|
||||
Stable tag: 1.3
|
||||
License: GPLv2 or later
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
@@ -11,84 +11,88 @@ Add features to WooCommerce stores having anything related to Vietnam: currency,
|
||||
|
||||
== Description ==
|
||||
|
||||
`WooCommerce for Vietnam` brings the features that help to run WooCommerce stores and customize them for Vietnam much easier.
|
||||
**"Woo Viet - WooCommerce for Vietnam" brings the features that help to run WooCommerce stores and customize them for Vietnam much easier.**
|
||||
|
||||
`WooCommerce for Vietnam` đem đến các chức năng để site WooCommerce có thể dễ dàng tuỳ biến cho thị trường Việt Nam.
|
||||
Xem phiên bản tiếng Việt tại đây https://vi.wordpress.org/plugins/woo-viet/
|
||||
|
||||
**NEW FEATURE**:
|
||||
Add [the OnePay domestic (local ATM cards) gateway](http://onepay.com.vn/).
|
||||
|
||||
**Chức năng - Features**
|
||||
|
||||
(Tiếng Việt)
|
||||
|
||||
* Đổi ký hiệu ngôn ngữ của VND từ mặc định `đ` sang bất cứ thừ gì khác, ví dụ: `VND`, `VNĐ`, `đồng`, v..
|
||||
|
||||
* Thêm tỉnh thành cho Việt Nam khi khách hiền điền địa chỉ nhận hàng hoặc nhận hoá đơn. Chức năng này không có ở trong WooCommerce mặc định.
|
||||
|
||||
* Đổi các số `000` trong giá cả thành `K` (hoặc bất cứ từ nào khác). Ví dụ: `50000` (VND) thành `50K` (VND), hay `50 nghìn` (VND).
|
||||
|
||||
* Hỗ trợ `VND` cho [cổng thanh toán PayPal Standard](https://docs.woocommerce.com/document/paypal-standard/). Chuyển đổi các giá `VND` sang bất kỳ loại tiền tệ nào mà PayPal hỗ trợ trước khi chuyển người dùng sang PayPal.
|
||||
|
||||
|
||||
(English)
|
||||
= FEATURES =
|
||||
|
||||
* Change the VND currency symbol `đ` to anything, e.g: `VND`, `VNĐ`, `đồng`, etc.
|
||||
|
||||
* Add provinces for Vietnam when visitors select Vietnam as a country of the shipping (billing) address. This is not available in WooCommerce by default.
|
||||
|
||||
* Add districts to Vietnam provinces.
|
||||
* Convert `000` of prices to `K` (or anything). E.g: `50000` (VND) will be `50K` (VND), or `50 thousand` (VND).
|
||||
|
||||
* Support `VND` for [the PayPal Standard gateway](https://docs.woocommerce.com/document/paypal-standard/). Convert `VND` prices to any PayPal supported currency before sending visitors to the PayPal pages.
|
||||
* Add [the OnePay domestic (local ATM cards) gateway](http://onepay.com.vn/).
|
||||
|
||||
**Road Map**
|
||||
= ROAD MAP =
|
||||
|
||||
In the future, this plugin will be added more and more features for the Vietnam market:
|
||||
|
||||
* Integrate all districts to Vietnam provinces.
|
||||
In the future, this plugin will add more and more features for the Vietnam market:
|
||||
|
||||
* Integrate all districts to Vietnam provinces. (available since 1.2)
|
||||
* Integrate at least one solution for collecting money by phone cards.
|
||||
|
||||
* Integrate the Vietnam payment gateways like 1Pay, OnePay, BaoKim, Ngan Luong, etc.
|
||||
|
||||
* Integrate the Vietnam shipping solutions like ShipChung, Giaohangnhanh, ViettelPost, etc.
|
||||
|
||||
**Where can I contribute my code or idea?**
|
||||
|
||||
* You can report bugs or contribute code on [this GitHub repo](https://github.com/htdat/woocommerce-for-vietnam).
|
||||
= WHERE CAN I CONTRIBUTE MY CODE OR IDEA? =
|
||||
|
||||
* You can report bugs or contribute code on [this GitHub repo](https://github.com/htdat/woo-viet).
|
||||
* Please also do let us know if the "bug" is just a grammar/spelling error in both English and Vietnamese. We try to make our products as perfect as possible.
|
||||
|
||||
**Installation**
|
||||
= INSTALLATION =
|
||||
|
||||
Follow these steps to install and use the plugin:
|
||||
|
||||
1. Upload the plugin files to the `/wp-content/plugins/woocommerce-for-vietnam` directory, or install the plugin through the WordPress plugins screen directly.
|
||||
1. Upload the plugin files to the `/wp-content/plugins/woo-viet` directory, or install the plugin through the WordPress plugins screen directly.
|
||||
1. Activate the plugin through the `Plugins` screen in WordPress.
|
||||
1. Go to the `WooCommerce -> WooCommerce for Vietnam` screen and configure the plugin.
|
||||
1. Go to the `WooCommerce -> Woo Viet` screen and configure the plugin.
|
||||
|
||||
== Installation ==
|
||||
|
||||
Follow these steps to install and use the plugin:
|
||||
|
||||
1. Upload the plugin files to the `/wp-content/plugins/woocommerce-for-vietnam` directory, or install the plugin through the WordPress plugins screen directly.
|
||||
1. Upload the plugin files to the `/wp-content/plugins/woo-viet` directory, or install the plugin through the WordPress plugins screen directly.
|
||||
1. Activate the plugin through the 'Plugins' screen in WordPress.
|
||||
1. Go to the `WooCommerce -> WooCommerce for Vietnam` screen and configure the plugin.
|
||||
1. Go to the `WooCommerce -> Woo Viet` screen and configure the plugin.
|
||||
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Where can I contribute my code or idea? =
|
||||
= WHERE CAN I CONTRIBUTE MY CODE OR IDEA? =
|
||||
|
||||
* You can report bugs or contribute code on [this GitHub repo](https://github.com/htdat/woocommerce-for-vietnam).
|
||||
* You can report bugs or contribute code on [this GitHub repo](https://github.com/htdat/woo-viet).
|
||||
* Please also do let us know if the "bug" is just a grammar/spelling error in both English and Vietnamese. We try to make our products as perfect as possible.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. The settings page under WooCommerce -> WooCommerce for Vietnam.
|
||||
1. The settings page under WooCommerce -> Woo Viet.
|
||||
2. Prices are changed to "K", and the symbol is now "VND".
|
||||
3. List provinces when selecting Vietnam.
|
||||
3. List provinces and districts when selecting Vietnam.
|
||||
4. Let clients know about the currency conversion before switching to the PayPal pages.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.3 - 2017.04.22 =
|
||||
* Add [the OnePay domestic (local ATM cards) gateway](http://onepay.com.vn/).
|
||||
|
||||
= 1.2 - 2017.03.03 =
|
||||
* Integrate all districts to Vietnam provinces. Credits: [WC City Select by 8manos](https://github.com/8manos/wc-city-select) and [the Vietnam district data by 10h30](https://github.com/htdat/woo-viet/issues/4#issuecomment-277449462)
|
||||
|
||||
= 1.1 =
|
||||
* Replace all “WooCommerce for Vietnam” to “Woo Viet”
|
||||
* Replace all “woocomerce-for-vietnam” to “woo-viet”
|
||||
* Re-upload to WordPress.org
|
||||
|
||||
= 1.0 =
|
||||
* First release.
|
||||
* First release.
|
||||
* Upload to WordPress.org
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 1.3 =
|
||||
The new version 1.2 comes with the feature "Add the OnePay domestic (local ATM cards) gateway]"
|
||||
|
||||
= 1.2 =
|
||||
The new version 1.2 comes with the feature "Add districts to Vietnam provinces".
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 43 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: WooCommerce for Vietnam
|
||||
* Plugin URI: https://github.com/htdat/woocommerce-for-vietnam
|
||||
* Plugin Name: Woo Viet - WooCommerce for Vietnam
|
||||
* Plugin URI: https://github.com/htdat/woo-viet
|
||||
* Description: This plugin provides features and integrations specifically for Vietnam.
|
||||
* Author: htdat
|
||||
* Author URI: https://profiles.wordpress.org/htdat
|
||||
* Text Domain: woocommerce-for-vietnam
|
||||
* Text Domain: woo-viet
|
||||
* Domain Path: /languages
|
||||
* Version: 1.0
|
||||
* Version: 1.3
|
||||
* License: GPLv2+
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
define( 'WOO_VIET_DIR', plugin_dir_path( __FILE__ ) );
|
||||
// define( 'WOO_VIET_URL', plugins_url( '/', __FILE__ ) );
|
||||
define( 'WOO_VIET_URL', plugins_url( '/', __FILE__ ) );
|
||||
|
||||
/**
|
||||
* Start the instance
|
||||
@@ -40,6 +40,10 @@ class WooViet {
|
||||
array(
|
||||
'enabled' => 'yes',
|
||||
),
|
||||
'add_city' =>
|
||||
array(
|
||||
'enabled' => 'yes',
|
||||
),
|
||||
'change_currency_symbol' =>
|
||||
array(
|
||||
'enabled' => 'yes',
|
||||
@@ -56,6 +60,10 @@ class WooViet {
|
||||
'currency' => 'USD',
|
||||
'rate' => '22770',
|
||||
),
|
||||
'add_onepay_domestic' =>
|
||||
array(
|
||||
'enabled' => 'yes',
|
||||
),
|
||||
);
|
||||
/**
|
||||
* The properties to manage all classes under the "inc/" folder
|
||||
@@ -84,8 +92,8 @@ class WooViet {
|
||||
public function notice_if_not_woocommerce() {
|
||||
$class = 'notice notice-error';
|
||||
|
||||
$message = __( 'WooCommerce for Vietnam is not running because WooCommerce is not active. Please activate both plugins',
|
||||
'woocommerce-for-vietnam' );
|
||||
$message = __( 'Woo Viet is not running because WooCommerce is not active. Please activate both plugins',
|
||||
'woo-viet' );
|
||||
|
||||
printf( '<div class="%1$s"><p><strong>%2$s</strong></p></div>', $class, $message );
|
||||
}
|
||||
@@ -112,7 +120,7 @@ class WooViet {
|
||||
* @since 1.0
|
||||
*/
|
||||
public function i18n() {
|
||||
load_plugin_textdomain( 'freshfunbits', false, basename( dirname( __FILE__ ) ) . '/languages/' );
|
||||
load_plugin_textdomain( 'woo-viet', false, basename( dirname( __FILE__ ) ) . '/languages/' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,10 +137,36 @@ class WooViet {
|
||||
|
||||
$settings = self::get_settings();
|
||||
|
||||
// Check if "Add the OnePay Domestic Gateway" is enabled
|
||||
if ( 'yes' == $settings['add_onepay_domestic']['enabled']
|
||||
AND 'VND' == get_woocommerce_currency()
|
||||
) {
|
||||
include( 'inc/class-wooviet-onepay-domestic.php' );
|
||||
|
||||
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateway_class' ) );
|
||||
|
||||
// Add the action to check the cron job for handling queryDR
|
||||
// It's not possible to add in the class "WooViet_OnePay_Domestic_Hook" because it's NOT always loadded
|
||||
if ( defined( 'DOING_CRON' ) and DOING_CRON ) {
|
||||
$this->WooViet_OnePay_Domestic_Hook = new WooViet_OnePay_Domestic();
|
||||
add_action( 'wooviet_handle_onepay_querydr', array(
|
||||
$this->WooViet_OnePay_Domestic_Hook,
|
||||
'handle_onepay_querydr'
|
||||
), 10, 1 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check if "Add provinces for Vietnam " is enabled.
|
||||
if ( 'yes' == $settings['add_province']['enabled'] ) {
|
||||
include( WOO_VIET_DIR . 'inc/class-wooviet-provinces.php' );
|
||||
$this->Provinces = new WooViet_Provinces();
|
||||
|
||||
// Enable "Add cities for Vietnam" if the province option is selected.
|
||||
if ( 'yes' == $settings['add_city']['enabled'] ) {
|
||||
include( WOO_VIET_DIR . 'inc/class-wooviet-cities.php' );
|
||||
new WooViet_Cities();
|
||||
}
|
||||
}
|
||||
|
||||
include( WOO_VIET_DIR . 'inc/class-wooviet-currency.php' );
|
||||
@@ -165,7 +199,25 @@ class WooViet {
|
||||
* @return array
|
||||
*/
|
||||
static function get_settings() {
|
||||
return get_option( 'woocommerce-for-vietnam', self::$default_settings );
|
||||
$settings = get_option( 'woo-viet', self::$default_settings );
|
||||
$settings = wp_parse_args( $settings, self::$default_settings );
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the gateways to WooCommerce
|
||||
*
|
||||
* @param array $methods
|
||||
*
|
||||
* @since 1.3
|
||||
* @return array
|
||||
*/
|
||||
public function add_gateway_class( $methods ) {
|
||||
$methods[] = 'WooViet_OnePay_Domestic';
|
||||
|
||||
return $methods;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user