Changeset 2738570
- Timestamp:
- 06/07/2022 11:16:10 AM (4 years ago)
- Location:
- bosta-woocommerce
- Files:
-
- 15 added
- 4 edited
-
bosta-woocommerce.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
tags/2.9.1 (added)
-
tags/2.9.1/Css (added)
-
tags/2.9.1/Css/main.css (added)
-
tags/2.9.1/assets (added)
-
tags/2.9.1/assets/images (added)
-
tags/2.9.1/assets/images/bosta.svg (added)
-
tags/2.9.1/assets/images/refresh.png (added)
-
tags/2.9.1/assets/images/refreshIcon.png (added)
-
tags/2.9.1/bosta-woocommerce.php (added)
-
tags/2.9.1/components (added)
-
tags/2.9.1/components/pickups (added)
-
tags/2.9.1/components/pickups/pickups.css (added)
-
tags/2.9.1/components/pickups/pickups.php (added)
-
tags/2.9.1/readme.txt (added)
-
tags/2.9.1/uninstall.php (added)
-
trunk/bosta-woocommerce.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bosta-woocommerce/bosta-woocommerce.php
r2704571 r2738570 7 7 * Version: 2.9 8 8 * Requires at least: 5.0 9 * Tested up to: 5. 79 * Tested up to: 5.8.3 10 10 * WC requires at least: 2.6 11 11 * WC tested up to: 4.4.1 -
bosta-woocommerce/readme.txt
r2704571 r2738570 6 6 Requires at least: 5.0 7 7 Requires PHP: 7.0 8 Tested up to: 5. 79 Stable tag: 2.9 8 Tested up to: 5.8.3 9 Stable tag: 2.9.1 10 10 WC requires at least: 2.6 11 11 WC tested up to: 4.4.1 … … 126 126 = 2.9 = 127 127 * Update cities/areas in KSA. 128 129 = 2.9.1 = 130 * Handle cities/areas when network is down. -
bosta-woocommerce/trunk/bosta-woocommerce.php
r2704571 r2738570 5 5 * Author: Bosta 6 6 * Author URI: https://www.bosta.co/ 7 * Version: 2.9 7 * Version: 2.9.1 8 8 * Requires at least: 5.0 9 * Tested up to: 5. 79 * Tested up to: 5.8.3 10 10 * WC requires at least: 2.6 11 11 * WC tested up to: 4.4.1 … … 21 21 22 22 add_action('admin_print_styles', 'bosta_stylesheet'); 23 24 function console_log($output, $with_script_tags = true) { 25 $js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) . 26 ');'; 27 if ($with_script_tags) { 28 $js_code = '<script>' . $js_code . '</script>'; 29 } 30 echo $js_code; 31 } 32 23 33 function bosta_stylesheet() 24 34 { … … 29 39 function get_new_cities() 30 40 { 31 $result = wp_remote_post('https://app.bosta.co/api/v0/cities?context=dropoff', array( 41 $APIKey = get_option('woocommerce_bosta_settings')['APIKey']; 42 // $APIKey = md5('606ead9eaeace1ab89ad10181b68ea391a518f48fb3d52516c0c6ec343e87611'); 43 $url = 'https://app.bosta.co/api/v0/businesses/' . $APIKey. '/info'; 44 $business_result = wp_remote_get($url, array( 32 45 'timeout' => 30, 46 'method' => 'GET', 47 'headers' => array( 48 'Content-Type' => 'application/json', 49 'X-Requested-By' => 'WooCommerce', 50 ), 51 )); 52 if (is_wp_error($business_result) || $business_result['response']['code'] !== 200) { 53 $countryId = "60e4482c7cb7d4bc4849c4d5"; 54 } else { 55 $business = json_decode($business_result['body']); 56 $countryId = $business->country->_id; 57 } 58 59 $cities_url = 'https://app.bosta.co/api/v0/cities?context=dropoff&countryId=' . $countryId; 60 // $cities_url = 'https://app.bosta.co/api/v0/cities?context=dropoff'; 61 $result = wp_remote_post($cities_url, array( 62 'timeout' => 30, 33 63 'method' => 'GET', 34 64 'headers' => array( … … 38 68 ), 39 69 )); 70 40 71 if (is_wp_error($result)) { 41 72 $error_message = $result->get_error_message(); … … 56 87 function get_new_states() 57 88 { 58 $states = wp_remote_post('https://app.bosta.co/api/v0/cities/getAllDistricts?context=dropoff', array( 89 $APIKey = get_option('woocommerce_bosta_settings')['APIKey']; 90 $url = 'https://app.bosta.co/api/v0/businesses/' . $APIKey. '/info'; 91 $business_result = wp_remote_get($url, array( 92 'timeout' => 30, 93 'method' => 'GET', 94 'headers' => array( 95 'Content-Type' => 'application/json', 96 'X-Requested-By' => 'WooCommerce', 97 ), 98 )); 99 100 if (is_wp_error($business_result) || $business_result['response']['code'] !== 200) { 101 $countryId = "60e4482c7cb7d4bc4849c4d5"; 102 } else { 103 $business = json_decode($business_result['body']); 104 $countryId = $business->country->_id; 105 } 106 107 $states_url = 'https://app.bosta.co/api/v0/cities/getAllDistricts?context=dropoff&countryId=' . $countryId; 108 109 $states = wp_remote_post($states_url, array( 59 110 'timeout' => 30, 60 111 'method' => 'GET', … … 82 133 } 83 134 } 135 $resultCities = get_new_cities(); 84 136 $resultStates = get_new_states(); 85 $resultCities = get_new_cities();86 137 87 138 add_filter('woocommerce_checkout_fields', 'bost_override_checkout_city_fields'); … … 119 170 global $resultCities; 120 171 $states = $resultStates; 121 for ($i = 0; $i < count( $resultStates); $i++) {172 for ($i = 0; $i < count(array($resultStates)); $i++) { 122 173 $resultStates[$i] = __($resultStates[$i], 'wps'); 123 174 } … … 194 245 global $resultStates; 195 246 $bostaStates = array(); 196 for ($i = 0; $i < count( $resultStates); $i++) {197 for ($x = 0; $x < count( $resultStates[$i]); $x++) {247 for ($i = 0; $i < count(array($resultStates)); $i++) { 248 for ($x = 0; $x < count(array($resultStates[$i])); $x++) { 198 249 $new_val = $resultStates[$i][$x]->zoneName . ' - ' . $resultStates[$i][$x]->districtName; 199 250 array_push($bostaStates, $new_val); -
bosta-woocommerce/trunk/readme.txt
r2704571 r2738570 6 6 Requires at least: 5.0 7 7 Requires PHP: 7.0 8 Tested up to: 5. 79 Stable tag: 2.9 8 Tested up to: 5.8.3 9 Stable tag: 2.9.1 10 10 WC requires at least: 2.6 11 11 WC tested up to: 4.4.1 … … 126 126 = 2.9 = 127 127 * Update cities/areas in KSA. 128 129 = 2.9.1 = 130 * Handle cities/areas when network is down.
Note: See TracChangeset
for help on using the changeset viewer.