Changeset 2986171
- Timestamp:
- 10/30/2023 02:19:35 PM (2 years ago)
- Location:
- redbox-pickup
- Files:
-
- 5 edited
- 8 copied
-
tags/1.31 (copied) (copied from redbox-pickup/trunk)
-
tags/1.31/admin/config.php (copied) (copied from redbox-pickup/trunk/admin/config.php)
-
tags/1.31/admin/new_method.php (copied) (copied from redbox-pickup/trunk/admin/new_method.php)
-
tags/1.31/css/front.css (copied) (copied from redbox-pickup/trunk/css/front.css) (2 diffs)
-
tags/1.31/front/front.php (copied) (copied from redbox-pickup/trunk/front/front.php) (6 diffs)
-
tags/1.31/js/front.js (copied) (copied from redbox-pickup/trunk/js/front.js) (4 diffs)
-
tags/1.31/readme.txt (copied) (copied from redbox-pickup/trunk/readme.txt) (1 diff)
-
tags/1.31/redbox.php (copied) (copied from redbox-pickup/trunk/redbox.php) (2 diffs)
-
trunk/css/front.css (modified) (2 diffs)
-
trunk/front/front.php (modified) (6 diffs)
-
trunk/js/front.js (modified) (4 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/redbox.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
redbox-pickup/tags/1.31/css/front.css
r2678417 r2986171 89 89 height: auto; 90 90 border-radius: 3px; 91 display: flex; 92 height: 100%; 91 93 } 92 94 .list-point .per-point { … … 101 103 box-shadow: 0 4px 12px rgb(42 65 232 / 15%); 102 104 background: #fff; 103 height: 100%; 105 max-height: calc(100% - 20px); 106 margin: auto; 107 overflow: auto; 104 108 } 105 109 .list-point .per-point .step1{ -
redbox-pickup/tags/1.31/front/front.php
r2821828 r2986171 14 14 15 15 private function redbox_get_data_customer($order) { 16 $shippingFirstName = $order->get_shipping_first_name(); 17 $shippingLastName = $order->get_shipping_last_name(); 18 $shippingPhone = $order->get_shipping_phone(); 19 $shippingAddress = $order->get_shipping_address_1(); 20 16 21 $billingFirstName = $order->get_billing_first_name(); 17 22 $billingLastName = $order->get_billing_last_name(); 18 23 $billingPhone = $order->get_billing_phone(); 19 24 $billingEmail = $order->get_billing_email(); 25 $billingAddress = $order->get_billing_address_1(); 20 26 21 27 $data = [ 22 "name" => $ billingFirstName . ' ' . $billingLastName,23 'phone' => $ billingPhone,28 "name" => $shippingFirstName ? $shippingFirstName . ' ' . $shippingLastName : $billingFirstName . ' ' . $billingLastName, 29 'phone' => $shippingPhone ? $shippingPhone : $billingPhone, 24 30 'email' => $billingEmail, 25 'adddress' => $ order->get_billing_address_1()31 'adddress' => $shippingAddress ? $shippingAddress : $billingAddress 26 32 ]; 27 33 return $data; … … 122 128 } 123 129 124 function redbox_create_shipment( $order_id, $posted_data, $order ) { 130 function redbox_create_shipment( $order_id) { 131 $order = new WC_Order( $order_id ); 125 132 $note = 'Creating redbox shipments'; 126 133 $order->add_order_note( $note ); … … 138 145 "store_url" => get_home_url(), 139 146 "reference" => $order_id, 140 "point_id" => $ _POST['redbox_point_id'],147 "point_id" => $order->get_meta( '_redbox_point_id' ), 141 148 "customer_name" => $customerData['name'], 142 149 "customer_phone" => $customerData['phone'], … … 150 157 "from_platform" => "woo_commerce" 151 158 ]; 159 $dataShipment["is_paid"] = $order->is_paid(); 160 $dataShipment["get_payment_method"] = $order->get_payment_method(); 152 161 if ($order->get_payment_method() == "cod") { 153 $dataShipment['cod_amount'] = $priceData['order_total']; 154 $dataShipment['cod_currency'] = $priceData['curency']; 155 } else { 156 $dataShipment['cod_amount'] = 0; 157 $dataShipment['cod_currency'] = $priceData['curency']; 158 } 162 $dataShipment['cod_amount'] = $priceData['order_total']; 163 $dataShipment['cod_currency'] = $priceData['curency']; 164 } else { 165 if ($order->is_paid()) { 166 $dataShipment['cod_amount'] = 0; 167 $dataShipment['cod_currency'] = $priceData['curency']; 168 } else { 169 $dataShipment['cod_amount'] = 10; 170 $dataShipment['cod_currency'] = "USD"; 171 } 172 } 159 173 if ($this->redbox_validate_body_create_shipment($dataShipment)) { 160 174 $urlQuery = REDBOX_URL_CREATE_SHIPMENT; … … 296 310 297 311 function bbloomer_woocommerce_tiered_shipping( $rates, $package ) { 298 if ($this->minimumAmount == false) { 299 return $rates; 300 } 301 $total = WC()->cart->subtotal; 302 if ($total >= $this->minimumAmount) { 303 if ($rates["redbox_pickup_delivery"]) { 304 $rates["redbox_pickup_delivery"]->cost = 0; 305 $rates["redbox_pickup_delivery"]->taxes = 0; 306 } 307 } 308 return $rates; 312 // if ($this->minimumAmount == false) { 313 // return $rates; 314 // } 315 // $total = WC()->cart->subtotal; 316 // if ($total >= $this->minimumAmount) { 317 // if ($rates["redbox_pickup_delivery"]) { 318 // $rates["redbox_pickup_delivery"]->cost = 0; 319 // $rates["redbox_pickup_delivery"]->taxes = 0; 320 // } 321 // } 322 // return $rates; 323 $no_free_shipping_method = false; 324 if($no_free_shipping_method == true): 325 $new_rates = array(); 326 foreach ( $rates as $rate_id => $rate ) { 327 // Only modify rates if free_shipping is present. 328 if ( 'free_shipping' != $rate->method_id ) { 329 $new_rates[ $rate_id ] = $rate; 330 break; 331 } 332 } 333 else: 334 $new_rates = array(); 335 foreach ( $rates as $rate_id => $rate ) { 336 // Only modify rates if free_shipping is present. 337 if ( 'free_shipping' === $rate->method_id || 'redbox_pickup_delivery' === $rate->method_id) { 338 $new_rates[ $rate_id ] = $rate; 339 break; 340 } 341 } 342 endif; 343 344 345 if ( ! empty( $new_rates ) ) { 346 //Save local pickup if it's present. 347 foreach ( $rates as $rate_id => $rate ) { 348 if ('local_pickup' === $rate->method_id ) { 349 $new_rates[ $rate_id ] = $rate; 350 break; 351 } 352 } 353 return $new_rates; 354 } 355 356 return $rates; 309 357 } 310 358 … … 313 361 add_action('wp_ajax_getlispoint', array( $this, 'redbox_get_list_point' )); 314 362 add_action('wp_ajax_nopriv_getlispoint', array( $this, 'redbox_get_list_point' )); 315 add_action('woocommerce_ checkout_order_processed', array( $this, 'redbox_create_shipment' ), 10, 3);363 add_action('woocommerce_thankyou', array( $this, 'redbox_create_shipment' )); 316 364 add_action( 'woocommerce_after_checkout_billing_form', array($this, 'redbox_add_point_field') ); 317 365 -
redbox-pickup/tags/1.31/js/front.js
r2768963 r2986171 146 146 if (data.success) { 147 147 REDBOX_LIST_POINT = data.points 148 activeInputConfirm()149 148 drawMapInThis(data.points, lat, lng) 150 149 jQuery('.redbox-waiting-response').remove() … … 164 163 let LNG = 46.6752957 165 164 if (REDBOX_LIST_POINT.length) { 166 activeInputConfirm()167 165 drawMapInThis(REDBOX_LIST_POINT, LAT, LNG) 168 166 jQuery('.redbox-waiting-response').remove() … … 352 350 function reRenderMapWithPoint(lat, lng) { 353 351 var htmlWaiting = '<div class="redbox-waiting-response"><i class="fa fa-spinner fa-spin"></i></div>' 354 var bounds = new google.maps.LatLngBounds(); 355 bounds.extend(new google.maps.LatLng(lat, lng)); 356 bounds.extend(new google.maps.LatLng(REDBOX_LIST_POINT[0].location.lat, REDBOX_LIST_POINT[0].location.lng)); 357 REDBOX_MAP.fitBounds(bounds); 352 // var bounds = new google.maps.LatLngBounds(); 353 // bounds.extend(new google.maps.LatLng(lat, lng)); 354 // bounds.extend(new google.maps.LatLng(REDBOX_LIST_POINT[0].location.lat, REDBOX_LIST_POINT[0].location.lng)); 355 // REDBOX_MAP.fitBounds(bounds); 356 if (lat && lng) { 357 REDBOX_MAP.setCenter(new google.maps.LatLng(lat, lng)) 358 REDBOX_MAP.setZoom(17); 359 } 358 360 jQuery( "#wrap-area-choose-point" ).animate({ 359 361 bottom: -400 … … 392 394 activeLabelPoint() 393 395 setClickCloseChoosePoint() 396 activeInputConfirm() 394 397 } 395 398 }); -
redbox-pickup/tags/1.31/readme.txt
r2821828 r2986171 5 5 Requires at least: 3.3 6 6 Tested up to: 5.5.1 7 Stable tag: 1.3 07 Stable tag: 1.31 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
redbox-pickup/tags/1.31/redbox.php
r2821828 r2986171 4 4 * Description: This plugin allows customers pickup package at RedBox Locker. 5 5 * Plugin URI: https://woocommerce.com/ 6 * Version: 1.3 06 * Version: 1.31 7 7 * Author: RedBox 8 8 * Author URI: https://redboxsa.com … … 131 131 wp_enqueue_style( 'redbox_font_roboto', 'https://fonts.googleapis.com/css?family=Roboto' ); 132 132 wp_enqueue_style( 'redbox_font_cario', 'https://fonts.googleapis.com/css?family=Cairo' ); 133 wp_enqueue_script( 'redbox_front_js', REDBOX_PLUGIN_DIR . '/js/front.js', false, '1.0.2 0' );133 wp_enqueue_script( 'redbox_front_js', REDBOX_PLUGIN_DIR . '/js/front.js', false, '1.0.21' ); 134 134 wp_enqueue_script( 'redbox_front_js_map', 'https://maps.googleapis.com/maps/api/js?key=AIzaSyBY1xlGe6jLbugOJegCsUGnzlufYWa5CRw&sensor=false&libraries=places' ); 135 135 wp_enqueue_script( 'redbox_front_js_map_clustor', 'https://unpkg.com/@google/markerclustererplus@4.0.1/dist/markerclustererplus.min.js' ); -
redbox-pickup/trunk/css/front.css
r2678417 r2986171 89 89 height: auto; 90 90 border-radius: 3px; 91 display: flex; 92 height: 100%; 91 93 } 92 94 .list-point .per-point { … … 101 103 box-shadow: 0 4px 12px rgb(42 65 232 / 15%); 102 104 background: #fff; 103 height: 100%; 105 max-height: calc(100% - 20px); 106 margin: auto; 107 overflow: auto; 104 108 } 105 109 .list-point .per-point .step1{ -
redbox-pickup/trunk/front/front.php
r2821828 r2986171 14 14 15 15 private function redbox_get_data_customer($order) { 16 $shippingFirstName = $order->get_shipping_first_name(); 17 $shippingLastName = $order->get_shipping_last_name(); 18 $shippingPhone = $order->get_shipping_phone(); 19 $shippingAddress = $order->get_shipping_address_1(); 20 16 21 $billingFirstName = $order->get_billing_first_name(); 17 22 $billingLastName = $order->get_billing_last_name(); 18 23 $billingPhone = $order->get_billing_phone(); 19 24 $billingEmail = $order->get_billing_email(); 25 $billingAddress = $order->get_billing_address_1(); 20 26 21 27 $data = [ 22 "name" => $ billingFirstName . ' ' . $billingLastName,23 'phone' => $ billingPhone,28 "name" => $shippingFirstName ? $shippingFirstName . ' ' . $shippingLastName : $billingFirstName . ' ' . $billingLastName, 29 'phone' => $shippingPhone ? $shippingPhone : $billingPhone, 24 30 'email' => $billingEmail, 25 'adddress' => $ order->get_billing_address_1()31 'adddress' => $shippingAddress ? $shippingAddress : $billingAddress 26 32 ]; 27 33 return $data; … … 122 128 } 123 129 124 function redbox_create_shipment( $order_id, $posted_data, $order ) { 130 function redbox_create_shipment( $order_id) { 131 $order = new WC_Order( $order_id ); 125 132 $note = 'Creating redbox shipments'; 126 133 $order->add_order_note( $note ); … … 138 145 "store_url" => get_home_url(), 139 146 "reference" => $order_id, 140 "point_id" => $ _POST['redbox_point_id'],147 "point_id" => $order->get_meta( '_redbox_point_id' ), 141 148 "customer_name" => $customerData['name'], 142 149 "customer_phone" => $customerData['phone'], … … 150 157 "from_platform" => "woo_commerce" 151 158 ]; 159 $dataShipment["is_paid"] = $order->is_paid(); 160 $dataShipment["get_payment_method"] = $order->get_payment_method(); 152 161 if ($order->get_payment_method() == "cod") { 153 $dataShipment['cod_amount'] = $priceData['order_total']; 154 $dataShipment['cod_currency'] = $priceData['curency']; 155 } else { 156 $dataShipment['cod_amount'] = 0; 157 $dataShipment['cod_currency'] = $priceData['curency']; 158 } 162 $dataShipment['cod_amount'] = $priceData['order_total']; 163 $dataShipment['cod_currency'] = $priceData['curency']; 164 } else { 165 if ($order->is_paid()) { 166 $dataShipment['cod_amount'] = 0; 167 $dataShipment['cod_currency'] = $priceData['curency']; 168 } else { 169 $dataShipment['cod_amount'] = 10; 170 $dataShipment['cod_currency'] = "USD"; 171 } 172 } 159 173 if ($this->redbox_validate_body_create_shipment($dataShipment)) { 160 174 $urlQuery = REDBOX_URL_CREATE_SHIPMENT; … … 296 310 297 311 function bbloomer_woocommerce_tiered_shipping( $rates, $package ) { 298 if ($this->minimumAmount == false) { 299 return $rates; 300 } 301 $total = WC()->cart->subtotal; 302 if ($total >= $this->minimumAmount) { 303 if ($rates["redbox_pickup_delivery"]) { 304 $rates["redbox_pickup_delivery"]->cost = 0; 305 $rates["redbox_pickup_delivery"]->taxes = 0; 306 } 307 } 308 return $rates; 312 // if ($this->minimumAmount == false) { 313 // return $rates; 314 // } 315 // $total = WC()->cart->subtotal; 316 // if ($total >= $this->minimumAmount) { 317 // if ($rates["redbox_pickup_delivery"]) { 318 // $rates["redbox_pickup_delivery"]->cost = 0; 319 // $rates["redbox_pickup_delivery"]->taxes = 0; 320 // } 321 // } 322 // return $rates; 323 $no_free_shipping_method = false; 324 if($no_free_shipping_method == true): 325 $new_rates = array(); 326 foreach ( $rates as $rate_id => $rate ) { 327 // Only modify rates if free_shipping is present. 328 if ( 'free_shipping' != $rate->method_id ) { 329 $new_rates[ $rate_id ] = $rate; 330 break; 331 } 332 } 333 else: 334 $new_rates = array(); 335 foreach ( $rates as $rate_id => $rate ) { 336 // Only modify rates if free_shipping is present. 337 if ( 'free_shipping' === $rate->method_id || 'redbox_pickup_delivery' === $rate->method_id) { 338 $new_rates[ $rate_id ] = $rate; 339 break; 340 } 341 } 342 endif; 343 344 345 if ( ! empty( $new_rates ) ) { 346 //Save local pickup if it's present. 347 foreach ( $rates as $rate_id => $rate ) { 348 if ('local_pickup' === $rate->method_id ) { 349 $new_rates[ $rate_id ] = $rate; 350 break; 351 } 352 } 353 return $new_rates; 354 } 355 356 return $rates; 309 357 } 310 358 … … 313 361 add_action('wp_ajax_getlispoint', array( $this, 'redbox_get_list_point' )); 314 362 add_action('wp_ajax_nopriv_getlispoint', array( $this, 'redbox_get_list_point' )); 315 add_action('woocommerce_ checkout_order_processed', array( $this, 'redbox_create_shipment' ), 10, 3);363 add_action('woocommerce_thankyou', array( $this, 'redbox_create_shipment' )); 316 364 add_action( 'woocommerce_after_checkout_billing_form', array($this, 'redbox_add_point_field') ); 317 365 -
redbox-pickup/trunk/js/front.js
r2768963 r2986171 146 146 if (data.success) { 147 147 REDBOX_LIST_POINT = data.points 148 activeInputConfirm()149 148 drawMapInThis(data.points, lat, lng) 150 149 jQuery('.redbox-waiting-response').remove() … … 164 163 let LNG = 46.6752957 165 164 if (REDBOX_LIST_POINT.length) { 166 activeInputConfirm()167 165 drawMapInThis(REDBOX_LIST_POINT, LAT, LNG) 168 166 jQuery('.redbox-waiting-response').remove() … … 352 350 function reRenderMapWithPoint(lat, lng) { 353 351 var htmlWaiting = '<div class="redbox-waiting-response"><i class="fa fa-spinner fa-spin"></i></div>' 354 var bounds = new google.maps.LatLngBounds(); 355 bounds.extend(new google.maps.LatLng(lat, lng)); 356 bounds.extend(new google.maps.LatLng(REDBOX_LIST_POINT[0].location.lat, REDBOX_LIST_POINT[0].location.lng)); 357 REDBOX_MAP.fitBounds(bounds); 352 // var bounds = new google.maps.LatLngBounds(); 353 // bounds.extend(new google.maps.LatLng(lat, lng)); 354 // bounds.extend(new google.maps.LatLng(REDBOX_LIST_POINT[0].location.lat, REDBOX_LIST_POINT[0].location.lng)); 355 // REDBOX_MAP.fitBounds(bounds); 356 if (lat && lng) { 357 REDBOX_MAP.setCenter(new google.maps.LatLng(lat, lng)) 358 REDBOX_MAP.setZoom(17); 359 } 358 360 jQuery( "#wrap-area-choose-point" ).animate({ 359 361 bottom: -400 … … 392 394 activeLabelPoint() 393 395 setClickCloseChoosePoint() 396 activeInputConfirm() 394 397 } 395 398 }); -
redbox-pickup/trunk/readme.txt
r2821828 r2986171 5 5 Requires at least: 3.3 6 6 Tested up to: 5.5.1 7 Stable tag: 1.3 07 Stable tag: 1.31 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
redbox-pickup/trunk/redbox.php
r2821828 r2986171 4 4 * Description: This plugin allows customers pickup package at RedBox Locker. 5 5 * Plugin URI: https://woocommerce.com/ 6 * Version: 1.3 06 * Version: 1.31 7 7 * Author: RedBox 8 8 * Author URI: https://redboxsa.com … … 131 131 wp_enqueue_style( 'redbox_font_roboto', 'https://fonts.googleapis.com/css?family=Roboto' ); 132 132 wp_enqueue_style( 'redbox_font_cario', 'https://fonts.googleapis.com/css?family=Cairo' ); 133 wp_enqueue_script( 'redbox_front_js', REDBOX_PLUGIN_DIR . '/js/front.js', false, '1.0.2 0' );133 wp_enqueue_script( 'redbox_front_js', REDBOX_PLUGIN_DIR . '/js/front.js', false, '1.0.21' ); 134 134 wp_enqueue_script( 'redbox_front_js_map', 'https://maps.googleapis.com/maps/api/js?key=AIzaSyBY1xlGe6jLbugOJegCsUGnzlufYWa5CRw&sensor=false&libraries=places' ); 135 135 wp_enqueue_script( 'redbox_front_js_map_clustor', 'https://unpkg.com/@google/markerclustererplus@4.0.1/dist/markerclustererplus.min.js' );
Note: See TracChangeset
for help on using the changeset viewer.