mirror of
https://github.com/10h30/woo-viet.git
synced 2026-07-11 18:56:13 +09:00
Add the option in the Woo Viet setting page
This commit is contained in:
@@ -88,6 +88,24 @@ class WooViet_Admin_Page {
|
||||
value="<?php echo wp_create_nonce( 'wooviet_save_settings' ) ?>">
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<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( __('Please configure this gateway under <a href="%s">WooCommerce -> Settings -> Checkout</a>', 'woo-viet'), admin_url( 'admin.php?page=wc-settings&tab=checkout') );
|
||||
?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php _e( 'Add provinces for Vietnam', 'woo-viet' ) ?></th>
|
||||
<td>
|
||||
|
||||
+14
-8
@@ -60,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
|
||||
@@ -131,14 +135,6 @@ class WooViet {
|
||||
*/
|
||||
public function main() {
|
||||
|
||||
// @todo: ver 1.3 check this
|
||||
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateway_class' ) );
|
||||
|
||||
include( 'inc/class-wooviet-onepay-domestic.php');
|
||||
$WooViet_OnePay_Domestic_Hook = new WooViet_OnePay_Domestic();
|
||||
add_action('wooviet_handle_onepay_querydr', array($WooViet_OnePay_Domestic_Hook, 'handle_onepay_querydr'), 10, 1);
|
||||
|
||||
|
||||
if ( is_admin() ) {
|
||||
// Add the admin setting page
|
||||
include( WOO_VIET_DIR . 'inc/class-wooviet-admin-page.php' );
|
||||
@@ -147,6 +143,16 @@ class WooViet {
|
||||
}
|
||||
|
||||
$settings = self::get_settings();
|
||||
// Check if "Add the OnePay Domestic Gateway" is enabled
|
||||
if ( 'yes' == $settings['add_onepay_domestic']['enabled'] ) {
|
||||
// @todo: ver 1.3 check this
|
||||
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateway_class' ) );
|
||||
|
||||
include( 'inc/class-wooviet-onepay-domestic.php');
|
||||
$WooViet_OnePay_Domestic_Hook = new WooViet_OnePay_Domestic();
|
||||
add_action('wooviet_handle_onepay_querydr', array($WooViet_OnePay_Domestic_Hook, 'handle_onepay_querydr'), 10, 1);
|
||||
|
||||
}
|
||||
|
||||
// Check if "Add provinces for Vietnam " is enabled.
|
||||
if ( 'yes' == $settings['add_province']['enabled'] ) {
|
||||
|
||||
Reference in New Issue
Block a user