Plugin Directory

Changeset 2815247


Ignore:
Timestamp:
11/09/2022 02:28:27 PM (3 years ago)
Author:
delyva
Message:

v1.1.37

Location:
delyvax/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • delyvax/trunk/delyvax.php

    r2810664 r2815247  
    44    Plugin URI: https://delyva.com
    55    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.36
     6    Version: 1.1.37
    77    Author: Delyva
    88    Author URI: https://delyva.com
     
    1313    defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    1414    define('DELYVAX_API_ENDPOINT', 'https://api.delyva.app/');
    15     define('DELYVAX_PLUGIN_VERSION', '1.1.36');
     15    define('DELYVAX_PLUGIN_VERSION', '1.1.37');
    1616
    1717    require_once plugin_dir_path(__FILE__) . 'functions.php';
  • delyvax/trunk/functions.php

    r2807720 r2815247  
    472472      $store_postcode = get_option( 'woocommerce_store_postcode');
    473473
     474      $origin_lat = null;
     475      $origin_lon = null;
     476
    474477      // The country/state
    475478      if($store_country == null)
     
    518521              $store_postcode = $store_info['address']['zip'];
    519522              $store_country = $store_info['address']['country'];
     523
     524              $origin_lat = isset($store_info['address']['lat']) ? $store_info['address']['lat'] : null;
     525              $origin_lon = isset($store_info['address']['lon']) ? $store_info['address']['lon'] : null;
    520526          }
    521527      }else if($multivendor_option == 'WCFM')
     
    540546                  $store_postcode      = isset( $store_info['address']['zip'] ) ? $store_info['address']['zip'] : '';
    541547                  $store_country  = isset( $store_info['address']['country'] ) ? $store_info['address']['country'] : '';
     548
     549                  $origin_lat = isset($store_info['address']['lat']) ? $store_info['address']['lat'] : null;
     550                  $origin_lon = isset($store_info['address']['lon']) ? $store_info['address']['lon'] : null;
    542551              }
    543552          }
     
    648657              "state" => $store_state,
    649658              "postcode" => $store_postcode,
    650               "country" => $store_country,
     659              "country" => $store_country
    651660              // "coord" => array(
    652661              //     "lat" => "",
     
    657666      );
    658667
     668      if($origin_lat && $origin_lon)
     669      {
     670          $origin['contact']['coord']['lat'] = $origin_lat;
     671          $origin['contact']['coord']['lon'] = $origin_lon;
     672      }
     673      //
     674
    659675      //destination
     676      $r_shipping_phone = $order->get_meta( 'shipping_phone' ) ? $order->get_meta( 'shipping_phone' ) : $order->get_meta( '_shipping_phone' );
     677
     678      $destination_lat = $order->get_meta( 'shipping_lat' ) ? $order->get_meta( 'shipping_lat' ) : null;
     679      $destination_lon = $order->get_meta( 'shipping_lon' ) ? $order->get_meta( 'shipping_lon' ) : null;
     680
    660681      $destination = array(
    661682          "scheduledAt" => $scheduledAt->format('c'), //"2019-11-15T12:00:00+0800",
     
    664685              "name" => $order->get_shipping_first_name() ? $order->get_shipping_first_name().' '.$order->get_shipping_last_name() : $order->get_billing_first_name().' '.$order->get_billing_last_name(),
    665686              "email" => $order->get_billing_email(),
    666               "phone" => $order->get_billing_phone(),
    667               "mobile" => $order->get_billing_phone(),
     687              "phone" => $r_shipping_phone ? $r_shipping_phone : $order->get_billing_phone(),
     688              "mobile" => $r_shipping_phone ? $r_shipping_phone : $order->get_billing_phone(),
    668689              "address1" => $order->get_shipping_address_1() ? $order->get_shipping_address_1() : $order->get_billing_address_1(),
    669690              "address2" => $order->get_shipping_address_2() ? $order->get_shipping_address_2() : $order->get_billing_address_2(),
     
    680701      );
    681702
     703      if($destination_lat && $destination_lon)
     704      {
     705          $destination['contact']['coord']['lat'] = $destination_lat;
     706          $destination['contact']['coord']['lon'] = $destination_lon;
     707      }
    682708      //
    683709
  • delyvax/trunk/includes/delyvax-shipping.php

    r2810664 r2815247  
    497497                $inventories[] = array(
    498498                    "weight" => array(
    499                         "value" => ($this->defaultWeight($this->weightToKg($product_weight))),
     499                        "value" => ($this->defaultWeight($this->weightToKg($product->get_weight()))),
    500500                        "unit" => 'kg'
    501501                    ),
     
    540540            $store_country = $split_country[0];
    541541            $store_state   = $split_country[1];
     542
     543            $origin_lat = null;
     544            $origin_lon = null;
    542545
    543546            if($multivendor_option == 'DOKAN')
     
    563566                            $store_postcode = $store_info['address']['zip'];
    564567                            $store_country = $store_info['address']['country'];
     568
     569                            $origin_lat = isset($store_info['address']['lat']) ? $store_info['address']['lat'] : null;
     570                            $origin_lon = isset($store_info['address']['lon']) ? $store_info['address']['lon'] : null;
    565571                        }
    566572                    }
     
    587593                        $store_postcode      = isset( $store_info['address']['zip'] ) ? $store_info['address']['zip'] : '';
    588594                        $store_country  = isset( $store_info['address']['country'] ) ? $store_info['address']['country'] : '';
     595
     596                        $origin_lat = isset($store_info['address']['lat']) ? $store_info['address']['lat'] : null;
     597                        $origin_lon = isset($store_info['address']['lon']) ? $store_info['address']['lon'] : null;
    589598                    }
    590599                }
     
    593602            }
    594603
     604            //
    595605            $origin = array(
    596606                "address1" => $store_address_1,
     
    599609                "state" => $store_state,
    600610                "postcode" => $store_postcode,
    601                 "country" => $store_country,
     611                "country" => $store_country
    602612                // "coord" => array(
    603613                //     "lat" => "",
     
    606616            );
    607617
     618            if($origin_lat && $origin_lon)
     619            {
     620                $origin['coord']['lat'] = $origin_lat;
     621                $origin['coord']['lon'] = $origin_lon;
     622            }
     623            //
     624
     625            //destination
    608626            $destination = array(
    609627                "address1" => $pdestination["address"],
     
    618636                // )
    619637            );
     638
     639            $destination_lat = isset($pdestination['lat']) ? $pdestination['lat'] : null;
     640            $destination_lon = isset($pdestination['lon']) ? $pdestination['lon'] : null;
     641
     642            if($destination_lat && $destination_lon)
     643            {
     644                $destination['coord']['lat'] = $destination_lat;
     645                $destination['coord']['lon'] = $destination_lon;
     646            }
     647            //
    620648
    621649            //calculate volumetric weight
  • delyvax/trunk/includes/delyvax-webhook.php

    r2806190 r2815247  
    114114                      $consignmentNo = $data['consignmentNo'];
    115115                      $statusCode = $data['statusCode'];
    116                       $statusCode = $data['statusCode'];
    117116
    118117                      if(strlen($shipmentId) < 3 || strlen($consignmentNo) < 3 )
     
    138137                          $order->get_status();
    139138
     139                          $labelUrl = 'https://api.delyva.app/v1.0/order/'.$shipmentId.'/label?companyId='.$company_id;
     140
    140141                          // $order->update_meta_data( 'DelyvaXOrderID', $shipmentId );
    141142                          $order->update_meta_data( 'DelyvaXTrackingCode', $consignmentNo );
     143                          $order->update_meta_data( 'DelyvaXLabelUrl', $labelUrl );
    142144                          $order->save();
    143145
  • delyvax/trunk/readme.txt

    r2810664 r2815247  
    44Requires at least: 5.4
    55Tested up to: 5.7
    6 Stable tag: 1.1.36
     6Stable tag: 1.1.37
    77Requires PHP: 7.2
    88License: GPLv3
     
    3232
    3333== Changelog ==
     34
     35= 1.1.37 =
     36*Release Date - 3rd November 2022*
     37
     38* Bug-fixes.
    3439
    3540= 1.1.36 =
Note: See TracChangeset for help on using the changeset viewer.