Plugin Directory

Changeset 3136056


Ignore:
Timestamp:
08/15/2024 10:48:07 AM (20 months ago)
Author:
Easify
Message:

Version 4.36

Location:
easify-server-woocommerce/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • easify-server-woocommerce/trunk/includes/class-easify-generic-easify-server.php

    r2926676 r3136056  
    11<?php
    22
     3require_once('class-easify-compression.php');
     4
    35/**
    4  * Copyright (C) 2023  Easify Ltd (email:support@easify.co.uk)
     6 * Copyright (C) 2024  Easify Ltd (email:support@easify.co.uk)
    57 * This program is free software; you can redistribute it and/or
    68 * modify it under the terms of the GNU General Public License
     
    2830 *
    2931 * @class       Easify_Generic_Easify_Server
    30  * @version     4.35
     32 * @version     4.36
    3133 * @package     easify-woocommerce-connector
    3234 * @author      Easify
     
    205207            }
    206208
    207             Easify_Logging::Log('Could not communicate with Easify Server -  http response code: ' . $info['http_code']);
    208             throw new Exception('Could not communicate with Easify Server -  http response code: ' . $info['http_code']);
     209            Easify_Logging::Log('Could not communicate with Easify Server -  http response code: ' . $info['http_code'] . ' $url: ' . $url);
     210            throw new Exception('Could not communicate with Easify Server -  http response code: ' . $info['http_code'] . ' $url: ' . $url);
    209211        }
    210212
     
    221223    }
    222224
    223     private function GetJsonFromEasifyServer($entity, $key) {
     225    private function GetJsonFromEasify(){
     226        Easify_Logging::Log("Easify_Generic_Easify_Server.GetJsonFromEasify()");
     227
     228        $args = func_get_args();
     229        $numArgs = func_num_args();
     230
     231        Easify_Logging::Log("Easify_Generic_Easify_Server.GetJsonFromEasify() - Num Args: " . $numArgs);
     232
     233        if ($numArgs == 2) {
     234            return $this->GetJsonFromEasifyServer($args[0], $args[1]);
     235        } elseif ($numArgs == 4) {
     236            return $this->GetJsonFromEasifyServerThreeParms($args[0], $args[1], $args[2], $args[3]);
     237        } else {
     238            Easify_Logging::Log("Easify_Generic_Easify_Server.GetJsonFromEasify() - ERROR: Invalid arguments");
     239            throw new InvalidArgumentException("Invalid arguments");
     240        }
     241    }
     242
     243    private function GetJsonFromEasifyServer($entity, $key)
     244    {
    224245        Easify_Logging::Log("Easify_Generic_Easify_Server.GetJsonFromEasifyServer() - Entity: " . $entity . " Key: " . $key);
    225246
     
    363384        $xpath = $this->GetFromEasify('Products_GetImages?productInfoId=' . $ProductInfoId . '&width=0&height=0', null);
    364385       
     386        Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImages() - Getting $serialisedXml.');
     387
    365388        $serialisedXml = $xpath->query('/d:Products_GetImages')->item(0)->nodeValue;
    366389               
     390        Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImages() - Got $serialisedXml: ' . $serialisedXml);
     391
    367392        // The string comes back as UTF-16, change it to UTF-8.
    368393        $xmlString = str_replace("utf-16", "utf-8", $serialisedXml);
     
    370395        //Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImages() - Products_GetImages:' . $serialisedString);
    371396                     
     397        $decodedXmlString = base64_decode($xmlString);
     398
     399        Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImages() - $decodedXmlString: ' . $decodedXmlString);
     400
    372401        $xml = new SimpleXMLElement($xmlString);
    373402     
     403        Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImages() - $xml: ' . $xml);
     404
    374405        $imageList = array();       
    375406        foreach($xml as $rawImage) {
     
    382413    }
    383414
    384     public function GetEasifyOrderStatuses() {
     415    /**
     416     * This function gets the product images for the specified product id from an easify Server using the
     417     * new V5 technique which is to get a compressed escaped json string as opposed to V4 which used uncompressed XML.
     418     */
     419    public function GetProductInfoImagesV5($ProductInfoId)
     420    {
     421        Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImagesV5() - $ProductInfoId:' . $ProductInfoId);
     422
     423        // The product images in Easify V4.56 and later must be retrieved via a Webget method
     424        // because the images may be stored on the Easify Server local disk instead of in the
     425        // ProductInfoImages database table. Always use the Products_GetImages method to retrieve images.
     426        // Speficy width and height as zero to get images at full size. You can specify the width or height
     427        // if you want the images to be sent to you at the specified width or height.
     428
     429        Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImagesV5() - Getting $compressedJson');
     430
     431        $url = $this->server_url . "/Products_GetImages?productInfoId=" . $ProductInfoId . '&width=0&height=0';
     432
     433        $jsonResponse = $this->GetFromEasifyServer($url);
     434
     435        $data = json_decode($jsonResponse, true);
     436
     437        $compressedJson = $data['value'];
     438
     439        $decompressedJson = decompressString($compressedJson);
     440
     441        $imageList = array();
     442        foreach ($decompressedJson as $rawImage) {
     443            Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImagesV5() - Processing image: ' . $rawImage["Name"]);
     444            array_push($imageList, $rawImage["Bytes"]);
     445        }
     446
     447        Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImagesV5() - Returning ' . count($imageList) . ' images.');
     448        return $imageList;
     449    }
     450
     451
     452public function GetEasifyOrderStatuses(){
    385453        $xpath = $this->GetFromEasify('OrderStatuses', null);
    386454
  • easify-server-woocommerce/trunk/includes/class-easify-wc-shop.php

    r2653157 r3136056  
    22
    33/**
    4  * Copyright (C) 2020  Easify Ltd (email:support@easify.co.uk)
     4 * Copyright (C) 2024  Easify Ltd (email:support@easify.co.uk)
    55 * This program is free software; you can redistribute it and/or
    66 * modify it under the terms of the GNU General Public License
     
    2828 *
    2929 * @class       Easify_Generic_Shop
    30  * @version     4.34
     30 * @version     4.36
    3131 * @package     easify-woocommerce-connector
    3232 * @author      Easify
     
    533533            // calculate price from retail margin and cost price
    534534            $Price = round(($Product->CostPrice / (100 - $Product->RetailMargin) * 100), 4);
     535
     536            Easify_Logging::Log("Easify_WC_Shop.UpdateProduct() - Calculated price: " . $Price);
    535537
    536538            // catch reserved delivery SKUs and update delivery prices
     
    11001102        // Determine which version of Easify Server we're talking to and use
    11011103        // relevant code to get product info...
     1104        $serverMajorVersion = $this->easify_server->GetEasifyServerMajorVersion();
    11021105        $serverMinorVersion = $this->easify_server->GetEasifyServerMinorVersion();
    11031106       
     1107        Easify_Logging::Log("Easify_WC_Shop.UpdateProductInformation() - Server major version:" . $serverMajorVersion);
    11041108        Easify_Logging::Log("Easify_WC_Shop.UpdateProductInformation() - Server minor version:" . $serverMinorVersion);
    11051109       
    1106         if ($serverMinorVersion < 56)
     1110        if ($serverMajorVersion == 4 && $serverMinorVersion < 56)
    11071111        {
    11081112            Easify_Logging::Log("Easify_WC_Shop.UpdateProductInformation() - Using legacy product info code.");
     
    11321136           
    11331137            // Get product images...
     1138            if ($serverMajorVersion < 5){
     1139                Easify_Logging::Log("Easify_WC_Shop.UpdateProductInformation() - Version " . $serverMajorVersion . " getting images V4 style.");
    11341140            $images = $this->easify_server->GetProductInfoImages($ProductInfo['Id']);
     1141            } else{
     1142                Easify_Logging::Log("Easify_WC_Shop.UpdateProductInformation() - Version " . $serverMajorVersion . " getting images V5 style.");
     1143                $images = $this->easify_server->GetProductInfoImagesV5($ProductInfo['Id']);
     1144            }
     1145
     1146            Easify_Logging::Log("Easify_WC_Shop.UpdateProductInformation() - Got images.");
    11351147           
    11361148            // Save images...           
     
    12261238            update_post_meta($ProductId, '_thumbnail_id', $imageIds[0]);
    12271239
     1240            // Remove the first image from the gallery array
     1241            $galleryImages = array_slice($imageIds, 1);
     1242
    12281243            // Create comma separated list of gallery images...
    1229             $galleryImageList = implode(',', $imageIds);
     1244            $galleryImageList = implode(',', $galleryImages);
    12301245
    12311246            Easify_Logging::Log("Easify_WC_Shop.SaveProductImagesToWooCommerce() - Gallery Images:" . $galleryImageList);         
  • easify-server-woocommerce/trunk/readme.txt

    r2926676 r3136056  
    44Tags: easify, epos, epos software, stock control software, accounting software, invoicing software, small business software, ecommerce, e-commerce, woothemes, wordpress ecommerce, woocommerce, shopping cart
    55Requires at least: 5.0
    6 Tested up to: 6.2.2
    7 Stable tag: 4.35
     6Tested up to: 6.6.1
     7Stable tag: 4.36
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    10 WC tested up to: 7.8
    11 
    12 Connects Easify V4.x Small Business Software to your WooCommerce online shop,
     10WC tested up to: 9.0
     11
     12Connects Easify Business Software to your WooCommerce online shop,
    1313allowing you to synchronise stock levels between your physical shop and your
    1414online shop.
     
    1616== Description ==
    1717 
    18 This plugin connects your Easify V4.x Small Business software with your
     18This plugin connects your Easify Business software with your
    1919WooCommerce online shop.
    2020
     
    6363EPOS software, accounting, reporting and more...
    6464
    65 = What does the Easify V4.x WooCommerce Connector do? =
    66 
    67 This plugin connects your Easify V4.x Small Business Software with your
     65= What does the Easify WooCommerce Connector do? =
     66
     67This plugin connects your Easify Business Software with your
    6868WooCommerce online shop.
    6969
    70 Easify V4.x gives you EPOS, Stock Control, Billing, Purchasing and Accounting
     70Easify gives you EPOS, Stock Control, Billing, Purchasing and Accounting
    7171all in one easy to use package.
    7272
     
    7474enabled website will be automatically sent to your Easify Server.
    7575
    76 Products that you add to your Easify Server using Easify Pro V4.x will be
     76Products that you add to your Easify Server using Easify Pro will be
    7777automatically uploaded to your WooCommerce enabled website.
    7878
     
    8080automatically synchronised with your WooCommerce online shop.
    8181
    82 = Where do I get Easify V4.x Software? =
    83 You can purchase Easify from our website - <http://www.easify.co.uk>
     82= Where do I get Easify Software? =
     83You can purchase Easify from our website - <https://www.easify.co.uk>
    8484
    8585= Where do I get support? =
    8686
    87 <http://www.easify.co.uk/support/contact>
    8887support@easify.co.uk
    89 +44 (0)1223 750350
     88
    9089
    9190== Screenshots ==
     
    101100
    102101== Changelog ==
     102= 4.36 =
     103* Support for Easify Version 5.
     104* Fixed issue where main product image would appear twice if multiple images present.
    103105= 4.35 =
    104106* Added support for WooCommerce Local Pickup delivery option.
     
    213215
    214216== Upgrade Notice ==
    215 = 4.35 =
    216 * Added support for WooCommerce Local Pickup delivery option.
    217 * Improved logging to assist with troubleshooting Easify Server connection problems.
    218 * Tested compatibility with PHP 8.x
     217= 4.36 =
     218* Support for Easify Version 5.
     219* Fixed issue where main product image would appear twice if multiple images present.
Note: See TracChangeset for help on using the changeset viewer.