Plugin Directory

Changeset 3283858


Ignore:
Timestamp:
04/29/2025 07:24:31 AM (11 months ago)
Author:
datalogics
Message:

2.6.20

Location:
datalogics
Files:
91 added
6 edited

Legend:

Unmodified
Added
Removed
  • datalogics/assets/readme-he_IL.txt

    r3283827 r3283858  
    44Requires at least: 5.0
    55Tested up to: 6.8
    6 Stable tag: 2.6.18
     6Stable tag: 2.6.20
    77Requires PHP: 7.4
    88License: GPLv2 or later
  • datalogics/trunk/README.txt

    r3283827 r3283858  
    44Requires at least: 5.0
    55Tested up to: 6.8
    6 Stable tag: 2.6.18
     6Stable tag: 2.6.20
    77Requires PHP: 7.4
    88License: GPLv2 or later
  • datalogics/trunk/actions.php

    r3283827 r3283858  
    597597
    598598            $result_array['label_url'] = DATALOGICS_PRINT_URL.''.$order_id;
     599
     600
     601            $datalogics_myaccount_tracking_email = get_option('datalogics_myaccount_tracking_email','');
     602
     603            if ($datalogics_myaccount_tracking_email!='') {
     604
     605                if (isset($result_array['tracking_number'])) {               
     606
     607                    datalogics_send_tracking_email($order_id);
     608
     609                }
     610       
     611            }
    599612             
    600613           
     
    708721}
    709722
     723
     724add_filter( 'woocommerce_email_classes', 'datalogics_filter_woocommerce_email_classes' );
     725function datalogics_filter_woocommerce_email_classes( array $email_classes ): array {
     726
     727    //var_dump(dirname( __FILE__ ));
     728   
     729    require_once dirname( __FILE__ ) .'/'. 'class_wc_shipping_order_email.php';
     730
     731    $email_classes['Datalogics_WC_Shipping_Order_Email'] = new Datalogics_WC_Shipping_Order_Email();   
     732   
     733
     734    return $email_classes;
     735}
     736
     737function datalogics_send_tracking_email($order_id) {
     738     
     739               
     740    //plugins_url(dirname( __FILE__ ))
     741
     742    if ( file_exists( dirname( __FILE__ )  .'/../woocommerce/includes/emails/class-wc-email.php' ) ) {
     743        require_once dirname( __FILE__ )  .'/../woocommerce/includes/emails/class-wc-email.php';
     744    } else {
     745        //var_dump('not exist 2' );
     746    }
     747
     748    // Include custom email class
     749    if ( file_exists( dirname( __FILE__ ) .'/class_wc_shipping_order_email.php' ) ) {
     750        require_once dirname( __FILE__ ) .'/class_wc_shipping_order_email.php';
     751    } else {
     752        //var_dump('not exist 2' );
     753    }
     754
     755    // Check if the custom email class is defined
     756    if ( class_exists( 'Datalogics_WC_Shipping_Order_Email' ) ) {
     757        // Trigger the email
     758        $email = new Datalogics_WC_Shipping_Order_Email();
     759        $email->trigger($order_id);
     760    } else {
     761        //var_dump('not function' );
     762        // Handle the case where the class does not exist
     763        //error_log('DATALOGICS WC_Shipping_Order_Email class not found. Email not sent.');
     764    }
     765
     766   
     767
     768}
     769
     770
     771add_filter( 'update_post_metadata', function( $check, $object_id, $meta_key, $meta_value ) {
     772
     773    // Already short-circuited; bail.
     774    if ( null !== $check ) {
     775        return $check;
     776    }
     777
     778    $datalogics_myaccount_tracking_email = get_option('datalogics_myaccount_tracking_email','');
     779
     780    if ($datalogics_myaccount_tracking_email!='') {
     781
     782        if ( 'datalogics_shipping' == $meta_key ) {
     783
     784            if ( ! empty( $meta_value ) ) { 
     785               
     786                datalogics_send_tracking_email($object_id);
     787
     788            }
     789
     790        }
     791
     792    }
     793
     794
     795    return $check;   
     796
     797}, 10, 4 );   
     798
     799
     800
     801add_action( 'wp_ajax_datalogics_get_locations', 'datalogics_get_locations' );
     802add_action( 'wp_ajax_nopriv_datalogics_get_locations', 'datalogics_get_locations' );
     803
     804function datalogics_get_locations() {
     805
     806    if (!isset($_POST['nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'datalogics_nonce')) {
     807        wp_send_json_error(['message' => __('Invalid or missing security token.', 'datalogics')]);
     808        wp_die();
     809    }
     810
     811    //$city = $_POST['city'];
     812    // $locations = unserialize(get_option('datalogics_shipping_locations'));
     813    // $locations = get_option('datalogics_shipping_locations');
     814    // if ($locations!='' && !is_array($locations)) {
     815    //     $locations = unserialize($locations);
     816    // }
     817    $locations = datalogics_get_shipping_locations();
     818    $existing_companies = get_option('datalogics_shipping_method', '');
     819    if (is_string($existing_companies)) {
     820        $existing_companies = json_decode($existing_companies,true);
     821    }
     822
     823
     824    foreach ($locations as $platform_id => $values){
     825
     826        $company_exist_check = false;
     827
     828        if (isset($existing_companies) && is_array($existing_companies)) {
     829   
     830            foreach($existing_companies as $exist_company) {
     831
     832                if ($exist_company['shipping_push_supplier']==$platform_id) {
     833
     834                    $company_exist_check = true;
     835
     836                }
     837
     838            }
     839
     840        }
     841
     842        if ($company_exist_check == false) {
     843            unset($locations[$platform_id]);
     844        }
     845
     846
     847       
     848
     849    }
     850
     851
     852    //wp_send_json($locations[$city]);
     853    wp_send_json($locations);
     854}
     855
  • datalogics/trunk/datalogics.php

    r3283827 r3283858  
    1010    License: GPLv2 or later
    1111    License URI: https://www.gnu.org/licenses/gpl-2.0.html
    12     Version: 2.6.18
     12    Version: 2.6.20
    1313*/
    1414
  • datalogics/trunk/js/datalogics_shipping.js

    r3283834 r3283858  
    212212
    213213   
    214     if (datalogics_object_data.datalogics_ncode_auto) { 
     214    if (datalogics_object_data.datalogics_ncode_auto && datalogics_object_data.datalogics_ncode_auto == '1') {       
     215   
    215216
    216217        $(document).on("focus","#datalogics_n_code_city_select",function(e) {
  • datalogics/trunk/shipping_class.php

    r3283569 r3283858  
    5454
    5555                // Enqueue the Leaflet CSS file
    56                 wp_enqueue_style('leaflet', plugin_dir_url(__FILE__) . 'assets/css/leaflet.css', array(), datalogics_version);
     56                wp_enqueue_style('leaflet', plugin_dir_url(__FILE__) . '/css/leaflet.css', array(), datalogics_version);
    5757
    5858                // Enqueue MarkerCluster CSS files
     
    467467
    468468                    // Expand shortcodes.
    469                     $sum = 0;
     469                    //$sum = 0;
    470470                    // Do the math.
    471471                    return $sum ? WC_Eval_Math::evaluate( $sum ) : 0;
     
    900900                    $this->fee_cost = $args['cost'];
    901901
    902                     $sum = 0;
     902                    //$sum = 0;
    903903                   
    904904                    // Do the math.
Note: See TracChangeset for help on using the changeset viewer.