Plugin Directory

Changeset 2556394


Ignore:
Timestamp:
06/30/2021 12:49:35 PM (5 years ago)
Author:
bostateam
Message:

Link shipping zones to bosta zones

Location:
bosta-woocommerce/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bosta-woocommerce/trunk/bosta-woocommerce.php

    r2551357 r2556394  
    55 * Author: Bosta
    66 * Author URI: https://www.bosta.co/
    7  * Version: 2.5.9.1
     7 * Version: 2.6
    88 * Requires at least: 5.0
    99 * Tested up to: 5.7
     
    7070            $resultStates[$i] = $states[$i]->districts;
    7171        }
    72         return $resultStates;
     72        $states=$resultStates;
     73        return $states;
    7374    }
    7475}
     
    125126
    126127    jQuery(function($){
    127 
    128128var opa = <?php echo json_encode($options_a); ?>,
    129129select1 = 'select[name="_shipping_city"]',
     
    294294            select3 = 'select[name="shipping_city"]',
    295295            select4 = 'select[name="shipping_state"]';
    296         function dynamicSelectOptions( opt,type ){
     296            var selectedCityVal = $("#billing_city option:selected").val();
     297            var selectedAreaVal = $("#billing_state option:selected").val();
     298        function dynamicSelectOptions( opt,cityIndex,type ){
     299            let index=0;
     300             for(let i=0;i<cityIndex;i++){
     301                 index+=opa[i].flat().length
     302             }
     303             
    297304            var options = '';
    298 
    299305            $.each( opt, function( key, value ){
    300                 options += '<option value="'+value.zoneName+' - '+value.districtName+'">'+value.zoneName+' - '+value.districtName+'</option>';
     306const newKey=index+key;
     307                options += '<option value='+newKey+'>'+value.zoneName+' - '+value.districtName+'</option>';
    301308            });
    302309           type==='billing'? $(select2).html(options): $(select4).html(options);
    303310        }
    304        
     311
    305312        $(select1).change(function(){
    306313            for (let i = 0; i < opa.length; i++) {
    307314                if( $(this).val() == i )
    308                 dynamicSelectOptions( opa[i],'billing' );
     315                dynamicSelectOptions( opa[i],i,'billing' );
    309316            }
    310317        });
     
    313320            for (let i = 0; i < opa.length; i++) {
    314321                if( $(this).val() == i )
    315                 dynamicSelectOptions( opa[i] );
     322                dynamicSelectOptions( opa[i] ,i);
    316323            }
    317324        });
  • bosta-woocommerce/trunk/readme.txt

    r2551357 r2556394  
    77Requires PHP: 7.0
    88Tested up to: 5.7
    9 Stable tag: 2.5.9.1
     9Stable tag: 2.6
    1010WC requires at least: 2.6
    1111WC tested up to: 4.4.1
     
    111111* Fix place of description
    112112* Fix number of items sent to bosta.
     113
     114= 2.6 =
     115* Link shipping zones to bosta zones
Note: See TracChangeset for help on using the changeset viewer.