Changeset 2626876
- Timestamp:
- 11/09/2021 05:22:57 PM (4 years ago)
- Location:
- bosta-woocommerce
- Files:
-
- 15 added
- 2 edited
-
tags/2.8 (added)
-
tags/2.8/Css (added)
-
tags/2.8/Css/main.css (added)
-
tags/2.8/assets (added)
-
tags/2.8/assets/images (added)
-
tags/2.8/assets/images/bosta.svg (added)
-
tags/2.8/assets/images/refresh.png (added)
-
tags/2.8/assets/images/refreshIcon.png (added)
-
tags/2.8/bosta-woocommerce.php (added)
-
tags/2.8/components (added)
-
tags/2.8/components/pickups (added)
-
tags/2.8/components/pickups/pickups.css (added)
-
tags/2.8/components/pickups/pickups.php (added)
-
tags/2.8/readme.txt (added)
-
tags/2.8/uninstall.php (added)
-
trunk/bosta-woocommerce.php (modified) (13 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bosta-woocommerce/trunk/bosta-woocommerce.php
r2593937 r2626876 5 5 * Author: Bosta 6 6 * Author URI: https://www.bosta.co/ 7 * Version: 2. 77 * Version: 2.8 8 8 * Requires at least: 5.0 9 9 * Tested up to: 5.7 … … 42 42 echo "<script>alert('Something went wrong: $error_message')</script>"; 43 43 } else { 44 $result = json_decode($result['body']); 45 $resultCities = array(); 46 for ($i = 0; $i < count($result); $i++) { 47 $resultCities[$i] = get_locale() === 'ar' ? $result[$i]->nameAr : $result[$i]->name; 44 if ($result['response']['code'] !== 200) { 45 $resultCities = []; 46 } else { 47 $result = json_decode($result['body']); 48 $resultCities = array(); 49 for ($i = 0; $i < count($result); $i++) { 50 $resultCities[$i] = get_locale() === 'ar' ? $result[$i]->nameAr : $result[$i]->name; 51 } 48 52 } 49 53 return $resultCities; … … 66 70 echo "<script>alert('Something went wrong: $error_message')</script>"; 67 71 } else { 72 if ($states['response']['code'] !== 200) { 73 $states= []; 74 } else { 68 75 $states = json_decode($states['body']); 69 76 for ($i = 0; $i < count($states); $i++) { 70 77 $resultStates[$i] = $states[$i]->districts; 71 78 } 72 $states=$resultStates; 79 $states = $resultStates; 80 } 73 81 return $states; 74 82 } … … 81 89 { 82 90 global $resultCities; 83 for($i = 0; $i < count($resultCities); $i++) 84 { 91 for ($i = 0; $i < count($resultCities); $i++) { 85 92 $resultCities[$i] = __($resultCities[$i], 'wps'); 86 93 } 87 94 88 95 $city_args = wp_parse_args(array( 89 96 'type' => 'select', … … 112 119 global $resultCities; 113 120 $states = $resultStates; 114 for($i = 0; $i < count($resultStates); $i++) 115 { 121 for ($i = 0; $i < count($resultStates); $i++) { 116 122 $resultStates[$i] = __($resultStates[$i], 'wps'); 117 123 } … … 147 153 } 148 154 } 149 155 150 156 }); 151 157 … … 174 180 $fields['city']['type'] = 'select'; 175 181 global $resultCities; 176 $cities=array(); 177 for($i = 0; $i < count($resultCities); $i++) 178 { 179 $cities[$resultCities[$i]] = $resultCities[$i]; 180 } 181 $fields['city']['options'] = $cities; 182 $cities = array(); 183 for ($i = 0; $i < count($resultCities); $i++) { 184 $cities[$resultCities[$i]] = $resultCities[$i]; 185 } 186 $fields['city']['options'] = $cities; 182 187 $fields['city']['class'] = 'short'; 183 188 return $fields; … … 279 284 $states = $resultStates; 280 285 281 for($i = 0; $i < count($resultStates); $i++) 282 { 286 for ($i = 0; $i < count($resultStates); $i++) { 283 287 $states[$i] = __($resultStates[$i], 'wps'); 284 288 } 285 289 286 290 $options_a = $states; 287 291 $required = esc_attr__('required', 'woocommerce'); … … 301 305 index+=opa[i].flat().length 302 306 } 303 307 304 308 var options = ''; 305 309 $.each( opt, function( key, value ){ … … 415 419 } 416 420 417 418 421 add_filter('handle_bulk_actions-edit-shop_order', 'sync_bosta_handle', 10, 3); 419 422 function sync_bosta_handle($redirect_to, $action, $order_ids) … … 444 447 $desc = 'Products: '; 445 448 $itemsQuantity = 0; 446 $descWithSku ='';449 $descWithSku = ''; 447 450 foreach ($items as $item_id => $item_data) { 448 451 $product = $item_data->get_product(); 449 452 $product_name = $product->get_name(); 450 $item_quantity = $item_data->get_quantity();451 $itemsQuantity +=$item_data->get_quantity();453 $item_quantity = $item_data->get_quantity(); 454 $itemsQuantity += $item_data->get_quantity(); 452 455 $desc .= $product_name . '(' . $item_quantity . ') '; 453 456 $product_sku = $product->get_sku(); … … 490 493 ->receiver->lastName = $order 491 494 ->shipping->last_name; 492 if (count($order->meta_data) >0 &&$order->meta_data[0]->key == '_shipping_phone') {495 if (count($order->meta_data) > 0 && $order->meta_data[0]->key == '_shipping_phone') { 493 496 $newOrder 494 497 ->receiver->phone = $order->meta_data[0]->value; … … 520 523 $shippingZoneName = $result[0]; 521 524 $shippingCityName = $order 522 ->shipping523 ->city;525 ->shipping 526 ->city; 524 527 $newOrder 525 528 ->dropOffAddress->districtName = $shippingDistrictName; -
bosta-woocommerce/trunk/readme.txt
r2593937 r2626876 7 7 Requires PHP: 7.0 8 8 Tested up to: 5.7 9 Stable tag: 2. 79 Stable tag: 2.8 10 10 WC requires at least: 2.6 11 11 WC tested up to: 4.4.1 … … 117 117 = 2.7 = 118 118 * Fix PickupLocaion 119 120 = 2.8 = 121 * Handle plugin when server is down.
Note: See TracChangeset
for help on using the changeset viewer.