Plugin Directory

Changeset 2569476


Ignore:
Timestamp:
07/21/2021 06:50:27 PM (5 years ago)
Author:
mulutuvn
Message:

add 1.1.0

Location:
mulutu
Files:
41 added
7 edited

Legend:

Unmodified
Added
Removed
  • mulutu/trunk/MulutuSettings.php

    r2543097 r2569476  
    171171                'mulutu_setting_section' // section
    172172            );
     173
     174            add_settings_field(
     175                'include_cod_flg', // id
     176                'Thu hộ COD ', // title
     177                array($this, 'shippingIncludeCODCallback'), // callback
     178                MulutuSettings::$ADMIN_PAGE_SLUG, // page
     179                'mulutu_setting_section' // section
     180            );
    173181        }
    174182
     
    180188                'shipping_brand',
    181189                'ghn_token',
     190                'ghn_registered_phone',
    182191                'ghn_shop_id',
    183192                'ghn_shop_name',
     
    194203                    $sanitaryValues[$key] = sanitize_text_field($input[$key]);
    195204                }
     205            }
     206
     207            if (empty($sanitaryValues['ghn_token'])) {
     208                add_settings_error('token', '400', 'Token không hợp lệ');
     209                return false;
     210            }
     211
     212            if (empty($sanitaryValues['ghn_registered_phone']) || !preg_match('/^\d{9,12}$/', $sanitaryValues['ghn_registered_phone'])) {
     213                add_settings_error('ghn_registered_phone', '400', 'Số điện thoại không hợp lệ');
     214                return false;
    196215            }
    197216
     
    245264            }
    246265
     266            $sanitaryValues['include_cod_flg'] = 0;
     267            if (isset($input['include_cod_flg'])) {
     268                if(sanitize_text_field($input['include_cod_flg']) == 1) {
     269                    $sanitaryValues['include_cod_flg'] = 1;
     270                }
     271            }
     272
    247273            if ($this->mulutuOptions == '') {
    248274                $this->mulutuOptions = array();
     
    275301                'selectedShippingBrand' => $shippingBrand,
    276302                'shippingGHNSetting' => mulutuRenderView('settings/shipping_ghn', array(
    277                     'title'     => 'GHN',
    278                     'value'     => 'ghn',
    279                     'ghn_token' => !empty($this->mulutuOptions['ghn_token']) ? $this->mulutuOptions['ghn_token'] : null
     303                    'title'                => 'GHN',
     304                    'value'                => 'ghn',
     305                    'ghn_token'            => !empty($this->mulutuOptions['ghn_token']) ? $this->mulutuOptions['ghn_token'] : null,
     306                    'ghn_registered_phone' => !empty($this->mulutuOptions['ghn_registered_phone']) ? $this->mulutuOptions['ghn_registered_phone'] : null
    280307                ))
    281308            ));
     
    321348            ));
    322349        }
     350
     351        public function shippingIncludeCODCallback() {
     352            echo mulutuRenderView('settings/shipping_include_cod', array(
     353                'include_cod_flg' => !empty($this->mulutuOptions['include_cod_flg']) ? $this->mulutuOptions['include_cod_flg'] : 0
     354            ));
     355        }
    323356    }
    324357}
  • mulutu/trunk/apis.php

    r2543097 r2569476  
    416416        );
    417417
     418        if ($mulutuOptions['include_cod_flg'] == 0) {
     419            $query['cod'] = 0;
     420        }
     421
    418422        if($shippingServiceId == 'freeship_by_amount_over_value') {
    419423            $query['pm_t'] = 1;
  • mulutu/trunk/js/settings.js

    r2506157 r2569476  
    293293        if (!!needUpdateAffiliate) {
    294294            updateShopWebhookMapping();
    295             getOTPPromise($('#mulutu_options_ghn_shop_phone').val()).done(function(otpResponse) {
     295            getOTPPromise($('#ghn_registered_phone').val()).done(function(otpResponse) {
    296296                $('#countdown').countDown(10 * 60);
    297297                $('#otp-modal').loading(false);
     
    327327        $('.btn-submit-shop').on('click', function(e) {
    328328            e.preventDefault();
    329             getOTPPromise($('#view_ghn_shoptel').val()).done(function(otpResponse) {
     329            getOTPPromise($('#ghn_registered_phone').val()).done(function(otpResponse) {
    330330                $('#countdown').countDown(10 * 60);
    331331                $('#otp-modal').loading(false);
  • mulutu/trunk/readme.md

    r2558235 r2569476  
    3333
    3434### Changelog
    35 * 1.0.2 *
     351.1.0
     36* Fix bug
     37* Add GHN registered phone number
     381.0.2
    3639* Fix bug
    3740* Add leadtime
  • mulutu/trunk/readme.txt

    r2558235 r2569476  
    3939
    4040== Changelog ==
     41= 1.1.0 =
     42* Fix bug
     43* Add GHN register phone number
    4144= 1.0.2 =
    4245* Fix bug
  • mulutu/trunk/views/settings/admin_page.php

    r2543097 r2569476  
    44    }
    55    .hint-block {
    6         border-left: 5px solid #48922b;
     6        border-left: 5px solid #1f93d8;
    77        padding-left: 5px;
    88        font-size: small;
  • mulutu/trunk/views/settings/shipping_ghn.php

    r2506157 r2569476  
    1010                <input class="regular-text" type="text" name="mulutu_options[ghn_token]" id="ghn_token" value="<?php echo $ghn_token; ?>">
    1111            </div>
     12            <div class="form-control">
     13                <label for="ghn_registered_phone" class="input-required">Số điện thoại</label>
     14                <input class="regular-text" maxlength="20" type="text" name="mulutu_options[ghn_registered_phone]" id="ghn_registered_phone" value="<?php echo $ghn_registered_phone; ?>">
     15            </div>
    1216        </div>
    1317        <div class="hint">
Note: See TracChangeset for help on using the changeset viewer.