Plugin Directory

Changeset 2882937


Ignore:
Timestamp:
03/19/2023 02:55:09 PM (3 years ago)
Author:
delyva
Message:

v1.1.47

Location:
delyvax/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • delyvax/trunk/delyvax.php

    r2879536 r2882937  
    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.46
     6    Version: 1.1.47
    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.46');
     15    define('DELYVAX_PLUGIN_VERSION', '1.1.47');
    1616
    1717    require_once plugin_dir_path(__FILE__) . 'functions.php';
  • delyvax/trunk/functions.php

    r2879536 r2882937  
    5252function delyvaxPluginUninstalled() {
    5353    delete_option('delyvax_pricing_enable');
     54    delete_option('delyvax_limit_service_options');   
    5455    delete_option('delyvax_create_shipment_on_paid');
    5556    delete_option('delyvax_create_shipment_on_confirm');
    5657    delete_option('delyvax_change_order_status');
    5758    delete_option('delyvax_company_id');
     59    delete_option('delyvax_company_name');   
    5860    delete_option('delyvax_user_id');
    5961    delete_option('delyvax_customer_id');
     
    6567    delete_option('delyvax_shop_mobile');
    6668    delete_option('delyvax_shop_email');
     69    delete_option('delyvax_shipping_phone');   
    6770
    6871    delete_option('delyvax_processing_days');
     
    7477    delete_option('delyvax_rate_adjustment_type');
    7578
     79    delete_option('delyvax_insurance_premium');
     80    delete_option('delyvax_source');
     81    delete_option('delyvax_include_order_note');
     82    delete_option('delyvax_cancel_delivery');
     83    delete_option('delyvax_cancel_order');
     84
    7685    delete_option('wc_settings_delyvax_shipping_rate_adjustment');
    7786    delete_option('delyvax_rate_adjustment_percentage');
     
    155164    delyvax_set_pickup_delivery_time($order);
    156165
    157     if($order->get_status() == 'preparing')
     166    if($order->get_status() == 'processing')
     167    {
     168        if ($settings['create_shipment_on_paid'] == 'yes')
     169        {
     170            if($order->get_payment_method() != 'pos_cash') {
     171                delyvax_create_order($order, $user, true);
     172            }
     173        }else if ($settings['create_shipment_on_paid'] == 'nothing')
     174        {
     175            //do nothing
     176        }else {
     177            if($order->get_payment_method() != 'pos_cash') {
     178                delyvax_create_order($order, $user, false);
     179            }
     180        }
     181    }else if($order->get_status() == 'preparing')
    158182    {
    159183      if ($settings['create_shipment_on_confirm'] == 'yes')
  • delyvax/trunk/includes/delyvax-shipping.php

    r2874200 r2882937  
    300300                'title'     => __( 'Cancel delivery', 'delyvax' ),
    301301                'default' => __('no', 'delyvax'),
    302                 'id' => 'delyvax_shipping_phone',
     302                'id' => 'delyvax_cancel_delivery',
    303303                'description' => __( 'Cancel the delivery if the order is cancelled. Subject to cancellation rules by the courier.' ),
    304304                'type'    => 'select',
     
    311311                'title'     => __( 'Cancel order', 'delyvax' ),
    312312                'default' => __('no', 'delyvax'),
    313                 'id' => 'delyvax_shipping_phone',
     313                'id' => 'delyvax_cancel_order',
    314314                'description' => __( 'Cancel the order if the delivery is cancelled.' ),
    315315                'type'    => 'select',
  • delyvax/trunk/includes/shipping-widget.php

    r2879536 r2882937  
    2525    $company_code = $settings['company_code'];
    2626    $company_name = $settings['company_name'];
     27    $create_shipment_on_paid = $settings['create_shipment_on_paid'];
    2728    $create_shipment_on_confirm = $settings['create_shipment_on_confirm'];
    2829
     
    4041
    4142    $trackUrl = 'https://'.$company_code.'.delyva.app/customer/strack?trackingNo='.$TrackingCode;
    42     $printLabelUrl = 'https://api.delyva.app/v1.0/order/'.$DelyvaXOrderID.'/label?companyId='.$company_id;             
    43 
     43    $printLabelUrl = 'https://api.delyva.app/v1.0/order/'.$DelyvaXOrderID.'/label?companyId='.$company_id;
     44   
     45    //processing
     46    if ( $order->has_status(array('processing'))) {
     47        if($create_shipment_on_paid == 'yes' || $create_shipment_on_paid == ''
     48             || $create_shipment_on_confirm == 'yes' )
     49        {
     50            //create order and display list of services
     51            $DelyvaXServices = $order->get_meta( 'DelyvaXServices' );
     52
     53            $adxservices = array();
     54
     55            if($DelyvaXOrderID != null && !$DelyvaXServices)
     56            {
     57                $order = delyvax_get_order_services($order);
     58                $DelyvaXServices = $order->get_meta( 'DelyvaXServices' );
     59            }
     60
     61            if($DelyvaXServices)
     62            {
     63                $adxservices = json_decode($DelyvaXServices);
     64            }
     65
     66            if($DelyvaXError) {
     67                echo "Error: ".$DelyvaXError;
     68            }
     69
     70            if($DelyvaXOrderID != null && sizeof($adxservices) > 0) {
     71                delyvax_get_services_select($adxservices, $DelyvaXServiceCode);
     72
     73                echo '<p><button class="button button-primary" type="submit">Fulfill with '.$company_name.'</button></p>';
     74            }
     75        }else {
     76            echo "<div><p>
     77                <a href=\"".wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status=preparing&order_id=' . $order->get_id() ), 'woocommerce-mark-order-status' )."\" class=\"button button-primary\">Fulfill with ".$company_name."</a>
     78            </p></div>";
     79        }   
     80    //preparing
     81    } else if ( $order->has_status( array( 'preparing' )) ) {
     82        if($DelyvaXOrderID != null && $TrackingCode != null){
     83            echo 'Tracking No.: <b>'.$TrackingCode.'</b>';
     84            echo "<div><p>
     85                <a href=\"".$printLabelUrl."\" class=\"button button-primary\" target=\"_blank\">Print label</a>
     86                </p></div>";
     87            echo "<div><p>
     88                <a href=\"".$trackUrl."\" class=\"button button-primary\" target=\"_blank\">Track shipment</a>
     89                </p></div>";
     90        }else {
     91            echo "<div>
     92                    <p>
     93                    Set your order to <b>Processing</b> to fulfill with ".$company_name.", it also works with <i>bulk actions</i> too!
     94                    </p>
     95                    </div>";
     96        }
     97    }else if ( $order->has_status( array( 'completed' ) ) ) {
     98        if($DelyvaXOrderID != null && $TrackingCode != null){
     99            echo 'Tracking No.: <b>'.$TrackingCode.'</b>';
     100            echo "<div><p>
     101                <a href=\"".$trackUrl."\" class=\"button button-primary\" target=\"_blank\">Track shipment</a>
     102                </p></div>";
     103        }
     104    //others
     105    }else {
     106        if($DelyvaXOrderID != null && $TrackingCode != null){
     107            echo 'Tracking No.: <b>'.$TrackingCode.'</b>';
     108            echo "<div><p>
     109                <a href=\"".$printLabelUrl."\" class=\"button button-primary\" target=\"_blank\">Print label</a>
     110                </p></div>";
     111            echo "<div><p>
     112                <a href=\"".$trackUrl."\" class=\"button button-primary\" target=\"_blank\">Track shipment</a>
     113                </p></div>";
     114        }else {
     115            echo "<div>
     116                    <p>
     117                    Set your order to <b>Processing</b> to fulfill with ".$company_name.", it also works with <i>bulk actions</i> too!
     118                    </p>
     119                    </div>";
     120        }
     121    }
     122
     123    /**
    44124    if ($TrackingCode == 'Service Unavailable') {
    45125                echo 'Tracking No.: <b>'.$TrackingCode.'</b>';
     
    50130                $adxservices = array();
    51131
    52                 if(!$DelyvaXServices)
     132                if($DelyvaXOrderID && !$DelyvaXServices)
    53133                {
    54134                    $order = delyvax_get_order_services($order);
     
    78158                }
    79159
    80                 delyvax_get_services_select($adxservices, $DelyvaXServiceCode);
    81 
    82                 echo '<p><button class="button button-primary" type="submit">Fulfill with '.$company_name.'</button></p>';
     160                if(sizeof($adxservices) > 0) {
     161                    delyvax_get_services_select($adxservices, $DelyvaXServiceCode);
     162
     163                    echo '<p><button class="button button-primary" type="submit">Fulfill with '.$company_name.'</button></p>';
     164                }
    83165
    84166                // if($create_shipment_on_confirm == 'yes')
     
    147229            </div>";
    148230    }
     231    **/
    149232}
    150233
  • delyvax/trunk/readme.txt

    r2879536 r2882937  
    44Requires at least: 5.4
    55Tested up to: 6.1
    6 Stable tag: 1.1.46
     6Stable tag: 1.1.47
    77Requires PHP: 7.2
    88License: GPLv3
     
    3232
    3333== Changelog ==
     34
     35= 1.1.47 =
     36*Release Date - 17th March 2023*
     37
     38* Bug fixes regarding cancel order and cancel delivery.
    3439
    3540= 1.1.46 =
Note: See TracChangeset for help on using the changeset viewer.