Changeset 3415749
- Timestamp:
- 12/09/2025 07:38:24 PM (2 months ago)
- Location:
- shipo/trunk
- Files:
-
- 5 edited
-
assets/js/checkout.js (modified) (8 diffs)
-
includes/class-shipo-checkout.php (modified) (3 diffs)
-
includes/class-shipo-wc-shipping.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
-
shipo.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shipo/trunk/assets/js/checkout.js
r3410852 r3415749 6 6 var cityValue = $(this).val(); 7 7 var elementId = $(this).attr('id'); 8 var prefix = elementId.split('_')[0] + '_' + elementId.split('_')[1]; 9 10 $('#' + elementId + '_id').val(''); 11 $('#' + prefix + '_street').val(''); 12 $('#' + prefix + '_street_id').val(''); 13 $('#' + prefix + '_street_suggestions').html(''); 14 $('#' + elementId.split('_')[0] + '_postcode').val(''); 8 15 9 16 clearMapElements(); … … 37 44 label: suggestionsResponse[key]['name'], 38 45 value: suggestionsResponse[key]['name'], 39 coord: suggestionsResponse[key]['coord'] 46 coord: suggestionsResponse[key]['coord'], 47 zipcode: suggestionsResponse[key]['zipcode'] 40 48 }); 41 49 }); … … 44 52 if (suggestions.length > 0 && suggestions[0].coord) { 45 53 suggestions.forEach(function(suggestion) { 46 $('#' + elementId + '_suggestions ul').append('<li data-coord="' + suggestion.coord['lat'] + ',' + suggestion.coord['lng'] + '" data-city-id="' + suggestion.id + '" >' + suggestion.value + '</li>');54 $('#' + elementId + '_suggestions ul').append('<li data-coord="' + suggestion.coord['lat'] + ',' + suggestion.coord['lng'] + '" data-city-id="' + suggestion.id + '" data-zipcode="' + suggestion.zipcode + '">' + suggestion.value + '</li>'); 47 55 }); 48 56 } else { … … 50 58 } 51 59 } else { 52 console.log(response.data.message);53 60 $('#' + elementId + '_suggestion ul').append('<li>' + response.data.message + '</li>'); 54 61 } … … 88 95 var prefix = elementId.split('_')[0] + '_' + elementId.split('_')[1]; 89 96 97 $('#' + prefix + '_street').val(''); 98 $('#' + prefix + '_street_id').val(''); 99 $('#' + prefix + '_street_suggestions').html(''); 100 90 101 var selectedAddress = $(this).text(); 91 102 var coordAddress = $(this).data('coord'); 92 103 var cityId = $(this).data('city-id'); 104 var zipcode = $(this).data('zipcode'); 93 105 var cityName = $(this).text(); 94 106 $('#' + prefix + '_city').val(selectedAddress); … … 96 108 $('input[name="' + prefix + '_coord"]').val(coordAddress); 97 109 $('input[name="' + prefix + '_city_id"]').val(cityId); 98 $('input[name="' + prefix + '_postcode"]').val( '');99 $('input[name="' + elementId.split('_')[0] + '_postcode"]').val( '');110 $('input[name="' + prefix + '_postcode"]').val(zipcode); 111 $('input[name="' + elementId.split('_')[0] + '_postcode"]').val(zipcode); 100 112 101 113 toggleViewSector(prefix, cityName); … … 131 143 var newElementId = elementIdParts.join('_'); 132 144 var cityValue = $('#' + newElementId + '_city').val(); 145 146 $('#' + elementId + '_id').val(''); 147 $('#' + elementIdParts[0] + '_postcode').val(''); 133 148 134 149 if (streetValue.length >= 3) { … … 193 208 $('input[name="' + prefix + '_street_id"]').val(streetId); 194 209 195 $(document.body).trigger('update_checkout');210 // $(document.body).trigger('update_checkout'); 196 211 }); 197 212 -
shipo/trunk/includes/class-shipo-checkout.php
r3404077 r3415749 484 484 485 485 if (empty($_POST['billing_shipo_street'])) { 486 wc_add_notice(__('Sele tează o stradă validă din.', 'shipo'), 'error');486 wc_add_notice(__('Selecteaza strada.', 'shipo'), 'error'); 487 487 } 488 488 … … 496 496 497 497 if (empty($_POST['shipping_shipo_street'])) { 498 wc_add_notice(__('Sele tează o stradă validă din.', 'shipo'), 'error');498 wc_add_notice(__('Selecteaza strada.', 'shipo'), 'error'); 499 499 } 500 500 … … 611 611 if (isset($_POST['ship_to_different_address']) && isset($_POST['shipping_shipo_city_id']) && empty($_POST['shipping_shipo_city_id'])) { 612 612 wc_add_notice('<a href="#shipping_shipo_city">' . __('Selectează un oraș valid din listă', 'shipo') . '</a>', 'error'); 613 }614 615 if (isset($_POST['billing_shipo_street_id']) && empty($_POST['billing_shipo_street_id'])) {616 wc_add_notice('<a href="#billing_shipo_street">' . __('Selectează o stradă validă din listă.', 'shipo') . '</a>', 'error');617 }618 619 if (isset($_POST['ship_to_different_address']) && isset($_POST['shipping_shipo_street_id']) && empty($_POST['shipping_shipo_street_id'])) {620 wc_add_notice('<a href="#shipping_shipo_street">' . __('Selectează o stradă validă din listă.', 'shipo') . '</a>', 'error');621 613 } 622 614 -
shipo/trunk/includes/class-shipo-wc-shipping.php
r3410852 r3415749 151 151 // Try multiple sources for Shipo data 152 152 $shipo_city = ''; 153 $shipo_street = '';154 153 155 154 // 1. Try data from current session 156 155 if(WC()->customer) { 157 156 $shipo_city = WC()->customer->get_meta('shipping_shipo_city'); 158 $shipo_street = WC()->customer->get_meta('shipping_shipo_street');159 157 160 if(empty($shipo_city) && empty($shipo_street)) {158 if(empty($shipo_city)) { 161 159 $shipo_city = WC()->customer->get_meta('billing_shipo_city'); 162 $shipo_street = WC()->customer->get_meta('billing_shipo_street');163 160 } 164 161 } … … 195 192 $shipo_city = sanitize_text_field(wp_unslash($_POST['shipping_shipo_city'])); 196 193 } 197 if(empty($shipo_street) && isset($_POST['shipping_shipo_street'])) {198 $shipo_street = sanitize_text_field(wp_unslash($_POST['shipping_shipo_street']));199 }200 194 } 201 195 … … 204 198 $shipo_city = $package['destination']['city']; 205 199 } 206 if(empty($shipo_street) && isset($package['destination']['address_1'])) { 207 $shipo_street = $package['destination']['address_1']; 208 } 200 209 201 // 4. Try data from session 210 202 if(empty($shipo_city) && WC()->session && WC()->session->get('shipo_city')) { 211 203 $shipo_city = WC()->session->get('shipo_city'); 212 204 } 213 if(empty($shipo_street) && WC()->session && WC()->session->get('shipo_street')) { 214 $shipo_street = WC()->session->get('shipo_street'); 215 } 205 216 206 if (!empty($shipo_city)) { 217 207 $package['destination']['shipo_city'] = sanitize_text_field($shipo_city); 218 208 $package['destination']['city'] = sanitize_text_field($shipo_city); 219 }220 if (!empty($shipo_street)) {221 $package['destination']['address'] = sanitize_text_field($shipo_street);222 $package['destination']['shipo_address'] = sanitize_text_field($shipo_street);223 $package['destination']['address_1'] = sanitize_text_field($shipo_street);224 209 } 225 210 -
shipo/trunk/readme.txt
r3410852 r3415749 4 4 Requires at least: 4.7 5 5 Tested up to: 6.9 6 Stable tag: 1. 36 Stable tag: 1.4 7 7 Requires PHP: 8.0 8 8 License: GPLv2 or later … … 54 54 55 55 Showing all lockers 56 57 = 1.4 = 58 59 Checkout page improvements: 60 - Allows users to manually enter a street name in the free text field if the street is not found in the suggestions dropdown list -
shipo/trunk/shipo.php
r3410852 r3415749 3 3 * Plugin Name: Shipo 4 4 * Description: Shipo connects your webshop with top couriers instantly, no contract. Ship to address or locker, pay only when parcels are delivered. 5 * Version: 1. 35 * Version: 1.4 6 6 * Author: Shipo 7 7 * Author URI: https://shipo.ro … … 16 16 17 17 // Define plugin constants 18 define('SHIPO_PLUGIN_VERSION', '1. 3.0');18 define('SHIPO_PLUGIN_VERSION', '1.4.0'); 19 19 define('SHIPO_PLUGIN_DIR', plugin_dir_path(__FILE__)); 20 20 define('SHIPO_PLUGIN_URL', plugin_dir_url(__FILE__));
Note: See TracChangeset
for help on using the changeset viewer.