Changeset 2973326
- Timestamp:
- 09/30/2023 12:01:48 PM (2 years ago)
- Location:
- shipbubble
- Files:
-
- 45 added
- 4 edited
-
tags/1.6 (added)
-
tags/1.6/admin (added)
-
tags/1.6/admin/css (added)
-
tags/1.6/admin/css/styles-wc.css (added)
-
tags/1.6/admin/index.php (added)
-
tags/1.6/admin/js (added)
-
tags/1.6/admin/js/ajax-create-shipment.js (added)
-
tags/1.6/admin/js/ajax-validate-address.js (added)
-
tags/1.6/admin/js/ajax-validate-auth.js (added)
-
tags/1.6/admin/woocommerce (added)
-
tags/1.6/admin/woocommerce/async-create-shipment.php (added)
-
tags/1.6/admin/woocommerce/async-validate-address.php (added)
-
tags/1.6/admin/woocommerce/enqueue-styles.php (added)
-
tags/1.6/admin/woocommerce/orders.php (added)
-
tags/1.6/admin/woocommerce/shipping-settings.php (added)
-
tags/1.6/admin/wordpress (added)
-
tags/1.6/admin/wordpress/async-validate-auth.php (added)
-
tags/1.6/admin/wordpress/index.php (added)
-
tags/1.6/admin/wordpress/settings-callback.php (added)
-
tags/1.6/admin/wordpress/settings-field-validation.php (added)
-
tags/1.6/admin/wordpress/settings-menu.php (added)
-
tags/1.6/admin/wordpress/settings-page.php (added)
-
tags/1.6/admin/wordpress/settings-register.php (added)
-
tags/1.6/includes (added)
-
tags/1.6/includes/constants.php (added)
-
tags/1.6/includes/core-methods.php (added)
-
tags/1.6/includes/endpoints.php (added)
-
tags/1.6/includes/index.php (added)
-
tags/1.6/index.php (added)
-
tags/1.6/languages (added)
-
tags/1.6/languages/index.php (added)
-
tags/1.6/license.txt (added)
-
tags/1.6/public (added)
-
tags/1.6/public/async-checkout-couriers.php (added)
-
tags/1.6/public/css (added)
-
tags/1.6/public/css/styles-wc.css (added)
-
tags/1.6/public/js (added)
-
tags/1.6/public/js/couriers-on-checkout.js (added)
-
tags/1.6/public/js/sweetalert2.min.js (added)
-
tags/1.6/public/woocommerce (added)
-
tags/1.6/public/woocommerce/checkout.php (added)
-
tags/1.6/public/woocommerce/enqueue-styles.php (added)
-
tags/1.6/readme.txt (added)
-
tags/1.6/shipbubble.php (added)
-
tags/1.6/uninstall.php (added)
-
trunk/admin/woocommerce/orders.php (modified) (8 diffs)
-
trunk/public/css/styles-wc.css (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/shipbubble.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
shipbubble/trunk/admin/woocommerce/orders.php
r2972632 r2973326 8 8 } 9 9 10 // Verify Shipbubble Order 11 if (!$order->has_shipping_method(SHIPBUBBLE_ID)) { 12 return; 13 } 14 15 $shipmentDetailsArray = get_post_meta($order->get_id(), 'shipbubble_shipment_details'); 16 // error_log(print_r($shipmentDetailsArray, true)); 17 if (!count($shipmentDetailsArray)) { 18 return; 19 } 20 21 // Get Shipping Data 10 22 $shippingData = $order->data['shipping']; 11 23 $orderAddress = sb_create_address($shippingData['address_1'], $shippingData['city'], $shippingData['state'], $shippingData['country']); … … 18 30 // die; 19 31 32 // Get Delivery Address 20 33 $shipbubbleDeliveryAddress = get_post_meta($order->get_id(), 'shipbubble_delivery_address', true); 21 34 35 // Get Shipbubble Order ID 22 36 $shipbubbleOrderId = get_post_meta($order->get_id(), 'shipbubble_order_id', true); 23 37 24 if (!count(get_post_meta($order->get_id(), 'shipbubble_shipment_details'))) { 25 return; 26 } 27 28 $shipment = get_post_meta($order->get_id(), 'shipbubble_shipment_details')[0]; 29 38 $shipment = $shipmentDetailsArray[0]; // [0 => 'request token ...'] 30 39 31 40 // $serviceCode = array( 'speedaf-express' ); // test … … 64 73 } 65 74 66 $orderShippingMethodId = reset($order->get_items('shipping'))->get_method_id();67 68 75 ?> 69 <?php if (strlen($shipbubbleOrderId) < 1 && !is_null($shipment) && (strtolower($orderShippingMethodId) === strtolower(SHIPBUBBLE_ID))) : ?>76 <?php if (strlen($shipbubbleOrderId) < 1 && !is_null($shipment)) : ?> 70 77 <input type="hidden" id="wc_order_id" name="wc_order_id" value='<?php echo esc_html($order->get_id()); ?>' /> 71 78 … … 81 88 82 89 83 add_filter('manage_edit-shop_order_columns', 'shipbubble_custom_order_column', 20);90 add_filter('manage_edit-shop_order_columns', 'shipbubble_custom_order_column', 10); 84 91 function shipbubble_custom_order_column($columns) 85 92 { … … 90 97 if ($key == 'order_status') { 91 98 // Inserting after STATUS Column 92 $reorderedColumns['sb_shipping_status'] = esc_html('Ship bubbleStatus');99 $reorderedColumns['sb_shipping_status'] = esc_html('Shipping Status'); 93 100 } 94 101 } … … 97 104 } 98 105 99 // Adding custom fields meta data for each new Column 100 add_action('manage_shop_order_posts_custom_column', 'custom_orders_list_column_content', 20, 2); 101 function custom_orders_list_column_content($column, $post_id) 102 { 103 $order = wc_get_order($post_id); 104 $orderShippingMethod = $order->get_items('shipping'); 105 $orderShippingMethodId = ''; 106 107 switch ($column) { 108 case 'sb_shipping_status': 109 if (is_array($orderShippingMethod)) { 110 $orderShippingMethodId = reset($orderShippingMethod)->get_method_id(); 106 add_action('manage_shop_order_posts_custom_column', 'shipbubble_shipping_status_column_content'); 107 function shipbubble_shipping_status_column_content($column) 108 { 109 global $post; 110 111 // Verify Column ID 112 if ('sb_shipping_status' === $column) { 113 // Get Order 114 $order = new WC_Order($post->ID); 115 116 // Conditional function based on the Order shipping method 117 if ($order->has_shipping_method(SHIPBUBBLE_ID)) { 118 // Check Shipping Status 119 $status = get_post_meta($post->ID, 'shipbubble_tracking_status', true); 120 if (!empty($status)) { 121 echo shipbubble_shipment_status_label($status); 122 } elseif (in_array($order->get_status(), SHIPBUBBLE_WC_BAD_ORDER_STATUS_ARR)) { 123 echo '<mark class="order-status status-on-hold"> 124 <span>No shipment initiated</span> 125 </mark>'; 126 } else { 127 echo '<mark class="order-status status-on-hold"> 128 <span>No shipment yet</span> 129 </mark>'; 111 130 } 112 113 if (!empty($orderShippingMethodId) && strtolower($orderShippingMethodId) === strtolower(SHIPBUBBLE_ID)) { 114 $status = get_post_meta($post_id, 'shipbubble_tracking_status', true); 115 if (!empty($status)) { 116 echo shipbubble_shipment_status_label($status); 117 } elseif (in_array($order->get_status(), SHIPBUBBLE_WC_BAD_ORDER_STATUS_ARR)) { 118 echo '<mark class="order-status status-on-hold"> 119 <span>No shipment initiated</span> 120 </mark>'; 121 } else { 122 echo '<mark class="order-status status-on-hold"> 123 <span>No shipment yet</span> 124 </mark>'; 125 } 126 } elseif (!empty($orderShippingMethodId)) { 127 echo esc_html($order->get_shipping_method()); 128 } else { 129 echo esc_html('Not Specified'); 130 } 131 132 break; 131 } elseif (!$order->has_shipping_method(SHIPBUBBLE_ID)) { 132 echo 'N/A'; 133 } else { 134 echo esc_html('Not specified'); 135 } 133 136 } 134 137 } … … 244 247 // $shipbubbleOrderId = get_post_meta( $order->get_id(), 'shipping_total', true ); 245 248 246 if (in_array($order->get_status(), SHIPBUBBLE_WC_BAD_ORDER_STATUS_ARR)) 247 return; 249 if (in_array($order->get_status(), SHIPBUBBLE_WC_BAD_ORDER_STATUS_ARR)) { 250 return; 251 } 252 253 // Verify Shipbubble Order 254 if (!$order->has_shipping_method(SHIPBUBBLE_ID)) { 255 return; 256 } 248 257 249 258 if (!count(get_post_meta($order->get_id(), 'shipbubble_shipment_details'))) { … … 251 260 } 252 261 253 $orderShippingMethodId = reset($order->get_items('shipping'))->get_method_id(); 254 255 if (strtolower($orderShippingMethodId) === strtolower(SHIPBUBBLE_ID)) { 256 $shipbubbleOrderId = get_post_meta($order->get_id(), 'shipbubble_order_id', true); 257 258 if (strlen($shipbubbleOrderId) < 1) { 259 $response = shipbubble_get_wallet_balance(shipbubble_get_token()); 260 261 if (isset($response->response_code) && $response->response_code == SHIPBUBBLE_RESPONSE_IS_OK) { 262 $balance = $response->data->balance; 263 } 264 265 echo '<input type="hidden" id="shipbubble_shipping_cost" name="shipbubble_shipping_cost" value="' . esc_html((float) $order->shipping_total) . '"/>'; 266 267 echo '<input type="hidden" id="shipbubble_wallet_balance" name="shipbubble_wallet_balance" value="' . esc_html((float) $balance) . '"/>'; 268 269 echo '<p><strong>' . __('Shipbubble Wallet Balance:') . '</strong><br> <strong>' . esc_html($currency) . esc_html(number_format($balance, 2)) . '</strong></p>'; 270 } else { 271 echo '<p><strong>' . __('Shipbubble Order ID:') . '</strong><br> ' . esc_html($shipbubbleOrderId) . '</p>'; 272 } 273 } 274 } 262 $shipbubbleOrderId = get_post_meta($order->get_id(), 'shipbubble_order_id', true); 263 if (strlen($shipbubbleOrderId) < 1) { 264 $response = shipbubble_get_wallet_balance(shipbubble_get_token()); 265 266 if (isset($response->response_code) && $response->response_code == SHIPBUBBLE_RESPONSE_IS_OK) { 267 $balance = $response->data->balance; 268 } 269 270 echo '<input type="hidden" id="shipbubble_shipping_cost" name="shipbubble_shipping_cost" value="' . esc_html((float) $order->shipping_total) . '"/>'; 271 272 echo '<input type="hidden" id="shipbubble_wallet_balance" name="shipbubble_wallet_balance" value="' . esc_html((float) $balance) . '"/>'; 273 274 echo '<p><strong>' . __('Shipbubble Wallet Balance:') . '</strong><br> <strong>' . esc_html($currency) . esc_html(number_format($balance, 2)) . '</strong></p>'; 275 } else { 276 echo '<p><strong>' . __('Shipbubble Order ID:') . '</strong><br> ' . esc_html($shipbubbleOrderId) . '</p>'; 277 } 278 } -
shipbubble/trunk/public/css/styles-wc.css
r2922553 r2973326 1 .container-card>button {2 background: #D83854;3 outline: none;4 border-radius: 8px;5 border: none;6 box-shadow: none;7 cursor: pointer;8 padding: 10px 16px;9 10 margin-bottom: 24px;11 }12 13 .container-delivery-card-list-item:last-of-type {14 margin: 0;15 }16 17 .container-card>button>p {18 font-weight: 400;19 font-size: 16px;20 line-height: 20px;21 margin: 0;22 color: #FFFFFF;23 }24 25 .container-delivery-card {26 background: white;27 width: 100%;28 max-width: 549px;29 border-radius: 12px30 }31 32 .container-delivery-card-header {33 display: flex;34 margin-bottom: 24px;35 justify-content: space-between;36 align-items: center;37 }38 39 .container-delivery-card-header>p {40 font-weight: 700;41 font-size: 16px;42 line-height: 24px;43 color: #000000;44 margin: 0;45 }46 47 .sb-slogan-container {48 display: flex;49 align-items: center;50 justify-content: center;51 margin-top: 12px;52 }53 54 .sb-slogan {55 display: inline-flex;56 text-decoration: none !important;57 border-radius: 8px;58 padding: 8px 12px;59 align-items: center;60 cursor: pointer;61 }62 63 .sb-slogan>span {64 font-weight: 400;65 font-size: 11px;66 line-height: 16px;67 margin: 0;68 color: #000;69 margin-right: 8px;70 }71 72 .sb-slogan>img {73 max-height: 16px;74 }75 76 1 .container-card>button { 77 2 font-weight: 400; … … 85 10 padding: 10px 16px; 86 11 margin-bottom: 24px; 87 width: 170px;88 12 height: 40px; 13 outline: none; 14 cursor: pointer; 15 } 16 17 .container-delivery-card-list-item:last-of-type { 18 margin: 0; 19 } 20 21 .container-card>button>p { 22 font-weight: 400; 23 font-size: 16px; 24 line-height: 20px; 25 margin: 0; 26 color: #FFFFFF; 27 } 28 29 .container-delivery-card { 30 background: white; 31 width: 100%; 32 max-width: 549px; 33 border-radius: 12px 34 } 35 36 .container-delivery-card-header { 37 display: flex; 38 margin-bottom: 24px; 39 justify-content: space-between; 40 align-items: center; 41 } 42 43 .container-delivery-card-header>p { 44 font-weight: 700; 45 font-size: 16px; 46 line-height: 24px; 47 color: #000000; 48 margin: 0; 49 } 50 51 .sb-slogan-container { 52 display: flex; 53 align-items: center; 54 justify-content: center; 55 margin-top: 12px; 56 } 57 58 .sb-slogan { 59 display: inline-flex; 60 text-decoration: none !important; 61 border-radius: 8px; 62 padding: 8px 12px; 63 align-items: center; 64 cursor: pointer; 65 } 66 67 .sb-slogan>span { 68 font-weight: 400; 69 font-size: 11px; 70 line-height: 16px; 71 margin: 0; 72 color: #000; 73 margin-right: 8px; 74 } 75 76 .sb-slogan>img { 77 max-height: 16px; 89 78 } 90 79 -
shipbubble/trunk/readme.txt
r2972632 r2973326 5 5 Requires at least: 4.0 6 6 Tested up to: 6.3 7 Stable tag: 1. 5.17 Stable tag: 1.6 8 8 Requires PHP: 5.6 9 9 License: GPLv3 or later … … 75 75 * Disable other shipping options option. 76 76 77 = 1.6 = 78 * Fixed orders page error for other shipping methods. 79 77 80 == Upgrade Notice == 78 = 1. 3=79 Upgrade plugin to get fix on after payment checkout support 81 = 1.6 = 82 Fixed orders page error for other shipping methods -
shipbubble/trunk/shipbubble.php
r2972632 r2973326 9 9 * Requires at least: 4.0 10 10 * Tested up to: 6.3 11 * Version: 1. 5.111 * Version: 1.6 12 12 * Requires PHP: 5.6 13 13 * Text Domain: shipbubble
Note: See TracChangeset
for help on using the changeset viewer.