• Dear Javier,

    I like your plugin too much
    I’ve it used in one of my stores. Which include another locale than English. and an Aramex delivery plugin which is used to calculate shipping cost depend on city and country.
    I found it useful to change these lines

    foreach ( $dropdown_places as $city_name ) {
    if(!is_array($city_name)) {
    $field .= ‘<option value=”‘ . esc_attr( $city_name ) . ‘” ‘.selected( $value, $city_name, false ) . ‘>’ . $city_name .'</option>’;
    }
    }`

    to

    foreach ( $dropdown_places as $city_en_name => $city_name ) {
    if(!is_array($city_name)) {
    $field .= ‘<option value=”‘ . esc_attr( $city_en_name ) . ‘” ‘.selected( $value, $city_name, false ) . ‘>’ . $city_name .'</option>’;
    }
    }

    Also, change the structure of places files using regexp to make it like this


    global $places;

    global $places;
    
    $places['SA'] = array(
      // Riyadh Region
      'SA-01' => array(

    ‘Afif’ => _x(‘Afif’, ‘Governorates of Saudi Arabia’, ‘states-cities-and-places-for-woocommerce’),

    ),
    );
    
    // Use this filter to handle the Governorates of Saudi Arabia
    $places['SA'] = apply_filters('scpwoo_custom_places_sa', $places['SA']);

    Which will allow Aramex / DHL or any other plugin that uses the original city name to have the ability to process it even if website have any un natural language

    What do you think?

    Please let me know

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter SZ4H

    (@sz4h)

    BTW REGEXP I use is
    Search for
    _x\(‘(.*)’, ‘(.*)’,
    Replace with
    ‘$1’ => _x(‘$1’, ‘$2’,
    And then Search for
    _x\(‘(.*)’,
    Replace with
    ‘$1’ => _x(‘$1’,

    Thread Starter SZ4H

    (@sz4h)

    Also this is the code I replaced into states-cities-places-for-woocommerce.php
    Line 221

    foreach ( $dropdown_places as $city_key => $city_name ) {
                        if(!is_array($city_name)) {
                            if (is_numeric($city_key))
                                $field .= '<option value="' . esc_attr( $city_name ) . '" '.selected( $value, $city_name, false ) . '>' . $city_name .'</option>';
                            else
                                $field .= '<option value="' . esc_attr( $city_key ) . '" '.selected( $value, $city_name, false ) . '>' . $city_name .'</option>';
                        }
                    }

    @sz4h Hey buddy, why you do not make a plugin like this? The support here takes a lot of time and its having issues, bugs with no results. On my end the plugin is real good but lacks some compatibility. Mine is not reading or do not recognize the shipping methods I have on my shipping zones, so they are not showing at the check out… I have been fighting with that since long and have had to look for other ways to be able customers to checkout!

    Plugin Author Yordan Soares

    (@yordansoares)

    Hi @sz4h,

    Are you familiar with GitHub workflow? If so, could you please send your suggestion as a new pull request?

    Thanks in advance for your contribution!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Fix suggestion to support locale in delivery api’ is closed to new replies.