Plugin Directory

Changeset 2973949


Ignore:
Timestamp:
10/02/2023 04:33:32 PM (2 years ago)
Author:
extendago
Message:

Version 1.4.3

Location:
extendago-wp-connection/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extendago-wp-connection/trunk/extendago-wp-connection.php

    r2956645 r2973949  
    44Plugin URI:  http://www.arture.nl/extendago
    55Description: The Wordpress plugin for connecting Woocommerce with Extenda GO / Wallmob. You can manage your products inside Extenda GO or make your webshop as leading foor product manangement. You Stock changes will be two-way binding.
    6 Version:     1.4.2
     6Version:     1.4.3
    77Author:      Arture B.V.
    88Author URI:  https://arture.nl/
  • extendago-wp-connection/trunk/includes/admin/partials/extendago_wp_connection_settings_page.php

    r2956645 r2973949  
    152152    <?php
    153153    $wizard_completed = get_option('wizard_completed');
    154     if( !isset($wizard_completed) || empty($wizard_completed) ):
     154    if( $wizard_platform_selected && ( !isset($wizard_completed) || empty($wizard_completed) ) ):
    155155        $install_completed = false; ?>
    156156
  • extendago-wp-connection/trunk/includes/api/class-extendago-web-api-functions.php

    r2945883 r2973949  
    891891    public function extendago_update_wc_product_stock( $stock_event_line ){
    892892
     893        $logging = new Extendago_WP_Connection_Logging();
     894
    893895        // Variation check
    894896        if( isset($stock_event_line['product_variant_id']) && !empty($stock_event_line['product_variant_id']) ){
    895897            $variation_post_id = $this->functions->custom_get_variation_id_by_sku( $stock_event_line['product_variant_id'] );
     898
     899            $logging->log_file_write('ExtendaGo | Processing stock change for product ' . $stock_event_line['product_id'] . '/' . $stock_event_line['product_variant_id'] . ' changing stock to ' . $stock_event_line['current_quantity'] . ' (' . $stock_event_line['delta_quantity'] . ')');
    896900
    897901            // Check if variation exist
     
    946950                }
    947951            }
     952            else{
     953                $logging->log_file_write('WARNING | Product variation not found with ID: ' . $stock_event_line['product_variant_id']);
     954            }
    948955        }
    949956        else{
    950957
    951958            $product_id = $this->functions->custom_get_product_id_by_sku( $stock_event_line['product_id'], $stock_event_line['product_id'] );
     959
     960            $logging->log_file_write('ExtendaGo | Processing stock change for product ' . $stock_event_line['product_id'] . ' changing stock to ' . $stock_event_line['current_quantity'] . ' (' . $stock_event_line['delta_quantity'] . ')');
    952961
    953962            // Check if product exist
    954963            if (isset($product_id) && !empty($product_id)) {
    955964
    956                 $Product = new WC_Product_Simple($product_id);
     965                $Product = wc_get_product( $product_id );
    957966                $product_exist = true;
    958967
     
    10181027            // If error storing temporarily, return the error.
    10191028            if ( is_wp_error( $file_array['tmp_name'] ) ) {
     1029                $attach_id = '';
    10201030                $logging->log_file_write( 'ERROR | Error while storing file temporarily' );
    10211031            }
    1022 
    1023             // Store and validate
    1024             $attach_id = media_handle_sideload( $file_array, $post_id, $desc );
    1025 
    1026             // Unlink if couldn't store permanently
    1027             if ( is_wp_error( $attach_id ) ) {
    1028                 unlink( $file_array['tmp_name'] );
    1029                 $attach_id = '';
    1030                 $logging->log_file_write( 'ERROR | Couldn\'t store upload permanently' );
    1031             }
    1032 
     1032            else{
     1033                // Store and validate
     1034                $attach_id = media_handle_sideload( $file_array, $post_id, $desc );
     1035
     1036                // Unlink if couldn't store permanently
     1037                if ( is_wp_error( $attach_id ) ) {
     1038                    unlink( $file_array['tmp_name'] );
     1039                    $attach_id = '';
     1040                    $logging->log_file_write( 'ERROR | Couldn\'t store upload permanently' );
     1041                }
     1042            }
    10331043        }
    10341044
  • extendago-wp-connection/trunk/includes/api/class-extendago-web-api.php

    r2956966 r2973949  
    3636            $url = $this->extendago_api_url . $request;
    3737        }
    38        
     38
    3939        curl_setopt($ch, CURLOPT_URL, $url);
    4040
     
    7474                }
    7575                else {
    76                     $Error =strtoupper($method)."-Request: ".$request." returned with http-code: ".$http_code.". Response: ".$result;
     76                    $Error =strtoupper($method)."-Request: " .$request. " returned with http-code: ".$http_code.". Response: ".$result;
    7777                }
    7878            }
    7979            else {
    80                 $Error = strtoupper($method)."-RequestRequest: ".$request." returned with http-code: ".$http_code.". Response: ".$result;
     80                $Error = strtoupper($method)."-Request: " .$request. " returned with http-code: ".$http_code.". Response: ".$result;
    8181            }
    8282        }
     
    116116        }
    117117
    118         return;
     118        return NULL;
    119119    }
    120120
  • extendago-wp-connection/trunk/includes/cronjob/class-extendago-cronjob-functions.php

    r2956645 r2973949  
    836836                        if( empty($ProductResponse) || isset($ProductResponse['error']) ){
    837837                            $ProductResponse = $Extendago->CurlRequest('/products', 'POST', $ExtendagoProductJSON, false, true);
     838                            if( is_null($ProductResponse) ){
     839                                unset($ExtendagoProductJSON['image']);
     840                                $this->logging->log_file_write('ERROR | Product ' . $product['id'] . ' image is not available of too large');
     841                                $ProductResponse = $Extendago->CurlRequest('/products', 'POST', $ExtendagoProductJSON, false, true);
     842                            }
    838843                        }
    839844                        else{
     
    847852                            else{
    848853                                $ProductResponse = $Extendago->CurlRequest('/products/'.$product['id'], 'PATCH', $ExtendagoProductJSON, false, true);
     854                                if( is_null($ProductResponse) ){
     855                                    unset($ExtendagoProductJSON['image']);
     856                                    $this->logging->log_file_write('ERROR | Product ' . $product['id'] . ' image is not available of too large');
     857                                    $ProductResponse = $Extendago->CurlRequest('/products/'.$product['id'], 'PATCH', $ExtendagoProductJSON, false, true);
     858                                }
    849859                            }
    850860                        }
     
    965975                                $Response = $Extendago->CurlRequest('/stock_values?filter-product_variant_id='.$product_variant['id'], 'GET');
    966976
    967                                 if( !isset($variation->stock) || empty($variation->stock) ) {
     977                                if( !isset($variation->stock) || $variation->stock == '' ) {
    968978                                    $this->logging->log_file_write('EXPORT | Product variation ID ' . $product_variant['id'] . ' has no stock value!');
    969979                                }
     
    15011511                    $total_sychronized_stock_changes++;
    15021512
    1503                     $this->logging->log_file_write('ExtendaGo | ' . strtok($stock_change['reference_id'], ' -') . ' for product ' . $stock_event_line['product_id'].'/'.$stock_event_line['product_variant_id'] . ' changing stock to ' .$stock_event_line['current_quantity']. ' ('.$stock_event_line['delta_quantity'].')');
    1504 
    15051513                    // Save new product stock values
    15061514                    $api_functions->extendago_update_wc_product_stock($stock_event_line);
  • extendago-wp-connection/trunk/readme.txt

    r2956645 r2973949  
    55Requires at least: 6.0
    66Tested up to: 6.3.0
    7 Stable tag: 1.4.2
     7Stable tag: 1.4.3
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    3030
    3131== Changelog ==
     32
     33= 1.4.3 =
     34* Some minor improvements and code updates
    3235
    3336= 1.4.2 =
Note: See TracChangeset for help on using the changeset viewer.