Changeset 2633255
- Timestamp:
- 11/22/2021 03:21:47 AM (4 years ago)
- Location:
- delyvax/trunk
- Files:
-
- 4 edited
-
delyvax.php (modified) (2 diffs)
-
functions.php (modified) (9 diffs)
-
includes/delyvax-shipping.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
delyvax/trunk/delyvax.php
r2611032 r2633255 4 4 Plugin URI: https://delyva.com 5 5 description: The official Delyva plugin helps store owners to integrate WooCommerce with [Delyva](https://delyva.com) for seamless service comparison and order processing. 6 Version: 1.1.2 06 Version: 1.1.21 7 7 Author: Delyva 8 8 Author URI: https://delyva.com … … 13 13 defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); 14 14 define('DELYVAX_API_ENDPOINT', 'https://api.delyva.app/'); 15 define('DELYVAX_PLUGIN_VERSION', '1.1.2 0');15 define('DELYVAX_PLUGIN_VERSION', '1.1.21'); 16 16 17 17 require_once plugin_dir_path(__FILE__) . 'functions.php'; -
delyvax/trunk/functions.php
r2594780 r2633255 77 77 delete_option('delyvax_rate_adjustment_percentage'); 78 78 delete_option('delyvax_rate_adjustment_flat'); 79 delete_option('delyvax_multivendor'); 79 80 } 80 81 … … 159 160 $processing_hours = $settings['processing_hours']; 160 161 $processing_time = $settings['processing_time']; 161 $pickup_minutes = $settings['pickup_minutes'];162 162 163 163 $gmtoffset = get_option('gmt_offset'); … … 259 259 }else if($processing_days > 0 && $processing_time != '') 260 260 { 261 $processing_time = str_replace(":00","",$processing_time); 262 261 263 $delivery_time = $delivery_date; 262 264 $delivery_time->setTime($processing_time,00,00); … … 307 309 $dx_pickup_date_format = $dx_delivery_date_format; 308 310 } 309 310 //set pickup time311 if($order->get_meta( 'dx_pickup_time' ) != null)312 {313 $dx_pickup_time = $order->get_meta( 'dx_pickup_time' );314 }else if($pickup_minutes > 0)315 {316 $pickup_time = $delivery_time;317 $pickup_time->sub(new DateInterval('PT'.$pickup_minutes.'M'));318 319 $dx_pickup_time = $pickup_time->format('H:i');320 }else {321 //minus 30 minutes322 $pickup_time = $delivery_time;323 $pickup_time->sub(new DateInterval('PT30M'));324 325 $dx_pickup_time = $pickup_time->format('H:i');326 }327 328 311 } catch(Exception $e) { 329 312 echo 'Message: ' .$e->getMessage(); … … 378 361 $processing_hours = $settings['processing_hours']; 379 362 $item_type = ($settings['item_type']) ? $settings['item_type'] : "PARCEL" ; 363 364 $multivendor_option = $settings['multivendor']; 380 365 381 366 //----delivery date & time (pull from meta data), if not available, set to +next day 8am. … … 507 492 508 493 //store info 509 if( function_exists(dokan_get_seller_id_by_order) && function_exists(dokan_get_store_info))494 if($multivendor_option == 'DOKAN') 510 495 { 511 $seller_id = dokan_get_seller_id_by_order($sub_order->get_id()); 512 $store_info = dokan_get_store_info( $seller_id ); 513 514 $product_store_name = $store_info['store_name']; 515 516 if($store_info['store_name']) $store_name = $store_info['store_name']; 517 if($store_info['first_name']) $store_first_name = $store_info['first_name']; 518 if($store_info['last_name']) $store_last_name = $store_info['last_name']; 519 if($store_info['phone']) $store_phone = $store_info['phone']; 520 if($store_info['email']) $store_email = $store_info['email']; 521 $store_address_1 = $store_info['address']['street_1']; 522 $store_address_2 = $store_info['address']['street_2']; 523 $store_city = $store_info['address']['city']; 524 $store_state = $store_info['address']['state']; 525 $store_postcode = $store_info['address']['zip']; 526 $store_country = $store_info['address']['country']; 527 528 }else if(function_exists(wcfm_get_vendor_id_by_post)) 496 if(function_exists(dokan_get_seller_id_by_order) && function_exists(dokan_get_store_info)) 497 { 498 $seller_id = dokan_get_seller_id_by_order($sub_order->get_id()); 499 $store_info = dokan_get_store_info( $seller_id ); 500 501 $product_store_name = $store_info['store_name']; 502 503 if($store_info['store_name']) $store_name = $store_info['store_name']; 504 if($store_info['first_name']) $store_first_name = $store_info['first_name']; 505 if($store_info['last_name']) $store_last_name = $store_info['last_name']; 506 if($store_info['phone']) $store_phone = $store_info['phone']; 507 if($store_info['email']) $store_email = $store_info['email']; 508 $store_address_1 = $store_info['address']['street_1']; 509 $store_address_2 = $store_info['address']['street_2']; 510 $store_city = $store_info['address']['city']; 511 $store_state = $store_info['address']['state']; 512 $store_postcode = $store_info['address']['zip']; 513 $store_country = $store_info['address']['country']; 514 } 515 }else if($multivendor_option == 'WCFM') 529 516 { 530 $vendor_id = wcfm_get_vendor_id_by_post( $product_id ); 531 532 $store_info = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true ); 533 534 if($store_info) 517 if(function_exists(wcfm_get_vendor_id_by_post)) 535 518 { 536 $product_store_name = $store_name = $store_info['store_name']; 537 $store_first_name = $store_info['store_name']; 538 $store_last_name = $store_info['store_name']; 539 $store_phone = $store_info['phone']; 540 $store_email = $store_info['store_email']; 541 $store_address_1 = isset( $store_info['address']['street_1'] ) ? $store_info['address']['street_1'] : ''; 542 $store_address_2 = isset( $store_info['address']['street_2'] ) ? $store_info['address']['street_2'] : ''; 543 $store_city = isset( $store_info['address']['city'] ) ? $store_info['address']['city'] : ''; 544 $store_state = isset( $store_info['address']['state'] ) ? $store_info['address']['state'] : ''; 545 $store_postcode = isset( $store_info['address']['zip'] ) ? $store_info['address']['zip'] : ''; 546 $store_country = isset( $store_info['address']['country'] ) ? $store_info['address']['country'] : ''; 519 $vendor_id = wcfm_get_vendor_id_by_post( $product_id ); 520 521 $store_info = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true ); 522 523 if($store_info) 524 { 525 $product_store_name = $store_name = $store_info['store_name']; 526 $store_first_name = $store_info['store_name']; 527 $store_last_name = $store_info['store_name']; 528 $store_phone = $store_info['phone']; 529 $store_email = $store_info['store_email']; 530 $store_address_1 = isset( $store_info['address']['street_1'] ) ? $store_info['address']['street_1'] : ''; 531 $store_address_2 = isset( $store_info['address']['street_2'] ) ? $store_info['address']['street_2'] : ''; 532 $store_city = isset( $store_info['address']['city'] ) ? $store_info['address']['city'] : ''; 533 $store_state = isset( $store_info['address']['state'] ) ? $store_info['address']['state'] : ''; 534 $store_postcode = isset( $store_info['address']['zip'] ) ? $store_info['address']['zip'] : ''; 535 $store_country = isset( $store_info['address']['country'] ) ? $store_info['address']['country'] : ''; 536 } 547 537 } 548 538 }else { … … 578 568 $variation = $_pf->get_product( $product_variation_id ); 579 569 580 $product_name = $variation->get_name(); 581 $product_weight = $variation->get_weight(); 582 $product_length = $variation->get_length(); 583 $product_width = $variation->get_width(); 584 $product_height = $variation->get_height(); 570 if($variation) 571 { 572 $product_name = $variation->get_name(); 573 $product_weight = $variation->get_weight(); 574 $product_length = $variation->get_length(); 575 $product_width = $variation->get_width(); 576 $product_height = $variation->get_height(); 577 }else { 578 $product_weight = $product->get_weight(); 579 $product_length = $product->get_length(); 580 $product_width = $product->get_width(); 581 $product_height = $product->get_height(); 582 } 585 583 }else{ 586 584 $product_weight = $product->get_weight(); … … 632 630 } 633 631 634 if( function_exists(dokan_get_seller_id_by_order) && function_exists(dokan_get_store_info))632 if($multivendor_option == 'DOKAN') 635 633 { 636 $seller_id = dokan_get_seller_id_by_order($main_order->get_id()); 637 $store_info = dokan_get_store_info( $seller_id ); 638 639 $product_store_name = $store_info['store_name']; 640 641 if($store_info['store_name']) $store_name = $store_info['store_name']; 642 if($store_info['first_name']) $store_first_name = $store_info['first_name']; 643 if($store_info['last_name']) $store_last_name = $store_info['last_name']; 644 if($store_info['phone']) $store_phone = $store_info['phone']; 645 if($store_info['email']) $store_email = $store_info['email']; 646 $store_address_1 = $store_info['address']['street_1']; 647 $store_address_2 = $store_info['address']['street_2']; 648 $store_city = $store_info['address']['city']; 649 $store_state = $store_info['address']['state']; 650 $store_postcode = $store_info['address']['zip']; 651 $store_country = $store_info['address']['country']; 652 }else if(function_exists(wcfm_get_vendor_id_by_post)) 634 if(function_exists(dokan_get_seller_id_by_order) && function_exists(dokan_get_store_info)) 635 { 636 $seller_id = dokan_get_seller_id_by_order($main_order->get_id()); 637 $store_info = dokan_get_store_info( $seller_id ); 638 639 $product_store_name = $store_info['store_name']; 640 641 if($store_info['store_name']) $store_name = $store_info['store_name']; 642 if($store_info['first_name']) $store_first_name = $store_info['first_name']; 643 if($store_info['last_name']) $store_last_name = $store_info['last_name']; 644 if($store_info['phone']) $store_phone = $store_info['phone']; 645 if($store_info['email']) $store_email = $store_info['email']; 646 $store_address_1 = $store_info['address']['street_1']; 647 $store_address_2 = $store_info['address']['street_2']; 648 $store_city = $store_info['address']['city']; 649 $store_state = $store_info['address']['state']; 650 $store_postcode = $store_info['address']['zip']; 651 $store_country = $store_info['address']['country']; 652 } 653 }else if($multivendor_option == 'WCFM') 653 654 { 654 $vendor_id = wcfm_get_vendor_id_by_post( $product_id ); 655 656 $store_info = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true ); 657 658 if($store_info) 655 if(function_exists(wcfm_get_vendor_id_by_post)) 659 656 { 660 $product_store_name = $store_name = $store_info['store_name']; 661 $store_first_name = $store_info['store_name']; 662 $store_last_name = $store_info['store_name']; 663 $store_phone = $store_info['phone']; 664 $store_email = $store_info['store_email']; 665 $store_address_1 = isset( $store_info['address']['street_1'] ) ? $store_info['address']['street_1'] : ''; 666 $store_address_2 = isset( $store_info['address']['street_2'] ) ? $store_info['address']['street_2'] : ''; 667 $store_city = isset( $store_info['address']['city'] ) ? $store_info['address']['city'] : ''; 668 $store_state = isset( $store_info['address']['state'] ) ? $store_info['address']['state'] : ''; 669 $store_postcode = isset( $store_info['address']['zip'] ) ? $store_info['address']['zip'] : ''; 670 $store_country = isset( $store_info['address']['country'] ) ? $store_info['address']['country'] : ''; 657 $vendor_id = wcfm_get_vendor_id_by_post( $product_id ); 658 659 $store_info = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true ); 660 661 if($store_info) 662 { 663 $product_store_name = $store_name = $store_info['store_name']; 664 $store_first_name = $store_info['store_name']; 665 $store_last_name = $store_info['store_name']; 666 $store_phone = $store_info['phone']; 667 $store_email = $store_info['store_email']; 668 $store_address_1 = isset( $store_info['address']['street_1'] ) ? $store_info['address']['street_1'] : ''; 669 $store_address_2 = isset( $store_info['address']['street_2'] ) ? $store_info['address']['street_2'] : ''; 670 $store_city = isset( $store_info['address']['city'] ) ? $store_info['address']['city'] : ''; 671 $store_state = isset( $store_info['address']['state'] ) ? $store_info['address']['state'] : ''; 672 $store_postcode = isset( $store_info['address']['zip'] ) ? $store_info['address']['zip'] : ''; 673 $store_country = isset( $store_info['address']['country'] ) ? $store_info['address']['country'] : ''; 674 } 671 675 } 672 676 }else { … … 705 709 $variation = $_pf->get_product( $product_variation_id ); 706 710 707 $product_name = $variation->get_name(); 708 $product_weight = $variation->get_weight(); 709 $product_length = $variation->get_length(); 710 $product_width = $variation->get_width(); 711 $product_height = $variation->get_height(); 712 711 if($variation) 712 { 713 $product_name = $variation->get_name(); 714 $product_weight = $variation->get_weight(); 715 $product_length = $variation->get_length(); 716 $product_width = $variation->get_width(); 717 $product_height = $variation->get_height(); 718 }else { 719 $product_weight = $product->get_weight(); 720 $product_length = $product->get_length(); 721 $product_width = $product->get_width(); 722 $product_height = $product->get_height(); 723 } 713 724 }else{ 714 725 $product_weight = $product->get_weight(); -
delyvax/trunk/includes/delyvax-shipping.php
r2611032 r2633255 62 62 ), 63 63 'create_shipment_on_paid' => array( 64 'title' => __( ' Auto Create Delivery Order on Payment Complete', 'delyvax' ),64 'title' => __( 'Fulfil orders immediately', 'delyvax' ), 65 65 'id' => 'delyvax_create_shipment_on_paid', 66 66 'description' => __( 'Create paid delivery order on successful payment by customer. If you do not select this, system will create delivery order as draft upon payment complete.', 'delyvax' ), … … 69 69 ), 70 70 'create_shipment_on_confirm' => array( 71 'title' => __( ' Manual Create Delivery Order on Preparing', 'delyvax' ),71 'title' => __( 'Fulfil orders on "Preparing" status', 'delyvax' ), 72 72 'id' => 'delyvax_create_shipment_on_confirm', 73 73 'description' => __( 'Create paid delivery on order status = "preparing" by Store/Merchant/Vendor. If you do not select this, system will create delivery order as draft upon changes to preparing status.', 'delyvax' ), … … 144 144 'id' => 'delyvax_shop_email', 145 145 'description' => __( 'e.g. your@email.com' ), 146 ), 147 'multivendor' => array( 148 'title' => __( 'Multi-vendor system', 'delyvax' ), 149 'default' => __('SINGLE', 'delyvax'), 150 'id' => 'delyvax_multivendor', 151 'description' => __( '' ), 152 'type' => 'select', 153 'options' => array( 154 'SINGLE' => __( 'Single vendor', 'woocommerce' ), 155 'DOKAN' => __( 'Dokan', 'woocommerce' ), 156 'WCFM' => __( 'WCFM', 'woocommerce' ), 157 ) 146 158 ), 147 159 'processing_days' => array( … … 259 271 'description' => __( 'Leave empty or type `woocommerce` or your web design agency code.' ), 260 272 ), 261 // 'task_item_type' => array(262 // 'title' => __( 'Default Task - Item type', 'delyvax' ),263 // 'type' => 'text',264 // 'default' => __('0', 'delyvax'),265 // 'id' => 'delyvax_task_item_type',266 // 'description' => __( 'Default task - package item type. e.g. DOCUMENT / PARCEL / FOOD / PACKAGE.' ),267 // ),268 // 'split_tasks' => array(269 // 'title' => __( 'Fulfilment by vendors', 'delyvax' ),270 // 'id' => 'delyvax_split_tasks',271 // 'description' => __( 'Create tasks and assign to vendors by ext id type and ext id', 'delyvax' ),272 // 'type' => 'checkbox',273 // 'default' => ''274 // ),275 // 'ext_id_type' => array(276 // 'title' => __( 'Personnel External ID Type', 'delyvax' ),277 // 'type' => 'text',278 // 'default' => '',279 // 'id' => 'delyvax_ext_id_type',280 // 'description' => __( 'Personnel External ID Type. e.g. dokan', 'delyvax' ),281 // ),282 // 'pickup_minutes' => array(283 // 'title' => __( 'Fulfilment minutes before delivery', 'delyvax' ),284 // 'type' => 'text',285 // 'default' => __('0', 'delyvax'),286 // 'id' => 'delyvax_processing_hours',287 // 'description' => __( 'Number of minutes before delivery. e.g. 30 - 30 minutes befor delivery time; 60 - 60 minutes befor delivery time.' ),288 // ),289 // 'api_webhook_key' => array(290 // 'title' => __('API API Webhook Key', 'delyvax'),291 // 'type' => 'text',292 // 'default' => __('', 'delyvax'),293 // 'id' => 'delyvax_api_webhook_key',294 // 'description' => __( 'Do not touch this. We will automatically update this field once the system subscribed to DelyvaX webhook.'),295 // ),296 273 array( 297 274 'title' => __( 'Shipping Rate Adjustments', 'delyvax' ), … … 334 311 { 335 312 $status_allow_checkout = true; 313 314 $settings = get_option( 'woocommerce_delyvax_settings' ); 315 $multivendor_option = $settings['multivendor']; 336 316 337 317 $pdestination = $package["destination"]; … … 444 424 $volumetric_constant = $settings['volumetric_constant'] ?? '5000'; 445 425 446 if( function_exists(dokan_get_seller_id_by_order) && function_exists(dokan_get_store_info))426 if($multivendor_option == 'DOKAN') 447 427 { 448 $seller_id = $package['seller_id']; 449 450 if($seller_id) 428 if(function_exists(dokan_get_seller_id_by_order) && function_exists(dokan_get_store_info)) 451 429 { 452 $store_info = dokan_get_store_info( $seller_id ); 430 $seller_id = $package['seller_id']; 431 432 if($seller_id) 433 { 434 $store_info = dokan_get_store_info( $seller_id ); 435 if($store_info) 436 { 437 $store_name = $store_info['store_name']; 438 $store_first_name = $store_info['first_name']; 439 $store_last_name = $store_info['last_name']; 440 $store_phone = $store_info['phone']; 441 $store_email = $store_info['email']; 442 $store_address_1 = $store_info['address']['street_1']; 443 $store_address_2 = $store_info['address']['street_2']; 444 $store_city = $store_info['address']['city']; 445 $store_state = $store_info['address']['state']; 446 $store_postcode = $store_info['address']['zip']; 447 $store_country = $store_info['address']['country']; 448 } 449 } 450 } 451 }else if($multivendor_option == 'DOKAN') 452 { 453 if(function_exists(wcfm_get_vendor_id_by_post)) 454 { 455 $vendor_id = wcfm_get_vendor_id_by_post( $product_id ); 456 457 $store_info = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true ); 458 453 459 if($store_info) 454 460 { 455 461 $store_name = $store_info['store_name']; 456 $store_first_name = $store_info[' first_name'];457 $store_last_name = $store_info[' last_name'];462 $store_first_name = $store_info['store_name']; 463 $store_last_name = $store_info['store_name']; 458 464 $store_phone = $store_info['phone']; 459 $store_email = $store_info['email']; 460 $store_address_1 = $store_info['address']['street_1']; 461 $store_address_2 = $store_info['address']['street_2']; 462 $store_city = $store_info['address']['city']; 463 $store_state = $store_info['address']['state']; 464 $store_postcode = $store_info['address']['zip']; 465 $store_country = $store_info['address']['country']; 466 } 467 } 468 }else if(function_exists(wcfm_get_vendor_id_by_post)) 469 { 470 $vendor_id = wcfm_get_vendor_id_by_post( $product_id ); 471 472 $store_info = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true ); 473 474 if($store_info) 475 { 476 $store_name = $store_info['store_name']; 477 $store_first_name = $store_info['store_name']; 478 $store_last_name = $store_info['store_name']; 479 $store_phone = $store_info['phone']; 480 $store_email = $store_info['store_email']; 481 $store_address_1 = isset( $store_info['address']['street_1'] ) ? $store_info['address']['street_1'] : ''; 482 $store_address_2 = isset( $store_info['address']['street_2'] ) ? $store_info['address']['street_2'] : ''; 483 $store_city = isset( $store_info['address']['city'] ) ? $store_info['address']['city'] : ''; 484 $store_state = isset( $store_info['address']['state'] ) ? $store_info['address']['state'] : ''; 485 $store_postcode = isset( $store_info['address']['zip'] ) ? $store_info['address']['zip'] : ''; 486 $store_country = isset( $store_info['address']['country'] ) ? $store_info['address']['country'] : ''; 465 $store_email = $store_info['store_email']; 466 $store_address_1 = isset( $store_info['address']['street_1'] ) ? $store_info['address']['street_1'] : ''; 467 $store_address_2 = isset( $store_info['address']['street_2'] ) ? $store_info['address']['street_2'] : ''; 468 $store_city = isset( $store_info['address']['city'] ) ? $store_info['address']['city'] : ''; 469 $store_state = isset( $store_info['address']['state'] ) ? $store_info['address']['state'] : ''; 470 $store_postcode = isset( $store_info['address']['zip'] ) ? $store_info['address']['zip'] : ''; 471 $store_country = isset( $store_info['address']['country'] ) ? $store_info['address']['country'] : ''; 472 } 487 473 } 488 474 }else { … … 588 574 foreach ($services as $shipper) { 589 575 if (isset($shipper['service']['name'])) { 590 $settings = get_option( 'woocommerce_delyvax_settings' );591 576 592 577 $rate_adjustment_type = $settings['rate_adjustment_type'] ?? 'discount'; -
delyvax/trunk/readme.txt
r2611032 r2633255 4 4 Requires at least: 5.4 5 5 Tested up to: 5.7 6 Stable tag: 1.1.2 06 Stable tag: 1.1.21 7 7 Requires PHP: 7.2 8 8 License: GPLv3 … … 31 31 32 32 == Changelog == 33 34 = 1.1.21 = 35 *Release Date - 8 Nov 2021* 36 37 * Option for Multi-vendor Dokan and WCFM. After updates, Dokan and WCFM users need to set 'Multi-vendor system' to Dokan or WCFM in the plugin setting. 33 38 34 39 = 1.1.20 =
Note: See TracChangeset
for help on using the changeset viewer.