Changeset 3082893
- Timestamp:
- 05/08/2024 01:21:32 AM (23 months ago)
- Location:
- shipbubble
- Files:
-
- 45 added
- 3 edited
-
tags/2.4 (added)
-
tags/2.4/admin (added)
-
tags/2.4/admin/css (added)
-
tags/2.4/admin/css/styles-wc.css (added)
-
tags/2.4/admin/index.php (added)
-
tags/2.4/admin/js (added)
-
tags/2.4/admin/js/ajax-create-shipment.js (added)
-
tags/2.4/admin/js/ajax-validate-address.js (added)
-
tags/2.4/admin/js/ajax-validate-auth.js (added)
-
tags/2.4/admin/woocommerce (added)
-
tags/2.4/admin/woocommerce/async-create-shipment.php (added)
-
tags/2.4/admin/woocommerce/async-validate-address.php (added)
-
tags/2.4/admin/woocommerce/enqueue-styles.php (added)
-
tags/2.4/admin/woocommerce/orders.php (added)
-
tags/2.4/admin/woocommerce/shipping-settings.php (added)
-
tags/2.4/admin/wordpress (added)
-
tags/2.4/admin/wordpress/async-validate-auth.php (added)
-
tags/2.4/admin/wordpress/index.php (added)
-
tags/2.4/admin/wordpress/settings-callback.php (added)
-
tags/2.4/admin/wordpress/settings-field-validation.php (added)
-
tags/2.4/admin/wordpress/settings-menu.php (added)
-
tags/2.4/admin/wordpress/settings-page.php (added)
-
tags/2.4/admin/wordpress/settings-register.php (added)
-
tags/2.4/includes (added)
-
tags/2.4/includes/constants.php (added)
-
tags/2.4/includes/core-methods.php (added)
-
tags/2.4/includes/endpoints.php (added)
-
tags/2.4/includes/index.php (added)
-
tags/2.4/index.php (added)
-
tags/2.4/languages (added)
-
tags/2.4/languages/index.php (added)
-
tags/2.4/license.txt (added)
-
tags/2.4/public (added)
-
tags/2.4/public/async-checkout-couriers.php (added)
-
tags/2.4/public/css (added)
-
tags/2.4/public/css/styles-wc.css (added)
-
tags/2.4/public/js (added)
-
tags/2.4/public/js/couriers-on-checkout.js (added)
-
tags/2.4/public/js/sweetalert2.min.js (added)
-
tags/2.4/public/woocommerce (added)
-
tags/2.4/public/woocommerce/checkout.php (added)
-
tags/2.4/public/woocommerce/enqueue-styles.php (added)
-
tags/2.4/readme.txt (added)
-
tags/2.4/shipbubble.php (added)
-
tags/2.4/uninstall.php (added)
-
trunk/admin/woocommerce/orders.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/shipbubble.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shipbubble/trunk/admin/woocommerce/orders.php
r3003454 r3082893 19 19 20 20 $serializedShipment = get_post_meta($order_id, 'shipbubble_shipment_details')[0]; 21 22 if (strlen($shipbubbleOrderId) < 1 && !shipbubble_data_is_serialized($serializedShipment)) { 21 $style = "background-color: #000; color: #FFF; padding: 4px 16px; border: 1px solid #000; border-radius: 3px; cursor: not-allowed;"; 22 23 if (strlen($shipbubbleOrderId) < 1 && !shipbubble_data_is_serialized($serializedShipment)) 24 { 23 25 $msg = "Unable to process this order for shipment"; 24 26 $output = '<div id="message" class="notice notice-warning is-dismissible"> … … 31 33 echo $output; 32 34 33 echo '<button type="button" onclick="alert(\'' . $msg . '\')" title="' . $msg . '" style="background-color: #000; color: #FFF; padding: 4px 16px; border: 1px solid #000; border-radius: 3px; cursor: not-allowed;">35 echo '<button type="button" onclick="alert(\''. $msg . '\')" title="' . $msg . '" style="'.$style.'"> 34 36 Create Shipment via Shipbubble 35 37 </button>'; … … 39 41 $shipmentDetailsArray = unserialize($serializedShipment); 40 42 41 if ($shipmentDetailsArray === false) { 42 return; 43 } 44 43 if ($shipmentDetailsArray === false) 44 { 45 return; 46 } 47 45 48 // error_log(print_r($shipmentDetailsArray, true)); 46 49 if (!count($shipmentDetailsArray)) { … … 53 56 // Get Shipping Data 54 57 $shippingData = $order->data['shipping']; 58 $shippingPhone = $order->data['billing']['phone']; 55 59 $orderAddress = sb_create_address($shippingData['address_1'], $shippingData['city'], $shippingData['state'], $shippingData['country']); 60 $orderPhone = get_post_meta($order_id, 'shipbubble_delivery_phone', true); 61 62 if (empty($orderPhone)) { 63 $orderPhone = $shippingPhone; 64 update_post_meta($order_id, 'shipbubble_delivery_phone', $orderPhone); 65 } 56 66 57 67 // Get Delivery Address 58 68 $shipbubbleDeliveryAddress = get_post_meta($order_id, 'shipbubble_delivery_address', true); 59 69 60 70 // serialize shipment 61 71 $serializedShipment = serialize($shipmentDetailsArray); … … 71 81 //if (strlen($shipbubbleOrderId) < 1 && !sb_compare_addresses($shipbubbleDeliveryAddress, $orderAddress) && $hrsInterval < SHIPBUBBLE_REQUEST_TOKEN_EXPIRY && !is_null($shipment)) { 72 82 73 // set flag to regenerate token 74 $regenerateToken = false; 75 $reason = ''; 76 77 // Check token has expired and shipbubble id doesn't exist to enable flag 78 if (strlen($shipbubbleOrderId) < 1 && $hrsInterval > SHIPBUBBLE_REQUEST_TOKEN_EXPIRY) { 79 $regenerateToken = true; 80 $reason = 'TOKEN_EXPIRED'; 81 } 82 83 // Check address has changed under 48hrs to enable flag 84 if (!sb_compare_addresses($shipbubbleDeliveryAddress, $orderAddress) && $hrsInterval < SHIPBUBBLE_REQUEST_TOKEN_EXPIRY) { 85 $regenerateToken = true; 86 $reason = 'ADDRESS_CHANGED'; 87 } 88 89 if ($regenerateToken && !is_null($shipment)) { 90 // regenerate token 91 $regeneratedMeta = shipbubble_regenerate_rate_token($order, $shipment, $reason); 92 93 // update db 94 if (count($regeneratedMeta) && isset($regeneratedMeta['request_token'])) { 95 // set order id to meta 96 $regeneratedMeta['order_id'] = $order_id; 97 $serializedShipment = serialize($regeneratedMeta); 98 99 update_post_meta($order_id, 'shipbubble_shipment_details', $serializedShipment); 100 update_post_meta($order_id, 'shipbubble_delivery_address', $orderAddress); 101 } else { 102 if (isset($regeneratedMeta['errors'])) { 103 $message = $regeneratedMeta["errors"] . ' when regenerating shipbubble token'; 104 $output = '<div id="message" class="notice notice-warning is-dismissible"> 105 <p>' . $message . '</p> 106 107 <button type="button" class="notice-dismiss"> 108 <span class="screen-reader-text">Dismiss this notice.</span> 109 </button> 110 </div>'; 111 112 echo $output; 113 } 114 } 83 $disable = false; 84 $disabled = ""; 85 86 87 // Check address has changed or token has expired 88 if (!sb_compare_addresses($shipbubbleDeliveryAddress, $orderAddress) || $hrsInterval > SHIPBUBBLE_REQUEST_TOKEN_EXPIRY || $orderPhone != $shippingPhone) 89 { 90 $disable = true; 91 $disabled = "disabled='disabled'"; 92 } 93 94 95 if (!$disable) { 96 $style = "background-color: #FF5170; color: #FFF; padding: 4px 16px; border: 1px solid #FF5170; border-radius: 3px; cursor: pointer;"; 115 97 } 116 98 117 99 ?> 118 <?php if (strlen($shipbubbleOrderId) < 1 && !is_null($shipment)) : ?>100 <?php if (strlen($shipbubbleOrderId) < 1 && !is_null($shipment)): ?> 119 101 <input type="hidden" id="wc_order_id" name="wc_order_id" value='<?php echo esc_html($order->get_id()); ?>' /> 120 102 121 <button id="create-shipment" style=" background-color: #FF5170; color: #FFF; padding: 4px 16px; border: 1px solid #FF5170; border-radius: 3px; cursor: pointer;">103 <button id="create-shipment" style="<?php echo $style?>" <?php echo $disabled ?>> 122 104 Create Shipment via Shipbubble 123 105 </button> -
shipbubble/trunk/readme.txt
r3080029 r3082893 5 5 Requires at least: 4.0 6 6 Tested up to: 6.3 7 Stable tag: 2. 37 Stable tag: 2.4 8 8 Requires PHP: 5.6 9 9 License: GPLv3 or later … … 51 51 52 52 == Changelog == 53 = 0.1 = 54 * Initial release. 53 = 2.4 = 54 * Critical checkoutand backend dashboard fixes 55 56 = 2.3 = 57 * Handle plugin incompatibility for woocommerce block pages 58 59 = 2.2.1 = 60 * Small fix for multicurrency store symbol 61 62 = 2.2 = 63 * Fix scenario for customers checking out without paying for delivery 64 65 = 2.1 = 66 * Support for multi currency checkout 67 68 = 2.0.2 = 69 * Bug fix for pickup option on checkout 70 71 = 2.0.1 = 72 * Bug fix for pickup option on checkout 73 74 = 2.0 = 75 * Support for non physical goods at checkout. 76 77 = 1.9 = 78 * Important checkout UX Fix - handling when user edits checkout details. 79 80 = 1.8 = 81 * Fixes & Improvements 82 83 = 1.7.2 = 84 * Admin process shipment bug fix. 85 86 = 1.7.1 = 87 * Fixed checkout bug for other shipping methods (if available). 88 89 = 1.7 = 90 * Dimension sorting for DHL packages, Fixed some more bugs. 91 92 = 1.6 = 93 * Fixed orders page error for other shipping methods. 94 95 = 1.5 = 96 * Disable other shipping options option. 97 98 = 1.4 = 99 * set selected shipbubble option as checkout shipping option. 100 101 = 1.3 = 102 * Critical checkout support fix. 103 104 = 1.1 = 105 * International shipping support. 106 107 = 1.0.3 = 108 * Minor fixes. 109 110 = 1.0.2 = 111 * Cater for non physical goods. 55 112 56 113 = 1.0.1 = 57 114 * Rate card design fix. 58 115 59 = 1.0.2 = 60 * Cater for non physical goods. 61 62 = 1.0.3 = 63 * Minor fixes. 64 65 = 1.1 = 66 * International shipping support. 67 68 = 1.3 = 69 * Critical checkout support fix. 70 71 = 1.4 = 72 * set selected shipbubble option as checkout shipping option. 73 74 = 1.5 = 75 * Disable other shipping options option. 76 77 = 1.6 = 78 * Fixed orders page error for other shipping methods. 79 80 = 1.7 = 81 * Dimension sorting for DHL packages, Fixed some more bugs. 82 83 = 1.7.1 = 84 * Fixed checkout bug for other shipping methods (if available). 85 86 = 1.7.2 = 87 * Admin process shipment bug fix. 88 89 = 1.8 = 90 * Fixes & Improvements 91 92 = 1.9 = 93 * Important checkout UX Fix - handling when user edits checkout details. 94 95 = 2.0 = 96 * Support for non physical goods at checkout. 97 98 = 2.0.1 = 99 * Bug fix for pickup option on checkout 100 101 = 2.0.2 = 102 * Bug fix for pickup option on checkout 103 104 = 2.1 = 105 * Support for multi currency checkout 106 107 = 2.2 = 108 * Fix scenario for customers checking out without paying for delivery 109 110 = 2.2.1 = 111 * Small fix for multicurrency store symbol 112 113 = 2.3 = 114 * Handle plugin incompatibility for woocommerce block pages 116 = 0.1 = 117 * Initial release. 115 118 116 119 == Upgrade Notice == 117 = 2. 3=118 Handle plugin incompatibility for woocommerce block pages120 = 2.4 = 121 Critical checkout and backend dashboard fixes -
shipbubble/trunk/shipbubble.php
r3080029 r3082893 8 8 * Tags: logistics, deliveries, shipping rates, multiple couriers, post purchase experience 9 9 * Requires at least: 4.0 10 * Tested up to: 6. 311 * Version: 2. 310 * Tested up to: 6.1 11 * Version: 2.4 12 12 * Requires PHP: 5.6 13 13 * Text Domain: shipbubble … … 212 212 $stateTag = sanitize_text_field($_POST['shipping_state']); 213 213 $countryTag = sanitize_text_field($_POST['shipping_country']); 214 $phone = sanitize_text_field($_POST['billing_phone']); 214 215 215 216 if (strlen($streetAddress) < 1) { … … 263 264 // setting the delivery address 264 265 update_post_meta($order_id, 'shipbubble_delivery_address', $address); 266 267 // setting the phone number 268 update_post_meta($order_id, 'shipbubble_delivery_phone', $phone); 265 269 } 266 270 } … … 268 272 269 273 // add_action( 'woocommerce_checkout_order_processed', 'handle_processed', 10, 1 ); 270 // function handle_processed($order_id) 274 // function handle_processed($order_id) 271 275 // { 272 276 // $order = new WC_Order( $order_id ); … … 337 341 338 342 add_action( 'woocommerce_before_checkout_process', 'shipbubble_validate_checkout_order' , 10, 1 ); 343 add_action( 'woocommerce_checkout_order_processed', 'shipbubble_validate_checkout_order', 10, 1 ); 339 344 function shipbubble_validate_checkout_order($order_id) 340 345 {
Note: See TracChangeset
for help on using the changeset viewer.