Changeset 3136056
- Timestamp:
- 08/15/2024 10:48:07 AM (20 months ago)
- Location:
- easify-server-woocommerce/trunk
- Files:
-
- 1 added
- 3 edited
-
includes/class-easify-compression.php (added)
-
includes/class-easify-generic-easify-server.php (modified) (7 diffs)
-
includes/class-easify-wc-shop.php (modified) (6 diffs)
-
readme.txt (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easify-server-woocommerce/trunk/includes/class-easify-generic-easify-server.php
r2926676 r3136056 1 1 <?php 2 2 3 require_once('class-easify-compression.php'); 4 3 5 /** 4 * Copyright (C) 202 3Easify Ltd (email:support@easify.co.uk)6 * Copyright (C) 2024 Easify Ltd (email:support@easify.co.uk) 5 7 * This program is free software; you can redistribute it and/or 6 8 * modify it under the terms of the GNU General Public License … … 28 30 * 29 31 * @class Easify_Generic_Easify_Server 30 * @version 4.3 532 * @version 4.36 31 33 * @package easify-woocommerce-connector 32 34 * @author Easify … … 205 207 } 206 208 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); 209 211 } 210 212 … … 221 223 } 222 224 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 { 224 245 Easify_Logging::Log("Easify_Generic_Easify_Server.GetJsonFromEasifyServer() - Entity: " . $entity . " Key: " . $key); 225 246 … … 363 384 $xpath = $this->GetFromEasify('Products_GetImages?productInfoId=' . $ProductInfoId . '&width=0&height=0', null); 364 385 386 Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImages() - Getting $serialisedXml.'); 387 365 388 $serialisedXml = $xpath->query('/d:Products_GetImages')->item(0)->nodeValue; 366 389 390 Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImages() - Got $serialisedXml: ' . $serialisedXml); 391 367 392 // The string comes back as UTF-16, change it to UTF-8. 368 393 $xmlString = str_replace("utf-16", "utf-8", $serialisedXml); … … 370 395 //Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImages() - Products_GetImages:' . $serialisedString); 371 396 397 $decodedXmlString = base64_decode($xmlString); 398 399 Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImages() - $decodedXmlString: ' . $decodedXmlString); 400 372 401 $xml = new SimpleXMLElement($xmlString); 373 402 403 Easify_Logging::Log('Easify_Generic_Easify_Server->GetProductInfoImages() - $xml: ' . $xml); 404 374 405 $imageList = array(); 375 406 foreach($xml as $rawImage) { … … 382 413 } 383 414 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 452 public function GetEasifyOrderStatuses(){ 385 453 $xpath = $this->GetFromEasify('OrderStatuses', null); 386 454 -
easify-server-woocommerce/trunk/includes/class-easify-wc-shop.php
r2653157 r3136056 2 2 3 3 /** 4 * Copyright (C) 202 0Easify Ltd (email:support@easify.co.uk)4 * Copyright (C) 2024 Easify Ltd (email:support@easify.co.uk) 5 5 * This program is free software; you can redistribute it and/or 6 6 * modify it under the terms of the GNU General Public License … … 28 28 * 29 29 * @class Easify_Generic_Shop 30 * @version 4.3 430 * @version 4.36 31 31 * @package easify-woocommerce-connector 32 32 * @author Easify … … 533 533 // calculate price from retail margin and cost price 534 534 $Price = round(($Product->CostPrice / (100 - $Product->RetailMargin) * 100), 4); 535 536 Easify_Logging::Log("Easify_WC_Shop.UpdateProduct() - Calculated price: " . $Price); 535 537 536 538 // catch reserved delivery SKUs and update delivery prices … … 1100 1102 // Determine which version of Easify Server we're talking to and use 1101 1103 // relevant code to get product info... 1104 $serverMajorVersion = $this->easify_server->GetEasifyServerMajorVersion(); 1102 1105 $serverMinorVersion = $this->easify_server->GetEasifyServerMinorVersion(); 1103 1106 1107 Easify_Logging::Log("Easify_WC_Shop.UpdateProductInformation() - Server major version:" . $serverMajorVersion); 1104 1108 Easify_Logging::Log("Easify_WC_Shop.UpdateProductInformation() - Server minor version:" . $serverMinorVersion); 1105 1109 1106 if ($serverM inorVersion < 56)1110 if ($serverMajorVersion == 4 && $serverMinorVersion < 56) 1107 1111 { 1108 1112 Easify_Logging::Log("Easify_WC_Shop.UpdateProductInformation() - Using legacy product info code."); … … 1132 1136 1133 1137 // Get product images... 1138 if ($serverMajorVersion < 5){ 1139 Easify_Logging::Log("Easify_WC_Shop.UpdateProductInformation() - Version " . $serverMajorVersion . " getting images V4 style."); 1134 1140 $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."); 1135 1147 1136 1148 // Save images... … … 1226 1238 update_post_meta($ProductId, '_thumbnail_id', $imageIds[0]); 1227 1239 1240 // Remove the first image from the gallery array 1241 $galleryImages = array_slice($imageIds, 1); 1242 1228 1243 // Create comma separated list of gallery images... 1229 $galleryImageList = implode(',', $ imageIds);1244 $galleryImageList = implode(',', $galleryImages); 1230 1245 1231 1246 Easify_Logging::Log("Easify_WC_Shop.SaveProductImagesToWooCommerce() - Gallery Images:" . $galleryImageList); -
easify-server-woocommerce/trunk/readme.txt
r2926676 r3136056 4 4 Tags: easify, epos, epos software, stock control software, accounting software, invoicing software, small business software, ecommerce, e-commerce, woothemes, wordpress ecommerce, woocommerce, shopping cart 5 5 Requires at least: 5.0 6 Tested up to: 6. 2.27 Stable tag: 4.3 56 Tested up to: 6.6.1 7 Stable tag: 4.36 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 WC tested up to: 7.811 12 Connects Easify V4.x Small Business Software to your WooCommerce online shop,10 WC tested up to: 9.0 11 12 Connects Easify Business Software to your WooCommerce online shop, 13 13 allowing you to synchronise stock levels between your physical shop and your 14 14 online shop. … … 16 16 == Description == 17 17 18 This plugin connects your Easify V4.x Small Business software with your18 This plugin connects your Easify Business software with your 19 19 WooCommerce online shop. 20 20 … … 63 63 EPOS software, accounting, reporting and more... 64 64 65 = What does the Easify V4.xWooCommerce Connector do? =66 67 This plugin connects your Easify V4.x Small Business Software with your65 = What does the Easify WooCommerce Connector do? = 66 67 This plugin connects your Easify Business Software with your 68 68 WooCommerce online shop. 69 69 70 Easify V4.x gives you EPOS, Stock Control, Billing, Purchasing and Accounting70 Easify gives you EPOS, Stock Control, Billing, Purchasing and Accounting 71 71 all in one easy to use package. 72 72 … … 74 74 enabled website will be automatically sent to your Easify Server. 75 75 76 Products that you add to your Easify Server using Easify Pro V4.x will be76 Products that you add to your Easify Server using Easify Pro will be 77 77 automatically uploaded to your WooCommerce enabled website. 78 78 … … 80 80 automatically synchronised with your WooCommerce online shop. 81 81 82 = Where do I get Easify V4.xSoftware? =83 You can purchase Easify from our website - <http ://www.easify.co.uk>82 = Where do I get Easify Software? = 83 You can purchase Easify from our website - <https://www.easify.co.uk> 84 84 85 85 = Where do I get support? = 86 86 87 <http://www.easify.co.uk/support/contact>88 87 support@easify.co.uk 89 +44 (0)1223 750350 88 90 89 91 90 == Screenshots == … … 101 100 102 101 == Changelog == 102 = 4.36 = 103 * Support for Easify Version 5. 104 * Fixed issue where main product image would appear twice if multiple images present. 103 105 = 4.35 = 104 106 * Added support for WooCommerce Local Pickup delivery option. … … 213 215 214 216 == 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.