Changeset 2403263
- Timestamp:
- 10/20/2020 02:38:54 PM (5 years ago)
- Location:
- doorhub/trunk
- Files:
-
- 6 edited
-
README.md (modified) (1 diff)
-
admin/partials/order-doorhub-metabox.php (modified) (1 diff)
-
includes/class-wc-doorhub-communicator.php (modified) (8 diffs)
-
public/class-wc-doorhub-public.php (modified) (10 diffs)
-
public/partials/wc-doorhub-public-display.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
doorhub/trunk/README.md
r2377291 r2403263 4 4 Requires at least: 3.0.1 5 5 Tested up to: 5.4.1 6 Stable tag: 1.0. 76 Stable tag: 1.0.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
doorhub/trunk/admin/partials/order-doorhub-metabox.php
r2313026 r2403263 18 18 <span><?php echo $dhOrder->order->deliveryCharge ?></span> 19 19 </p> 20 < p class="form-field ">21 <label><?php echo __( 'Pickup Date:', 'wc-doorhub' )?></label>22 <span><?php echo $order->get_meta( 'dropoff_date' )?></span>23 </p> 20 <!--<p class="form-field "> 21 <label><?php /*echo __( 'Pickup Date:', 'wc-doorhub' ) */?></label> 22 <span><?php /*echo $order->get_meta( 'dropoff_date' ) */?></span> 23 </p>--> 24 24 <p class="form-field "> 25 25 <label><?php echo __( 'Distribution:', 'wc-doorhub' ) ?></label> -
doorhub/trunk/includes/class-wc-doorhub-communicator.php
r2377289 r2403263 4 4 * The file that defines the communication class for Doorhub 5 5 * 6 * @link http s://doorhub.io6 * @link http://doorhub.io 7 7 * @since 1.0.0 8 8 * … … 21 21 */ 22 22 protected $api_key; 23 protected $api_url; 23 24 24 25 /** … … 29 30 public function __construct() { 30 31 $this->api_key = get_option( 'wc_doorhub_api' ); 32 $this->api_url = 'https://test.doorhub.io'; 31 33 } 32 34 … … 54 56 'customerName' => $order->get_shipping_first_name() . ' ' . $order->get_shipping_last_name(), 55 57 'customerPhone' => $order->get_billing_phone(), 56 'customerFloor' => 1 1,58 'customerFloor' => 1, 57 59 'productSize' => 'medium', 58 'companyId' => 1,59 60 'warehouseId' => get_option('wc_doorhub_warehouse'), 60 // "description" => "this is test",61 61 'deliveryId' => $order->get_id(), 62 // 'deliveryId' => $order->get_id() + 1,63 62 'dateForDropOff' => $pickup_date, 64 'distributionId' => $order->get_meta('doorhub_distribution'), 65 // 'regionId' => 2, 63 'distributionId' => 1, 66 64 'deliveryType' => 1, 65 'plugin' => ['name' => 'woocommerce'] 67 66 ); 68 67 69 $response = $this->request( 'https://doorhub.io/api/sameday/v1/warehouse/order/checkout', $data );68 $response = $this->request( $this->api_url.'/api/sameday/v1/warehouse/order/checkout', $data ); 70 69 71 70 //Update Information Back to Order … … 93 92 if($this->has_doorhub($order) && $data['orderRef']) { 94 93 if($data['orderRef']) { 95 $response = $this->request( 'https://doorhub.io/api/sameday/v1/warehouse/order/cancel', $data, 'patch');94 $response = $this->request($this->api_url.'/api/sameday/v1/warehouse/order/cancel', $data, 'patch'); 96 95 update_post_meta( $order->get_id(), 'doorhub_response', $response ); 97 96 } … … 105 104 */ 106 105 public function get_current_warehouse() { 107 $response = $this->request( 'https://doorhub.io/api/sameday/v1/company/warehouse', array(), 'get');106 $response = $this->request($this->api_url.'/api/sameday/v1/company/warehouse/'.get_option('wc_doorhub_warehouse'), array(), 'get'); 108 107 109 108 if ( isset( $response->success ) && $response->success ) { 110 foreach ($response->data->warehouse as $warehouse) { 111 if($warehouse->warehouseId == get_option('wc_doorhub_warehouse')) { 112 return $warehouse; 113 } 114 } 109 return $response->data; 115 110 } 116 111 … … 126 121 public function get_single_order($orderRef) { 127 122 128 $response = $this->request( "https://doorhub.io/api/sameday/v1/warehouse/order/$orderRef/show", array(), 'get');123 $response = $this->request($this->api_url."/api/sameday/v1/warehouse/order/$orderRef/show", array(), 'get'); 129 124 130 125 if ( isset( $response->success ) && $response->success ) { … … 146 141 $data['storeId'] = get_option('wc_doorhub_warehouse'); 147 142 148 return $this->request( 'https://doorhub.io/api/sameday/v1/warehouse/customer/address/check', $data );143 return $this->request( $this->api_url.'/api/sameday/v1/warehouse/customer/address/check', $data ); 149 144 } 150 145 -
doorhub/trunk/public/class-wc-doorhub-public.php
r2339711 r2403263 107 107 108 108 //Loading jQuery UI for datepicker 109 wp_enqueue_script( 'jquery-ui-datepicker' );109 //wp_enqueue_script( 'jquery-ui-datepicker' ); 110 110 111 111 //verification of order datetime js file 112 $response = $this->api->get_current_warehouse();112 /*$response = $this->api->get_current_warehouse(); 113 113 wp_register_script( 'datejs', plugin_dir_url( __FILE__ ) . 'js/wc-doorhub-checkout-date.js', array( 'jquery' ), $this->version, false ); 114 114 wp_enqueue_script( 'datejs' ); 115 wp_localize_script( 'datejs', 'date_data', json_encode( $response ) ); 115 wp_localize_script( 'datejs', 'date_data', json_encode( $response ) );*/ 116 116 } 117 117 … … 140 140 public function register_query_vars( $vars ) { 141 141 $vars[] = 'dh-order-id'; 142 142 143 $vars[] = 'dh-redirect'; 143 144 … … 175 176 } 176 177 177 $response = $this->api->get_current_warehouse();178 /*$response = $this->api->get_current_warehouse(); 178 179 $distriId = $order->get_meta( 'doorhub_distribution' ); 179 180 foreach ($response->distribution as $distribution) { … … 185 186 if ( $order->get_meta( 'dropoff_date' )) { 186 187 require_once plugin_dir_path( __FILE__ ) . 'partials/wc-doorhub-public-display.php'; 187 } 188 }*/ 188 189 } 189 190 … … 211 212 public function delivery_date_field_new( $fields ) { 212 213 213 $fields['order']['dropoff_date'] = array(214 /*$fields['order']['dropoff_date'] = array( 214 215 'label' => __( 'Dropoff Date <span class="required">*</span>', 'wc-doorhub' ), 215 216 'placeholder' => _x( 'YYYY-MM-DD', 'placeholder', 'wc-doorhub' ), … … 221 222 'type' => 'text', 222 223 'default' => current_time( 'Y-m-d' ) 223 ); 224 );*/ 224 225 225 226 $distributions = []; 226 $response = $this->api->get_current_warehouse();227 /*$response = $this->api->get_current_warehouse(); 227 228 228 229 if(!isset($response->distribution)) { … … 232 233 foreach ($response->distribution as $distribution) { 233 234 $distributions[$distribution->id] = $distribution->starTime . ' - ' . $distribution->endTime; 234 } 235 }*/ 235 236 236 237 $fields['order']['doorhub_distribution'] = array( … … 250 251 * Validate Dropoff date and time 251 252 */ 252 public function delivery_date_field_validate() {253 /*public function delivery_date_field_validate() { 253 254 if(in_array('wc_doorhub', $_POST['shipping_method'])) { 254 255 if ( !isset( $_POST['dropoff_date'] ) || … … 265 266 } 266 267 267 } 268 }*/ 268 269 269 270 /** … … 271 272 * @param $order_id 272 273 */ 273 public function delivery_date_field_store( $order_id ) {274 /*public function delivery_date_field_store( $order_id ) { 274 275 if(in_array('wc_doorhub', $_POST['shipping_method'])) { 275 276 update_post_meta( $order_id, 'dropoff_date', sanitize_text_field($_POST['dropoff_date']) ); 276 277 update_post_meta( $order_id, 'doorhub_distribution', sanitize_text_field($_POST['doorhub_distribution']) ); 277 278 } 278 } 279 }*/ 279 280 280 281 -
doorhub/trunk/public/partials/wc-doorhub-public-display.php
r2313026 r2403263 1 1 <ul class="woocommerce-order-overview woocommerce-thankyou-order-details order_details"> 2 2 3 < li class="woocommerce-order-overview__order order">4 <?php echo __( 'Dropoff Date:', 'wc-doorhub' )?>5 <strong><?php echo $order->get_meta( 'dropoff_date' )?></strong>6 </li> 3 <!--<li class="woocommerce-order-overview__order order"> 4 <?php /*echo __( 'Dropoff Date:', 'wc-doorhub' ) */?> 5 <strong><?php /*echo $order->get_meta( 'dropoff_date' ) */?></strong> 6 </li>--> 7 7 8 8 <li class="woocommerce-order-overview__order order"> -
doorhub/trunk/readme.txt
r2377291 r2403263 4 4 Requires at least: 3.0.1 5 5 Tested up to: 5.4.1 6 Stable tag: 1.0. 76 Stable tag: 1.0.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.