Changeset 2289263
- Timestamp:
- 04/22/2020 12:52:09 PM (6 years ago)
- Location:
- easify-server-woocommerce/trunk
- Files:
-
- 5 edited
-
easify.php (modified) (2 diffs)
-
includes/class-easify-wc-easify-options.php (modified) (2 diffs)
-
includes/class-easify-wc-plugin-settings-page.php (modified) (5 diffs)
-
includes/class-easify-wc-shop.php (modified) (10 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easify-server-woocommerce/trunk/easify.php
r2228353 r2289263 5 5 * Plugin URI: http://www.easify.co.uk/wordpress/ 6 6 * Description: Connects Easify Business Management, EPOS (Electronic Point of Sale) and invoicing software to your WooCommerce enabled WordPress website. Allowing you to keep your online and offline shop's orders and stock control synchronised. 7 * Version: 4.1 77 * Version: 4.19 8 8 * License: GPL2 9 9 * License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 11 11 * Author URI: http://www.easify.co.uk/ 12 12 * Requires at least: 4.0 13 * Tested up to: 5. 3.213 * Tested up to: 5.4 14 14 */ 15 15 -
easify-server-woocommerce/trunk/includes/class-easify-wc-easify-options.php
r2228332 r2289263 23 23 * 24 24 * @class Easify_WC_Easify_Options 25 * @version 4.1 625 * @version 4.19 26 26 * @package easify-woocommerce-connector 27 27 * @author Easify … … 76 76 return false; 77 77 } 78 79 /** 80 * Determines whether Easify products should be uploaded to website. 81 * 82 * @return boolean 83 */ 84 public function get_easify_dont_upload_products() { 85 if (isset($this->product_options['easify_dont_upload_products'])) { 86 return $this->product_options['easify_dont_upload_products']; 87 } 88 89 return false; 90 } 91 92 /** 93 * Determines whether Easify product price changes should be uploaded to website. 94 * 95 * @return boolean 96 */ 97 public function get_easify_dont_update_product_prices() { 98 if (isset($this->product_options['easify_dont_update_product_prices'])) { 99 return $this->product_options['easify_dont_update_product_prices']; 100 } 101 102 return false; 103 } 104 105 /** 106 * Determines whether Easify product stock level changes should be uploaded to website. 107 * 108 * @return boolean 109 */ 110 public function get_easify_dont_update_product_stock_levels() { 111 if (isset($this->product_options['easify_dont_update_product_stock_levels'])) { 112 return $this->product_options['easify_dont_update_product_stock_levels']; 113 } 114 115 return false; 116 } 78 117 79 118 /** -
easify-server-woocommerce/trunk/includes/class-easify-wc-plugin-settings-page.php
r2228332 r2289263 30 30 * 31 31 * @class Easify_WC__Plugin_Settings_Page 32 * @version 4.1 532 * @version 4.19 33 33 * @package easify-woocommerce-connector 34 34 * @author Easify … … 709 709 710 710 add_settings_field( 711 'easify_dont_upload_products', // id 712 'Product Updates', // title 713 array($this, 'setting_html_easify_dont_upload_products'), // callback 714 'easify_options_page_products', // page 715 'easify_options_section_products' // section 716 ); 717 718 add_settings_field( 719 'easify_dont_update_product_prices', // id 720 '', // title 721 array($this, 'setting_html_easify_dont_update_product_prices'), // callback 722 'easify_options_page_products', // page 723 'easify_options_section_products' // section 724 ); 725 726 add_settings_field( 727 'easify_dont_update_product_stock_levels', // id 728 '', // title 729 array($this, 'setting_html_easify_dont_update_product_stock_levels'), // callback 730 'easify_options_page_products', // page 731 'easify_options_section_products' // section 732 ); 733 734 735 add_settings_field( 711 736 'easify_dont_overwrite_woo_categories', // id 712 ' Product Updates', // title737 '', // title 713 738 array($this, 'setting_html_easify_dont_overwrite_woo_categories_enable'), // callback 714 739 'easify_options_page_products', // page … … 734 759 } 735 760 761 762 /** 763 * HTML to display the easify_dont_upload_products config option 764 */ 765 public function setting_html_easify_dont_upload_products() { 766 echo '<div class="easify-loggin-option">Don't Upload Products from Easify '; 767 768 printf('<input type="checkbox" name="easify_options_products[easify_dont_upload_products]" id="easify_dont_upload_products" value="true" %s/>', 769 isset($this->options['easify_options_products']['easify_dont_upload_products']) && 770 $this->options['easify_options_products']['easify_dont_upload_products'] == 'true' ? 'checked="checked"' : '' 771 ); 772 773 $this->tool_tip('easify_dont_upload_products-tip'); 774 echo '</div>'; 775 } 776 777 778 /** 779 * HTML to display the easify_dont_update_product_prices config option 780 */ 781 public function setting_html_easify_dont_update_product_prices() { 782 echo '<div class="easify-loggin-option">Don't Update Prices from Easify '; 783 784 printf('<input type="checkbox" name="easify_options_products[easify_dont_update_product_prices]" id="easify_dont_update_product_prices" value="true" %s/>', 785 isset($this->options['easify_options_products']['easify_dont_update_product_prices']) && 786 $this->options['easify_options_products']['easify_dont_update_product_prices'] == 'true' ? 'checked="checked"' : '' 787 ); 788 789 $this->tool_tip('easify_dont_update_product_prices-tip'); 790 echo '</div>'; 791 } 792 793 794 795 /** 796 * HTML to display the easify_dont_update_product_prices config option 797 */ 798 public function setting_html_easify_dont_update_product_stock_levels() { 799 echo '<div class="easify-loggin-option">Don't Update Stock Levels from Easify '; 800 801 printf('<input type="checkbox" name="easify_options_products[easify_dont_update_product_stock_levels]" id="easify_dont_update_product_stock_levels" value="true" %s/>', 802 isset($this->options['easify_options_products']['easify_dont_update_product_stock_levels']) && 803 $this->options['easify_options_products']['easify_dont_update_product_stock_levels'] == 'true' ? 'checked="checked"' : '' 804 ); 805 806 $this->tool_tip('easify_dont_update_product_stock_levels-tip'); 807 echo '</div>'; 808 } 809 810 811 812 736 813 /** 737 814 * HTML to display the easify_dont_overwrite_woo_categories_enable config option … … 1699 1776 1700 1777 <!-- OPTIONS PRODUCTS --> 1778 <div id="easify_dont_upload_products-tip"> 1779 <h3>Product Updates - Don't Upload Products from Easify</h3> 1780 <p>If you tick this option, products that are published in Easify will not be uploaded to the website.</p> 1781 <p>This is useful if you want to manage your products in WooCommerce and link them to your products in 1782 Easify, or if you already have many existing products in WooCommerce and don't want to re-create them in Easify.</p> 1783 <p>With this option, you will still need to create the product in Easify Pro and publish it, but the product 1784 will not be uploaded to WooCommerce.</p> 1785 <p>You will also need to make sure you have entered the product Easify SKU value in the SKU field on the 1786 WooCommerce product page Inventory tab in order to link the Easify Prosuct with the WooCommerce Product.</p> 1787 <?= $this->tooltip_click_here_link('easify-dont-upload-products') ?> 1788 </div> 1789 1790 <div id="easify_dont_update_product_prices-tip"> 1791 <h3>Product Updates - Don't Update Prices from Easify</h3> 1792 <p>If you tick this option, any price changes you make to the product in Easify will not be sent to the website.</p> 1793 <p>This is useful if you want to have different pricing on your website than you do in Easify.</p> 1794 <p>For example this will allow you to have different prices in your shop and on your website.</p> 1795 <?= $this->tooltip_click_here_link('easify-dont-update-product-prices') ?> 1796 </div> 1797 1798 <div id="easify_dont_update_product_stock_levels-tip"> 1799 <h3>Product Updates - Don't Update Stock Levels from Easify</h3> 1800 <p>If you tick this option, any stock level changes you make to the product in Easify will not be sent to the website.</p> 1801 <p>This will mean that as you sell products via Easify either via the back-end or via the POS, the stock level 1802 changes will not be sent to your website.</p> 1803 <p>This might be useful if you wanted to maintain separate stock levels for your website and your premises.</p> 1804 <?= $this->tooltip_click_here_link('easify-dont-update-product-stock-levels') ?> 1805 </div> 1806 1807 1701 1808 <div id="overwrite_woo_categories-tip"> 1702 1809 <h3>Product Updates - Don't Overwrite WooCommerce Categories</h3> … … 1726 1833 product price and stock level changes will be uploaded to WooCommerce. Editing the product image, 1727 1834 tags, description etc... will not modify the product in WooCommerce.</p> 1835 <p><strong>Note:</strong> You can also prevent product price and stock level changes from being uploaded using 1836 the options above.</p> 1728 1837 <?= $this->tooltip_click_here_link('ignore-product-updates') ?> 1729 1838 </div> -
easify-server-woocommerce/trunk/includes/class-easify-wc-shop.php
r2228353 r2289263 28 28 * 29 29 * @class Easify_Generic_Shop 30 * @version 4.1 730 * @version 4.19 31 31 * @package easify-woocommerce-connector 32 32 * @author Easify … … 68 68 Easify_Logging::Log('Easify_WC_Shop.InsertProduct()'); 69 69 70 // Determine whether ignore product uploads 71 if ($this->easify_options->get_easify_dont_upload_products()) 72 { 73 Easify_Logging::Log('Easify_WC_Shop.InsertProduct() - Easify plugin settings dictate ignore product uploads. Not uploading.'); 74 return; 75 } 76 70 77 // Get product from Easify Server 71 78 … … 209 216 /* @var $Product ProductDetails */ 210 217 218 219 // Determine whether ignore product uploads 220 if ($this->easify_options->get_easify_dont_upload_products()) 221 { 222 Easify_Logging::Log('Easify_WC_Shop.UpdateProduct() - Easify plugin settings dictate ignore product uploads. Not uploading.'); 223 return; 224 } 225 211 226 if ($this->easify_options->get_easify_ignore_product_updates()) 212 227 { … … 238 253 $Price = round(($Product->CostPrice / (100 - $Product->RetailMargin) * 100), 4); 239 254 240 // catch reserved delivery SKUs and update delivery prices 241 if ($this->UpdateDeliveryPrice($Product->SKU, $Price)) 242 { 243 Easify_Logging::Log("Easify_WC_Shop.UpdateProduct() - Product was delivery SKU, updated price and nothing more to do."); 244 return; 245 } 246 255 256 // Determine whether ignore product price changes 257 if (!$this->easify_options->get_easify_dont_update_product_prices()) 258 { 259 // catch reserved delivery SKUs and update delivery prices 260 if ($this->UpdateDeliveryPrice($Product->SKU, $Price)) 261 { 262 Easify_Logging::Log("Easify_WC_Shop.UpdateProduct() - Product was delivery SKU, updated price and nothing more to do."); 263 return; 264 } 265 } 266 247 267 // sanitise weight value 248 268 $Product->Weight = (isset($Product->Weight) && is_numeric($Product->Weight) ? $Product->Weight : 0); … … 271 291 } 272 292 273 274 275 293 // get WooCommerce product id from Easify SKU 276 294 $ProductId = $this->GetWooCommerceProductIdFromEasifySKU($Product->SKU); … … 305 323 */ 306 324 307 // pricing 308 update_post_meta($ProductId, '_sku', $Product->SKU); 309 update_post_meta($ProductId, '_price', $Price); 310 update_post_meta($ProductId, '_regular_price', $Price); 311 update_post_meta($ProductId, '_sale_price', $Price); 312 update_post_meta($ProductId, '_sale_price_dates_from ', ''); 313 update_post_meta($ProductId, '_sale_price_dates_to', ''); 314 update_post_meta($ProductId, '_tax_status', 'taxable'); 315 update_post_meta($ProductId, '_tax_class', strtolower($TaxClass)); 316 317 // handling stock - we get free stock minus allocated stock 318 $stockLevel = $Product->StockLevel - $this->easify_server->get_allocation_count_by_easify_sku($Product->SKU); 319 320 // WooCommerce has a separate status value for in stock / out of stock, set it 321 // according to stock level... 322 if ($stockLevel > 0) 323 { 324 $this->DeleteOutofStockTermRelationship($ProductId); 325 update_post_meta($ProductId, '_stock_status', 'instock'); 326 } 327 else 328 { 329 update_post_meta($ProductId, '_stock_status', 'outofstock'); 330 } 331 332 update_post_meta($ProductId, '_manage_stock', 'yes'); 333 update_post_meta($ProductId, '_downloadable', 'no'); 334 update_post_meta($ProductId, '_virtual', 'no'); 335 update_post_meta($ProductId, '_visibility', 'visible'); 336 update_post_meta($ProductId, '_sold_individually', ''); 337 update_post_meta($ProductId, '_manage_stock', 'yes'); 338 update_post_meta($ProductId, '_backorders', 'no'); 339 340 // This needs to be free stock level not on hand stock level (Stock level minus amount of stock allocated to other orders)... 341 Easify_Logging::Log("Easify_WC_Shop.UpdateProduct() - Updating stock level."); 342 update_post_meta($ProductId, '_stock', $stockLevel); 343 325 if (!$this->easify_options->get_easify_dont_update_product_prices()) 326 { 327 // pricing 328 update_post_meta($ProductId, '_sku', $Product->SKU); 329 update_post_meta($ProductId, '_price', $Price); 330 update_post_meta($ProductId, '_regular_price', $Price); 331 update_post_meta($ProductId, '_sale_price', $Price); 332 update_post_meta($ProductId, '_sale_price_dates_from ', ''); 333 update_post_meta($ProductId, '_sale_price_dates_to', ''); 334 update_post_meta($ProductId, '_tax_status', 'taxable'); 335 update_post_meta($ProductId, '_tax_class', strtolower($TaxClass)); 336 } 337 338 339 if (!$this->easify_options->get_easify_dont_update_product_stock_levels()) 340 { 341 // handling stock - we get free stock minus allocated stock 342 $stockLevel = $Product->StockLevel - $this->easify_server->get_allocation_count_by_easify_sku($Product->SKU); 343 344 // WooCommerce has a separate status value for in stock / out of stock, set it 345 // according to stock level... 346 if ($stockLevel > 0) 347 { 348 $this->DeleteOutofStockTermRelationship($ProductId); 349 update_post_meta($ProductId, '_stock_status', 'instock'); 350 } 351 else 352 { 353 update_post_meta($ProductId, '_stock_status', 'outofstock'); 354 } 355 356 update_post_meta($ProductId, '_manage_stock', 'yes'); 357 update_post_meta($ProductId, '_downloadable', 'no'); 358 update_post_meta($ProductId, '_virtual', 'no'); 359 update_post_meta($ProductId, '_visibility', 'visible'); 360 update_post_meta($ProductId, '_sold_individually', ''); 361 update_post_meta($ProductId, '_manage_stock', 'yes'); 362 update_post_meta($ProductId, '_backorders', 'no'); 363 364 // This needs to be free stock level not on hand stock level (Stock level minus amount of stock allocated to other orders)... 365 Easify_Logging::Log("Easify_WC_Shop.UpdateProduct() - Updating stock level."); 366 update_post_meta($ProductId, '_stock', $stockLevel); 367 } 368 344 369 // physical properties 345 370 update_post_meta($ProductId, '_weight', $Product->Weight); … … 377 402 /* @var $Product ProductDetails */ 378 403 Easify_Logging::Log('Easify_WC_Shop.UpdateProductStockLevel()'); 404 405 // Determine whether ignore stock level changes 406 if ($this->easify_options->get_easify_dont_update_product_stock_levels()) 407 { 408 Easify_Logging::Log('Easify_WC_Shop.UpdateProductStockLevel() - Easify plugin settings dictate ignore product stock level changes. Not updating.'); 409 return; 410 } 411 379 412 // get product 380 413 if (empty($this->easify_server)) { … … 383 416 384 417 $Product = $this->easify_server->GetProductFromEasify($EasifySku); 418 419 if ($Product->Published == FALSE) { 420 Easify_Logging::Log('Easify_WC_Shop.UpdateProductStockLevel() - Not published, ignoring update.'); 421 return; 422 } 385 423 386 424 // handling stock - we get free stock minus allocated stock … … 419 457 420 458 Easify_Logging::Log('Easify_WC_Shop.UpdateProductPrice()'); 459 460 // Determine whether ignore price changes 461 if ($this->easify_options->get_easify_dont_update_product_prices()) 462 { 463 Easify_Logging::Log('Easify_WC_Shop.UpdateProductPrice() - Easify plugin settings dictate ignore product price changes. Not updating.'); 464 return; 465 } 466 421 467 // get product 422 468 if (empty($this->easify_server)) { … … 426 472 $Product = $this->easify_server->GetProductFromEasify($EasifySku); 427 473 474 if ($Product->Published == FALSE) { 475 Easify_Logging::Log('Easify_WC_Shop.UpdateProductPrice() - Not published, ignoring update.'); 476 return; 477 } 478 428 479 // get WooCommerce product id from Easify SKU 429 480 $ProductId = $this->GetWooCommerceProductIdFromEasifySKU($Product->SKU); -
easify-server-woocommerce/trunk/readme.txt
r2228353 r2289263 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: 4.0 6 Tested up to: 5. 3.27 Stable tag: 4.1 76 Tested up to: 5.4 7 Stable tag: 4.19 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 WC tested up to: 4.0 10 11 11 12 Connects Easify V4.x Small Business Software to your WooCommerce online shop, … … 100 101 101 102 == Changelog == 103 = 4.19 = 104 * Added new Product settings options to allow products to be not uploaded from 105 Easify when first published, also to ignore price and/or stock level changes 106 from Easify. 107 = 4.18 = 108 * Fixed issue where un-published product in Easify could still update stock 109 level and price of product in WooCommerce. 102 110 = 4.17 = 103 111 * Fixed issue with previous update where product images and HTML description … … 157 165 158 166 == Upgrade Notice == 159 = 4.17 = 160 * Fixed issue with previous update where product images and HTML description 161 still being updated even if plugin set not to accept updates. 167 = 4.19 = 168 * Added new Product settings options to allow products to be not uploaded from 169 Easify when first published, also to ignore price and/or stock level changes 170 from Easify.
Note: See TracChangeset
for help on using the changeset viewer.