Changeset 2183884
- Timestamp:
- 10/31/2019 02:33:26 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) (4 diffs)
-
includes/class-easify-wc-plugin-settings-page.php (modified) (9 diffs)
-
includes/class-easify-wc-shop.php (modified) (5 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easify-server-woocommerce/trunk/easify.php
r2177899 r2183884 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 47 * Version: 4.15 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.2 313 * Tested up to: 5.2.4 14 14 */ 15 15 16 16 /** 17 * Copyright (C) 201 7Easify Ltd (email:support@easify.co.uk)17 * Copyright (C) 2019 Easify Ltd (email:support@easify.co.uk) 18 18 * This program is free software; you can redistribute it and/or 19 19 * modify it under the terms of the GNU General Public License -
easify-server-woocommerce/trunk/includes/class-easify-wc-easify-options.php
r1669606 r2183884 1 1 <?php 2 2 /** 3 * Copyright (C) 201 7Easify Ltd (email:support@easify.co.uk)3 * Copyright (C) 2019 Easify Ltd (email:support@easify.co.uk) 4 4 * This program is free software; you can redistribute it and/or 5 5 * modify it under the terms of the GNU General Public License … … 23 23 * 24 24 * @class Easify_WC_Easify_Options 25 * @version 4. 425 * @version 4.15 26 26 * @package easify-woocommerce-connector 27 27 * @author Easify … … 32 32 private $payment_options; 33 33 private $customer_options; 34 private $product_options; 34 35 private $shipping_options; 35 36 private $coupon_options; … … 45 46 $this->payment_options = get_option('easify_options_payment'); 46 47 $this->customer_options = get_option('easify_options_customers'); 48 $this->product_options = get_option('easify_options_products'); 47 49 $this->shipping_options = get_option('easify_options_shipping'); 48 50 $this->coupon_options = get_option('easify_options_coupons'); 49 51 } 50 52 53 /** 54 * Determines whether product updates should overwrite WooCommerce product categories. 55 * 56 * @return boolean 57 */ 58 public function get_dont_overwrite_woocommerce_product_categories() { 59 if (isset($this->product_options['easify_dont_overwrite_woo_categories'])) { 60 return $this->product_options['easify_dont_overwrite_woo_categories']; 61 } 62 63 return false; 64 } 65 51 66 /** 52 67 * Gets the Easify Order Type Id from WordPress options -
easify-server-woocommerce/trunk/includes/class-easify-wc-plugin-settings-page.php
r1879096 r2183884 1 1 <?php 2 2 /** 3 * Copyright (C) 201 7Easify Ltd (email:support@easify.co.uk)3 * Copyright (C) 2019 Easify Ltd (email:support@easify.co.uk) 4 4 * This program is free software; you can redistribute it and/or 5 5 * modify it under the terms of the GNU General Public License … … 30 30 * 31 31 * @class Easify_WC__Plugin_Settings_Page 32 * @version 4. 832 * @version 4.15 33 33 * @package easify-woocommerce-connector 34 34 * @author Easify … … 93 93 $this->init_orders(); 94 94 $this->init_customers(); 95 $this->init_products(); 95 96 $this->init_coupons(); 96 97 $this->init_shipping(); … … 166 167 'orders' => 'Orders', 167 168 'customers' => 'Customers', 169 'products' => 'Products', 168 170 'coupons' => 'Coupons', 169 171 'shipping' => 'Shipping', … … 676 678 ); 677 679 } 678 680 679 681 /** 680 682 * HTML to display for the Customers section … … 686 688 } 687 689 690 /** 691 * Initialise Easify Products Settings 692 */ 693 private function init_products() { 694 695 // register Products options group 696 register_setting( 697 'easify_options_products_group', // group 698 'easify_options_products', // name 699 array($this, 'sanitise') // sanitise method 700 ); 701 702 // add products page 703 add_settings_section( 704 'easify_options_section_products', // id 705 'Easify Products Options', // title 706 array($this, 'settings_html_easify_products_message'), // callback 707 'easify_options_page_products' // page 708 ); 709 710 // EASIFY_OVERWRITE_WOO_CATEGORIES_ENABLED 711 add_settings_field( 712 'easify_dont_overwrite_woo_categories', // id 713 'Product Updates', // title 714 array($this, 'setting_html_easify_dont_overwrite_woo_categories_enable'), // callback 715 'easify_options_page_products', // page 716 'easify_options_section_products' // section 717 ); 718 } 719 720 /** 721 * HTML to display for the Customers section 722 */ 723 public function settings_html_easify_products_message() { 724 ?> 725 <p>Here you can configure options related to Products.</p> 726 <?php 727 } 728 729 /** 730 * HTML to display the easify_dont_overwrite_woo_categories_enable config option 731 */ 732 public function setting_html_easify_dont_overwrite_woo_categories_enable() { 733 echo '<div class="easify-loggin-option">Don't Overwrite WooCommerce Categories '; 734 735 printf('<input type="checkbox" name="easify_options_products[easify_dont_overwrite_woo_categories]" id="easify_dont_overwrite_woo_categories" value="true" %s/>', 736 isset($this->options['easify_options_products']['easify_dont_overwrite_woo_categories']) && 737 $this->options['easify_options_products']['easify_dont_overwrite_woo_categories'] == 'true' ? 'checked="checked"' : '' 738 ); 739 740 $this->tool_tip('overwrite_woo_categories-tip'); 741 echo '</div>'; 742 } 743 744 688 745 /** 689 746 * Initialise Easify Coupons Settings … … 792 849 } 793 850 851 852 853 854 855 856 794 857 /** 795 858 * initialise Easify Shipping page … … 1440 1503 $this->options['easify_options_orders'] = get_option('easify_options_orders'); 1441 1504 $this->options['easify_options_customers'] = get_option('easify_options_customers'); 1505 $this->options['easify_options_products'] = get_option('easify_options_products'); 1442 1506 $this->options['easify_options_shipping'] = get_option('easify_options_shipping'); 1443 1507 $this->options['easify_options_payment'] = get_option('easify_options_payment'); … … 1610 1674 </div> 1611 1675 1676 <!-- OPTIONS PRODUCTS --> 1677 <div id="overwrite_woo_categories-tip"> 1678 <h3>Product Updates - Don't Overwrite WooCommerce Categories</h3> 1679 <p>When you add a product to Easify and publish it, it will get uploaded to WooCommerce.</p> 1680 <p>From then onwards, whenever the product is updated (price change, stock level change etc... 1681 The product will be updated in WooCommerce.</p> 1682 <p>By default this will overwrite the any manual changes you have made to the Product Category in WooCommerce.</p> 1683 <p>Normally this is what you want because if you change a products category in Easify, you will want it 1684 to also update in WooCommerce.</p> 1685 <p>However there may be times when you want to change the product category manually in WooCommerce, 1686 for example to add the product to multiple categories.</p> 1687 <p>In which case you can tick this box, which will prevent updates to Easify Products 1688 overwriting or resetting the categories settings that you have manually entered in WooCommerce.</p> 1689 <?= $this->tooltip_click_here_link('products-overwrite-woocommerce-categories') ?> 1690 </div> 1691 1612 1692 <!-- OPTIONS COUPONS --> 1613 1693 <div id="coupons-discount-sku-tip"> -
easify-server-woocommerce/trunk/includes/class-easify-wc-shop.php
r1932557 r2183884 2 2 3 3 /** 4 * Copyright (C) 201 7Easify Ltd (email:support@easify.co.uk)4 * Copyright (C) 2019 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.1 230 * @version 4.15 31 31 * @package easify-woocommerce-connector 32 32 * @author Easify … … 34 34 class Easify_WC_Shop extends Easify_Generic_Shop { 35 35 36 private $easify_options; 37 38 public function __construct($easify_server_url, $username, $password) { 39 parent :: __construct($easify_server_url, $username, $password); 40 41 // Create an Easify options class for easy access to Easify Options 42 $this->easify_options = new Easify_WC_Easify_Options(); 43 } 44 45 36 46 /** 37 47 * Public implementation of abstract methods in superclass … … 231 241 $Product->Weight = (isset($Product->Weight) && is_numeric($Product->Weight) ? $Product->Weight : 0); 232 242 233 // get Easify product categories 234 $EasifyCategories = $this->easify_server->GetEasifyProductCategories(); 235 236 // get Easify category description by the Easify category id 237 $CategoryDescription = $this->easify_server->GetEasifyCategoryDescriptionFromEasifyCategoryId($EasifyCategories, $Product->CategoryId); 238 239 // get Easify product sub categories by Easify category id 240 $EasifySubCategories = $this->easify_server->GetEasifyProductSubCategoriesByCategory($Product->CategoryId); 241 242 // get Easify sub category description by Easify sub category id 243 $SubCategoryDescription = $this->easify_server->GetEasifyCategoryDescriptionFromEasifyCategoryId($EasifySubCategories, $Product->SubcategoryId); 244 245 // insert new category if needed and return WooCommerce category id 246 $CategoryId = $this->InsertCategoryIntoWooCommerce($CategoryDescription, $CategoryDescription); 247 248 // insert new sub category if needed and return WooCommerce sub category id 249 $SubCategoryId = $this->InsertSubCategoryIntoWooCommerce($SubCategoryDescription, $SubCategoryDescription, $CategoryId); 243 if (!$this->easify_options->get_dont_overwrite_woocommerce_product_categories()) 244 { 245 Easify_Logging::Log("Easify_WC_Shop.UpdateProduct() - Updating product categories..."); 246 247 // get Easify product categories 248 $EasifyCategories = $this->easify_server->GetEasifyProductCategories(); 249 250 // get Easify category description by the Easify category id 251 $CategoryDescription = $this->easify_server->GetEasifyCategoryDescriptionFromEasifyCategoryId($EasifyCategories, $Product->CategoryId); 252 253 // get Easify product sub categories by Easify category id 254 $EasifySubCategories = $this->easify_server->GetEasifyProductSubCategoriesByCategory($Product->CategoryId); 255 256 // get Easify sub category description by Easify sub category id 257 $SubCategoryDescription = $this->easify_server->GetEasifyCategoryDescriptionFromEasifyCategoryId($EasifySubCategories, $Product->SubcategoryId); 258 259 // insert new category if needed and return WooCommerce category id 260 $CategoryId = $this->InsertCategoryIntoWooCommerce($CategoryDescription, $CategoryDescription); 261 262 // insert new sub category if needed and return WooCommerce sub category id 263 $SubCategoryId = $this->InsertSubCategoryIntoWooCommerce($SubCategoryDescription, $SubCategoryDescription, $CategoryId); 264 } 265 266 250 267 251 268 // get WooCommerce product id from Easify SKU … … 264 281 $ProductId = wp_update_post($ProductStub); 265 282 266 // link subcategory to product 267 wp_set_post_terms($ProductId, array($SubCategoryId), "product_cat"); 283 if (!$this->easify_options->get_dont_overwrite_woocommerce_product_categories()) 284 { 285 Easify_Logging::Log("Easify_WC_Shop.UpdateProduct() - Linking new product categories..."); 286 287 // link subcategory to product 288 wp_set_post_terms($ProductId, array($SubCategoryId), "product_cat"); 289 } 268 290 269 291 // get WooCommerce tax class from Easify tax id -
easify-server-woocommerce/trunk/readme.txt
r2177899 r2183884 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.2 37 Stable tag: 4.1 46 Tested up to: 5.2.4 7 Stable tag: 4.15 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 100 100 101 101 == Changelog == 102 = 4.15 = 103 * Added Products Options Page that allows you to prevent Easify overwriting 104 WooCommerce product categories when they are updated. This is useful if you 105 prefer to manage your product categories in WooCommerce instead of automatically 106 using the Easify product categories. 102 107 = 4.14 = 103 * Tested up to V5.2 3108 * Tested up to V5.2.4 104 109 = 4.13 = 105 110 * Changed to use 24hr time when sending orders to Easify. … … 143 148 144 149 == Upgrade Notice == 145 = 4.13 = 146 * Orders now report date placed using 24 hour clock. Added extra information in 147 the event of an internal server 500 error. 150 = 4.15 = 151 * Added Products Options Page that allows you to prevent Easify overwriting 152 WooCommerce product categories when they are updated. This is useful if you 153 prefer to manage your product categories in WooCommerce instead of automatically 154 using the Easify product categories.
Note: See TracChangeset
for help on using the changeset viewer.