Plugin Directory

Changeset 3308682


Ignore:
Timestamp:
06/09/2025 07:36:27 PM (10 months ago)
Author:
ascendedcrow
Message:

1.0.32.2

1) URL Update

Location:
shop-2-api
Files:
63 added
6 edited

Legend:

Unmodified
Added
Removed
  • shop-2-api/trunk/assets/bol2api_dashboard.js

    r3055588 r3308682  
    4848    })
    4949
     50    /**
     51     * Check connection status and update UI accordingly
     52     * Shows/hides elements based on connection status
     53     */
    5054    function check_connection_status() {
    5155        // This will check if the connection is good on Shop 2 API
     
    6064            add_connection_error();
    6165        }
    62         // IF WC Connected and Boll connected then show STEP DATA.
     66
     67        // IF WC Connected and Bol connected then show STEP DATA.
    6368        if (!settings.wc_connected || !settings.bol_connected) {
    6469            $('#get-started-card-completed').hide();
     
    6671
    6772        if (settings.wc_connected && settings.bol_connected) {
    68             $('#get-started-card').hide();
     73            // Smooth transition to hide the card
     74            $('#get-started-card').fadeOut(500);
    6975        } else {
    70             //dashicons-yes-alt item-completed
     76            // Update icon to show not completed status
    7177            let $item = $('#connection-completed h1 span').first().removeClass('dashicons-yes-alt').removeClass('item-completed');
    7278            $item.addClass('dashicons-dismiss').addClass('item-not-completed');
     
    95101    }
    96102
     103    /**
     104     * Add connection error message to the UI
     105     * Hides the WordPress error and shows a custom error message
     106     */
    97107    function add_connection_error() {
    98108        $('#setting-error-shop2api_token_error').hide();
    99         let error_text = $('#setting-error-shop2api_token_error').text()
     109        let error_text = $('#setting-error-shop2api_token_error').text();
    100110        if (error_text !== "") {
    101111            $('#token-error').text(error_text);
    102             $('#token-error').show();
    103         }
    104     }
    105 
     112            $('#token-error').fadeIn(500);
     113        }
     114    }
     115
     116    /**
     117     * Handle WooCommerce connection UI and click events
     118     * Updates the UI based on connection status and sets up click handler
     119     */
    106120    function woocommerce_reroute() {
    107121        // If WC is connected change to green class
    108122        if (settings.wc_connected) {
    109             let wc_connection = $("#connect-to-wc")
    110             wc_connection.find(".connect-error").removeClass("connect-error").addClass("connect-success");
    111             wc_connection.find(".dashicons-admin-plugins").removeClass("dashicons-admin-plugins").addClass("dashicons-plugins-checked");
     123            let wc_connection = $("#connect-to-wc");
     124            wc_connection.find(".connect-error")
     125                .removeClass("connect-error")
     126                .addClass("connect-success")
     127                .css("opacity", 0)
     128                .animate({opacity: 1}, 500);
     129
     130            wc_connection.find(".dashicons-admin-plugins")
     131                .removeClass("dashicons-admin-plugins")
     132                .addClass("dashicons-plugins-checked");
    112133        }
    113134
     
    117138    }
    118139
    119     //Open boll modal id bol is connected.
     140    /**
     141     * Handle Bol connection UI and modal interactions
     142     * Updates the UI based on connection status and sets up event handlers
     143     */
    120144    function bol_connect_modal() {
    121145        if (settings.bol_connected) {
    122             let bol_connection = $("#connect-to-bol")
    123             bol_connection.find(".connect-error").removeClass("connect-error").addClass("connect-success");
    124             bol_connection.find(".dashicons-admin-plugins").removeClass("dashicons-admin-plugins").addClass("dashicons-plugins-checked");
    125         }
    126         ;
     146            let bol_connection = $("#connect-to-bol");
     147            bol_connection.find(".connect-error")
     148                .removeClass("connect-error")
     149                .addClass("connect-success")
     150                .css("opacity", 0)
     151                .animate({opacity: 1}, 500);
     152
     153            bol_connection.find(".dashicons-admin-plugins")
     154                .removeClass("dashicons-admin-plugins")
     155                .addClass("dashicons-plugins-checked");
     156        }
     157
    127158        $('#connect-to-bol').on('click', function () {
    128159            $("#bol-connect-modal").modal();
     
    159190    }
    160191
    161     // This will save the bol data and trigger the save of WC data.
     192    /**
     193     * Save Bol connection data
     194     * Collects form data and sends it to the server
     195     */
    162196    function save_bol_data() {
     197        // Show loading indicator
     198        $('#save-bol-data').prop('disabled', true).html('<i class="dashicons dashicons-update-alt" style="animation: spin 2s linear infinite;"></i> Saving...');
     199
    163200        let data = {
    164201            'action': 'set_shop_2_api_information_bol',
     
    171208    }
    172209
     210    /**
     211     * Handle the response from saving Bol data
     212     * Shows error message or reloads page on success
     213     *
     214     * @param {Object} response_data - The response data from the server
     215     * @param {string} status - The status of the request
     216     */
    173217    function handle_save_bol_response(response_data, status) {
    174218        if (response_data.success == false || status == false) {
    175             $("#bol-connection-error").text("There was an issue updating the data.");
     219            $("#bol-connection-error").text("There was an issue updating the data.").fadeIn(500);
     220
     221            // Reset button
     222            $('#save-bol-data').prop('disabled', false).html('<i class="dashicons dashicons-admin-plugins"></i>');
    176223        } else {
    177             location.reload();
    178         }
    179     }
     224            // Show success message before reload
     225            $("<div class='success-message'>Connection successful! Reloading page...</div>")
     226                .appendTo("body")
     227                .fadeIn(500);
     228
     229            setTimeout(function() {
     230                location.reload();
     231            }, 1500);
     232        }
     233    }
     234
     235    // Add CSS for spin animation
     236    $("<style>@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }</style>").appendTo("head");
    180237
    181238    function get_sync_summary() {
  • shop-2-api/trunk/assets/bol2api_styles.css

    r3055588 r3308682  
    33.card {
    44    margin: 20px;
    5     border-radius: 10%;
     5    border-radius: 12px;
     6    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
     7    transition: transform 0.3s ease, box-shadow 0.3s ease;
     8    background-color: #ffffff;
     9    padding: 15px;
     10}
     11
     12.card:hover {
     13    transform: translateY(-5px);
     14    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    615}
    716
     
    1221    font-weight: bold;
    1322    line-height: 2em;
     23    color: #333;
    1424}
    1525
     
    5161/* Success/Error messages */
    5262.error-message {
    53     border-radius: 25px;
    54     background-color: rgb(240, 128, 128, 0.7);
    55     text-align: center;
    56     width: 20%;
    57     padding: 10px;
    58     margin: 20px 120px 20px 20px;
     63    border-radius: 8px;
     64    background-color: rgba(255, 76, 76, 0.9);
     65    text-align: center;
     66    width: 300px;
     67    padding: 15px;
     68    margin: 20px 20px 20px 20px;
    5969    font-weight: bold;
    60     color: red;
     70    color: white;
    6171    display: none;
    6272    position: sticky;
    6373    float: right;
     74    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
     75    animation: fadeIn 0.5s ease;
    6476}
    6577
    6678.success-message {
    67     border-radius: 25px;
    68     background-color: rgba(130, 240, 143, 0.7);
    69     text-align: center;
    70     width: 20%;
    71     padding: 10px;
    72     margin: 20px 120px 20px 20px;
     79    border-radius: 8px;
     80    background-color: rgba(76, 175, 80, 0.9);
     81    text-align: center;
     82    width: 300px;
     83    padding: 15px;
     84    margin: 20px 20px 20px 20px;
    7385    font-weight: bold;
    74     color: green;
     86    color: white;
    7587    display: none;
    7688    position: fixed;
    7789    right: 0;
     90    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
     91    animation: fadeIn 0.5s ease;
    7892}
    7993
    8094.warning-message {
    81     border-radius: 25px;
    82     background-color: orange;
    83     text-align: center;
    84     width: 20%;
    85     padding: 10px;
     95    border-radius: 8px;
     96    background-color: rgba(255, 152, 0, 0.9);
     97    text-align: center;
     98    width: 300px;
     99    padding: 15px;
    86100    margin: 5px;
    87101    font-weight: bold;
    88     color: black;
     102    color: white;
    89103    /*display: none;*/
    90104    position: fixed;
    91105    right: 0;
     106    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
     107    animation: fadeIn 0.5s ease;
     108}
     109
     110@keyframes fadeIn {
     111    from { opacity: 0; transform: translateY(-20px); }
     112    to { opacity: 1; transform: translateY(0); }
    92113}
    93114
    94115/* Style buttons */
    95116.btn {
    96     background-color: DodgerBlue; /* Blue background */
     117    background-color: #2196F3; /* Modern blue background */
    97118    border: none; /* Remove borders */
    98119    color: white; /* White text */
    99     padding: 12px 16px; /* Some padding */
     120    padding: 12px 20px; /* Increased padding */
    100121    font-size: 16px; /* Set a font size */
    101122    cursor: pointer; /* Mouse pointer on hover */
    102     border-radius: 10%;
    103 }
    104 
    105 /* Darker background on mouse-over */
     123    border-radius: 6px; /* More subtle rounded corners */
     124    transition: all 0.3s ease; /* Smooth transition for hover effects */
     125    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
     126    font-weight: 500; /* Slightly bolder text */
     127    display: inline-flex; /* For better icon alignment */
     128    align-items: center; /* Center items vertically */
     129    justify-content: center; /* Center items horizontally */
     130}
     131
     132/* Darker background on mouse-over with scale effect */
    106133.btn:hover {
    107     background-color: RoyalBlue;
     134    background-color: #0d8bf2;
     135    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
     136    transform: translateY(-2px);
     137}
     138
     139/* Active/pressed state */
     140.btn:active {
     141    transform: translateY(1px);
     142    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    108143}
    109144
    110145.btn > i {
    111     font-size: xx-large;
    112     padding-right: 10px;
    113     padding-bottom: 10px;
     146    font-size: 24px;
     147    margin-right: 10px;
    114148}
    115149
     
    124158/* LOGO */
    125159.common-header {
    126     background-color: aliceblue;
    127     box-shadow: -2px -2px 10px 0px;
     160    background-color: #f8f9fa;
     161    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    128162    width: 100%;
    129163    margin-left: -15px;
    130164    padding-left: 30px;
    131165    margin-top: -10px;
    132     padding-top: 10px;
    133     padding-bottom: 10px;
     166    padding-top: 15px;
     167    padding-bottom: 15px;
     168    border-bottom: 1px solid #e9ecef;
     169    display: flex;
     170    align-items: center;
    134171}
    135172
     
    137174.shop2api-logo {
    138175    width: 200px;
     176    transition: transform 0.3s ease;
     177}
     178
     179.shop2api-logo:hover {
     180    transform: scale(1.05);
    139181}
    140182
    141183.woocommerce-logo {
    142184    height: 90px;
     185    transition: transform 0.3s ease;
     186}
     187
     188.woocommerce-logo:hover {
     189    transform: scale(1.05);
    143190}
    144191
    145192.bol-logo {
    146193    height: 70px;
     194    transition: transform 0.3s ease;
     195}
     196
     197.bol-logo:hover {
     198    transform: scale(1.05);
    147199}
    148200
     
    176228td, th {
    177229    display: table-cell;
    178     vertical-align: inherit
     230    vertical-align: middle;
     231    padding: 10px;
    179232}
    180233
     
    182235    font-weight: bold;
    183236    text-align: left;
     237    background-color: #f5f5f5;
     238    border-bottom: 2px solid #ddd;
    184239}
    185240
    186241table {
    187242    border-collapse: collapse;
     243    width: 100%;
     244    margin-bottom: 20px;
     245    background-color: #fff;
     246    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
     247    border-radius: 4px;
     248    overflow: hidden;
     249}
     250
     251tr:nth-child(even) {
     252    background-color: #f9f9f9;
     253}
     254
     255tr:hover {
     256    background-color: #f1f1f1;
    188257}
    189258
     
    249318    border: none;
    250319    color: white;
    251     padding: 15px 32px;
     320    padding: 12px 24px;
    252321    text-align: center;
    253322    text-decoration: none;
    254     display: inline-block;
     323    display: inline-flex;
     324    align-items: center;
    255325    font-size: 16px;
    256     border-radius: 15px;
    257     cursor: pointer;
     326    border-radius: 6px;
     327    cursor: pointer;
     328    transition: all 0.3s ease;
     329    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
     330    font-weight: 500;
     331}
     332
     333.shop-2-api-connect-save:hover {
     334    background-color: #3e8e41;
     335    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
     336    transform: translateY(-2px);
     337}
     338
     339.shop-2-api-connect-save:active {
     340    transform: translateY(1px);
     341    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
     342}
     343
     344.shop-2-api-connect-save .dashicons {
     345    margin-right: 8px;
    258346}
    259347
    260348.shop-2-api-connect-save-sync {
    261     background-color: #008CBA; /* Green */
     349    background-color: #008CBA; /* Blue */
    262350    border: none;
    263351    color: white;
    264     padding: 15px 32px;
     352    padding: 12px 24px;
    265353    text-align: center;
    266354    text-decoration: none;
    267     display: inline-block;
     355    display: inline-flex;
     356    align-items: center;
    268357    font-size: 16px;
    269     border-radius: 15px;
    270     cursor: pointer;
     358    border-radius: 6px;
     359    cursor: pointer;
     360    transition: all 0.3s ease;
     361    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
     362    font-weight: 500;
     363}
     364
     365.shop-2-api-connect-save-sync:hover {
     366    background-color: #007095;
     367    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
     368    transform: translateY(-2px);
     369}
     370
     371.shop-2-api-connect-save-sync:active {
     372    transform: translateY(1px);
     373    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
     374}
     375
     376.shop-2-api-connect-save-sync .dashicons {
     377    margin-right: 8px;
    271378}
    272379
    273380.shop-2-api-connect-submit-bol-to-wc {
    274     background-color: #008CBA; /* Green */
     381    background-color: #008CBA; /* Blue */
    275382    border: none;
    276383    color: white;
    277     padding: 15px 32px;
     384    padding: 12px 24px;
    278385    text-align: center;
    279386    text-decoration: none;
    280     display: inline-block;
     387    display: inline-flex;
     388    align-items: center;
    281389    font-size: 16px;
    282     border-radius: 15px;
    283     cursor: pointer;
     390    border-radius: 6px;
     391    cursor: pointer;
     392    transition: all 0.3s ease;
     393    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
     394    font-weight: 500;
     395}
     396
     397.shop-2-api-connect-submit-bol-to-wc:hover {
     398    background-color: #007095;
     399    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
     400    transform: translateY(-2px);
     401}
     402
     403.shop-2-api-connect-submit-bol-to-wc:active {
     404    transform: translateY(1px);
     405    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
     406}
     407
     408.shop-2-api-connect-submit-bol-to-wc .dashicons {
     409    margin-right: 8px;
    284410}
    285411
     
    305431.tooltip .tooltiptext {
    306432    visibility: hidden;
    307     width: 120px;
    308     background-color: black;
     433    width: 200px;
     434    background-color: rgba(0, 0, 0, 0.8);
    309435    color: #fff;
    310436    text-align: center;
    311     padding: 5px 0;
     437    padding: 8px 12px;
    312438    border-radius: 6px;
    313 
    314     /* Position the tooltip text - see examples below! */
     439    font-size: 14px;
     440    line-height: 1.4;
     441
     442    /* Position the tooltip text */
    315443    position: absolute;
    316     z-index: 1;
     444    z-index: 100;
     445
     446    /* Fade in animation */
     447    opacity: 0;
     448    transition: opacity 0.3s, transform 0.3s;
     449    transform: translateY(10px);
    317450}
    318451
    319452.tooltip-left {
    320     left: -120px;
     453    left: -220px;
     454    top: 0;
     455}
     456
     457.tooltip-right {
     458    right: -220px;
     459    top: 0;
    321460}
    322461
     
    324463.tooltip:hover .tooltiptext {
    325464    visibility: visible;
     465    opacity: 1;
     466    transform: translateY(0);
     467}
     468
     469/* Arrow for tooltip */
     470.tooltip .tooltiptext::after {
     471    content: "";
     472    position: absolute;
     473    top: 50%;
     474    margin-top: -5px;
     475    border-width: 5px;
     476    border-style: solid;
     477}
     478
     479.tooltip-left::after {
     480    left: 100%;
     481    border-color: transparent transparent transparent rgba(0, 0, 0, 0.8);
     482}
     483
     484.tooltip-right::after {
     485    right: 100%;
     486    border-color: transparent rgba(0, 0, 0, 0.8) transparent transparent;
    326487}
    327488
  • shop-2-api/trunk/includes/Api/Shop2ApiConnect.php

    r3055588 r3308682  
    1515    public $shop_2_api_url = "";
    1616    protected $header = [];
    17 
     17    protected $timeout = 60; // Default timeout in seconds
     18
     19    /**
     20     * Constructor - initializes the connection to the Shop 2 API server
     21     * Sets up the API URL and authorization headers
     22     */
    1823    function __construct()
    1924    {
    2025        $token = esc_attr(get_option('shop2api_token'));
    21         $this->shop_2_api_url = getenv('SHOP_2_API_URL', true) ? getenv('SHOP_2_API_URL') : "https://www.shop2apidevelopment.com";
     26        $this->shop_2_api_url = getenv('SHOP_2_API_URL', true) ? getenv('SHOP_2_API_URL') : "https://shop2apidevelopment.com";
    2227        $this->header = ['Authorization' => 'Token ' . $token];
     28
     29        // Set the authurl based on environment
    2330        if (get_site_url() == 'http://localhost:8000' || get_site_url() == 'http://127.0.0.1:8000') {
    2431            $this->header = array_merge($this->header, ['authurl' => "https://shop2api.com/testshop"]);
     
    3542    }
    3643
     44    /**
     45     * Check if the connection to the API is working
     46     *
     47     * @param string|null $token Optional token to use for the check
     48     * @return bool True if connection is successful, false otherwise
     49     */
    3750    public function check_connection($token = NULL): bool
    3851    {
     
    4255
    4356        $response = wp_remote_get(
    44             $this->shop_2_api_url . '/api/orders/', ['headers' => $this->header]
    45         );
    46 
    47         update_option('shop2api_connection_succeeded', wp_remote_retrieve_response_code($response) == 200);
    48         return wp_remote_retrieve_response_code($response) == 200;
    49     }
    50 
    51     // Check if bol can connect
     57            $this->shop_2_api_url . '/api/orders/',
     58            [
     59                'headers' => $this->header,
     60                'timeout' => $this->timeout
     61            ]
     62        );
     63
     64        // Check for WP error
     65        if (is_wp_error($response)) {
     66            error_log('Shop2API Connection Error: ' . $response->get_error_message());
     67            update_option('shop2api_connection_succeeded', false);
     68            return false;
     69        }
     70
     71        $is_connected = wp_remote_retrieve_response_code($response) == 200;
     72        update_option('shop2api_connection_succeeded', $is_connected);
     73        return $is_connected;
     74    }
     75
     76    /**
     77     * Check if Bol connection is working
     78     *
     79     * @return bool True if Bol connection is successful, false otherwise
     80     */
    5281    public function check_bol_connection(): bool
    5382    {
    5483        $response = wp_remote_get(
    55             $this->shop_2_api_url . '/bol/test-connection/', ['headers' => $this->header]
    56         );
     84            $this->shop_2_api_url . '/bol/test-connection/',
     85            [
     86                'headers' => $this->header,
     87                'timeout' => $this->timeout
     88            ]
     89        );
     90
     91        // Check for WP error
     92        if (is_wp_error($response)) {
     93            error_log('Shop2API Bol Connection Error: ' . $response->get_error_message());
     94            update_option('shop2api_bol_connection_succeeded', false);
     95            return false;
     96        }
     97
    5798        $response_data = json_decode(wp_remote_retrieve_body($response), true);
    58         if (!$response_data) return False;
    59         update_option('shop2api_bol_connection_succeeded', array_key_exists('success', $response_data));
    60         return array_key_exists('success', $response_data);
    61     }
    62 
    63     // Check if wc can connect
     99        if (!$response_data) {
     100            update_option('shop2api_bol_connection_succeeded', false);
     101            return false;
     102        }
     103
     104        $is_connected = array_key_exists('success', $response_data);
     105        update_option('shop2api_bol_connection_succeeded', $is_connected);
     106        return $is_connected;
     107    }
     108
     109    /**
     110     * Check if WooCommerce connection is working
     111     *
     112     * @return bool True if WooCommerce connection is successful, false otherwise
     113     */
    64114    public function check_wc_connection(): bool
    65115    {
    66116        $response = wp_remote_get(
    67             $this->shop_2_api_url . '/woocommerce/test-connection/', ['headers' => $this->header]
    68         );
     117            $this->shop_2_api_url . '/woocommerce/test-connection/',
     118            [
     119                'headers' => $this->header,
     120                'timeout' => $this->timeout
     121            ]
     122        );
     123
     124        // Check for WP error
     125        if (is_wp_error($response)) {
     126            error_log('Shop2API WooCommerce Connection Error: ' . $response->get_error_message());
     127            update_option('shop2api_wc_connection_succeeded', false);
     128            return false;
     129        }
     130
    69131        $response_data = json_decode(wp_remote_retrieve_body($response), true);
    70         if (!$response_data) return False;
    71         update_option('shop2api_wc_connection_succeeded', array_key_exists('success', $response_data));
    72         return array_key_exists('success', $response_data);
     132        if (!$response_data) {
     133            update_option('shop2api_wc_connection_succeeded', false);
     134            return false;
     135        }
     136
     137        $is_connected = array_key_exists('success', $response_data);
     138        update_option('shop2api_wc_connection_succeeded', $is_connected);
     139        return $is_connected;
    73140    }
    74141
     
    89156    }
    90157
    91     // This will get the order and if there is no order it will die (because it is either expired or not ordered)
    92     // The order also translate the product of the user.
     158    /**
     159     * Get the first order from the API
     160     * This will get the order and if there is no order it will return an empty array
     161     * The order also translates the product of the user.
     162     *
     163     * @return array The first order or empty array if no orders found or error occurred
     164     */
    93165    public function get_order()
    94166    {
    95         $orders = wp_remote_retrieve_body($this->get_orders());
     167        $response = $this->get_orders();
     168
     169        // Check for WP error
     170        if (is_wp_error($response)) {
     171            error_log('Shop2API Error retrieving orders: ' . $response->get_error_message());
     172            return [];
     173        }
     174
     175        $orders = wp_remote_retrieve_body($response);
    96176        $json_orders = json_decode($orders, true);
    97         if (gettype($json_orders) != 'array')
    98         {
     177
     178        // Validate response data
     179        if (!is_array($json_orders)) {
    99180            return [];
    100181        }
    101         if (count($json_orders) == 0 || $json_orders == NULL) return [];
    102         if (array_key_exists('detail', $json_orders) && str_contains($json_orders["detail"], 'Invalid token')) return [];
    103         if (array_key_exists('detail', $json_orders) && str_contains($json_orders["detail"], 'inactive or deleted')) return [];
     182
     183        if (empty($json_orders) || $json_orders === NULL) {
     184            return [];
     185        }
     186
     187        // Check for API error messages
     188        if (array_key_exists('detail', $json_orders)) {
     189            if (str_contains($json_orders["detail"], 'Invalid token') ||
     190                str_contains($json_orders["detail"], 'inactive or deleted')) {
     191                return [];
     192            }
     193        }
    104194
    105195        return $json_orders[0];
     
    481571    }
    482572
    483     // Get Order data
     573    /**
     574     * Get Order data from the API
     575     *
     576     * @return array|WP_Error The response or WP_Error on failure
     577     */
    484578    public function get_order_data()
    485579    {
    486         return wp_remote_get(
    487             $this->shop_2_api_url . '/map/api/wc-order/', ['headers' => $this->header]
    488         );
     580        $response = wp_remote_get(
     581            $this->shop_2_api_url . '/map/api/wc-order/',
     582            [
     583                'headers' => $this->header,
     584                'timeout' => $this->timeout
     585            ]
     586        );
     587
     588        if (is_wp_error($response)) {
     589            error_log('Shop2API Error getting order data: ' . $response->get_error_message());
     590        }
     591
     592        return $response;
    489593    }
    490594
  • shop-2-api/trunk/readme.txt

    r3248682 r3308682  
    92921) Description and link updates
    9393
     94= 1.0.32.2 =
     951) URL Update
     96
    9497== Instructions ==
    95981) After installing Shop2Api, a new menu item will be available in your WordPress installation, you can continue and click on it and enter your e-mail address.
  • shop-2-api/trunk/shop-2-api.php

    r3248677 r3308682  
    55Plugin URI: https://wordpress.org/plugins/shop-2-api/
    66Description: The plugin Shop2Api will sync products between e-Commerce platforms. The current supported e-Commerce platforms are WooCommerce to Bol.com, and we are working on Amazon, Shopify and others.  We added a koopblok service so that you can check if you lower your price can you get koopblok.
    7 Version: 1.0.32.1
     7Version: 1.0.32.2
    88Requires at least: 5.0
    99Requires PHP:      7.2
     
    1212License: GPLv2 or later
    1313Text Domain: shop2API
    14 Stable tag: 1.0.32.1
     14Stable tag: 1.0.32.2
    1515Short Description: Sync products between e-Commerce platforms like WooCommerce, Bol.com.
    1616 */
  • shop-2-api/trunk/templates/dashboard.php

    r3058328 r3308682  
    189189                    <label for="sync-wc-product">Sync Products/Offers/Stock Manually</label>
    190190                    </p>
    191                     <button id="sync-wc-product" class="shop-2-api-connect-save">Sync</button>
     191                    <button id="sync-wc-product" class="shop-2-api-connect-save">
     192                        <span class="dashicons dashicons-update"></span> Sync
     193                    </button>
    192194                </div>
    193195                <div>
     
    195197                        <label for="refresh-dropdowns">Refresh Category/Attribute Dropdowns</label>
    196198                    </p>
    197                     <button id="refresh-dropdowns" class="shop-2-api-connect-save">Refresh</button>
     199                    <button id="refresh-dropdowns" class="shop-2-api-connect-save">
     200                        <span class="dashicons dashicons-update"></span> Refresh
     201                    </button>
    198202                </div>
    199203            </div>
Note: See TracChangeset for help on using the changeset viewer.