Plugin Directory

Changeset 3162752


Ignore:
Timestamp:
10/04/2024 01:10:26 PM (18 months ago)
Author:
eshoplogistic
Message:

Оптимизация кастомного способа выбора города

Location:
eshoplogisticru/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • eshoplogisticru/trunk/Classes/Shipping/Base.php

    r3154034 r3162752  
    247247        $sessionService->set('shipping_methods', $shippingMethods);
    248248
    249 
    250 
    251249        $labelTitle =  str_replace(':',' -',$this->title);
    252250        $labelDescription = $this->method_description;
  • eshoplogisticru/trunk/assets/css/style.css

    r3064439 r3162752  
    4949.wc-esl-search-region-modal__list{
    5050    display: inline-grid;
    51     width: 33%;
     51    width: 49.9%;
    5252    padding-top: 30px;
    5353}
     
    344344.eshoplogistic-widget-cart .eshoplogistic-theme-service__select-tariff{
    345345    font-size: 1rem !important;
     346}
     347
     348#esl_modal_button-search{
     349    margin-top: 25px;
    346350}
    347351
  • eshoplogisticru/trunk/assets/js/checkout.js

    r3143494 r3162752  
    320320                    if (currentBillingCountry) {
    321321                        searchCity(value, function (items) {
    322                             $this.next('#esl_result-search').html(
    323                                 renderCitiesModal(items, modeInput)
    324                             );
     322                            if(Object.getOwnPropertyNames(items).length > 1) {
     323                                $this.next('#esl_result-search').html(
     324                                    renderCitiesModal(items, modeInput)
     325                                );
     326                            }else{
     327                                $this.next('#esl_result-search').html('<button id="esl_modal_button-search">Выбрать данный населённый пункт</button>');
     328                            }
    325329                        }, currentBillingCountry, 'region');
    326330                    }
     
    334338                sendRequestCity(this);
    335339                document.getElementById("modal-esl-city").style.display = "none"
     340            });
     341
     342            $('body').on('click', '#esl_modal_button-search', function (e) {
     343                e.preventDefault();
     344                let modalSearch = $('#esl_modal-search');
     345                let value = modalSearch.val();
     346                let modeInput = modalSearch.attr('data-mode');
     347                $( `#${modeInput}_city` ).val( value );
     348                $.ajax({
     349                    method: 'POST',
     350                    url: wc_esl_shipping_global.ajaxUrl,
     351                    async: true,
     352                    data: {
     353                        action : 'wc_esl_update_shipping_address',
     354                    },
     355                    dataType: 'json',
     356                    success: function( response ) {
     357
     358                        console.log( response );
     359
     360                        $( 'body' ).trigger( 'update_checkout' );
     361                        document.getElementById("modal-esl-city").style.display = "none"
     362                    }
     363                });
    336364            });
    337365        }
  • eshoplogisticru/trunk/assets/js/checkout_frame_v2.js

    r3143494 r3162752  
    354354                    if (currentBillingCountry) {
    355355                        searchCity(value, function (items) {
    356                             $this.closest('.modal-esl-frame').find('#esl_result-search').html(
    357                                 renderCitiesModal(items, modeInput)
    358                             );
     356                            if(Object.getOwnPropertyNames(items).length > 1) {
     357                                $this.closest('.modal-esl-frame').find('#esl_result-search').html(
     358                                    renderCitiesModal(items, modeInput)
     359                                );
     360                            }else{
     361                                $this.closest('.modal-esl-frame').find('#esl_result-search').html(
     362                                    '<button id="esl_modal_button-search">Выбрать данный населённый пункт</button>'
     363                                );
     364                            }
     365
    359366                        }, currentBillingCountry, 'region');
    360367                    }
     
    370377                inputSearch.val(city)
    371378                document.getElementById("modal-esl-city").style.display = "none"
     379            });
     380
     381            $('body').on('click', '#esl_modal_button-search', function (e) {
     382                e.preventDefault();
     383                let modalSearch = $('#esl_modal-search');
     384                let value = modalSearch.val();
     385                let modeInput = modalSearch.attr('data-mode');
     386                $( `#${modeInput}_city` ).val( value );
     387
     388                document.getElementById("modal-esl-city").style.display = "none"
     389                window.keyDelivery = 'door'
     390                changeVisibleElements(
     391                    differentShippingAddress,
     392                    false,
     393                    currentBillingCountry,
     394                    currentShippingCountry
     395                );
     396                esl.request('');
    372397            });
    373398        }
  • eshoplogisticru/trunk/readme.txt

    r3161540 r3162752  
    44Requires at least: 5.3
    55Tested up to: 5.8
    6 Stable tag: 2.1.28e
     6Stable tag: 2.1.29
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • eshoplogisticru/trunk/wc-eshop-logistic.php

    r3161540 r3162752  
    66 *
    77 * @link              https://wp.eshoplogistic.ru/
    8  * @since             2.1.28
     8 * @since             2.1.29
    99 * @package           WC_Eshop_Logistic
    1010 *
     
    1313 * Plugin URI:        https://wp.eshoplogistic.ru/
    1414 * Description:       Несколько служб доставки в одной интеграции: CDEK, DPD, Boxberry, IML, Почта России, Деловые Линии, ПЭК, Dostavista, GTD, Байкал Сервис и др.
    15  * Version:           2.1.28
     15 * Version:           2.1.29
    1616 * Author:            eShopLogistic
    1717 * Author URI:        https://eshoplogistic.ru/p747575
     
    4141define( 'WC_ESL_PLUGIN_DIR', plugin_dir_path(__FILE__) );
    4242
    43 define( 'WC_ESL_VERSION', '2.1.28' );
     43define( 'WC_ESL_VERSION', '2.1.29' );
    4444
    4545define( 'WC_ESL_DOMAIN', 'wc-esl' );
Note: See TracChangeset for help on using the changeset viewer.