Plugin Directory

Changeset 2183884


Ignore:
Timestamp:
10/31/2019 02:33:26 PM (6 years ago)
Author:
Easify
Message:

Version 4.15

Location:
easify-server-woocommerce/trunk
Files:
5 edited

Legend:

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

    r2177899 r2183884  
    55 * Plugin URI: http://www.easify.co.uk/wordpress/
    66 * 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.14
     7 * Version: 4.15
    88 * License: GPL2
    99 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1111 * Author URI: http://www.easify.co.uk/
    1212 * Requires at least: 4.0
    13  * Tested up to: 5.23
     13 * Tested up to: 5.2.4
    1414 */
    1515
    1616/**
    17  * Copyright (C) 2017  Easify Ltd (email:support@easify.co.uk)
     17 * Copyright (C) 2019  Easify Ltd (email:support@easify.co.uk)
    1818 * This program is free software; you can redistribute it and/or
    1919 * modify it under the terms of the GNU General Public License
  • easify-server-woocommerce/trunk/includes/class-easify-wc-easify-options.php

    r1669606 r2183884  
    11<?php
    22/**
    3  * Copyright (C) 2017  Easify Ltd (email:support@easify.co.uk)
     3 * Copyright (C) 2019  Easify Ltd (email:support@easify.co.uk)
    44 * This program is free software; you can redistribute it and/or
    55 * modify it under the terms of the GNU General Public License
     
    2323 *
    2424 * @class       Easify_WC_Easify_Options
    25  * @version     4.4
     25 * @version     4.15
    2626 * @package     easify-woocommerce-connector
    2727 * @author      Easify
     
    3232    private $payment_options;
    3333    private $customer_options;
     34    private $product_options;       
    3435    private $shipping_options;
    3536    private $coupon_options;
     
    4546        $this->payment_options = get_option('easify_options_payment');
    4647        $this->customer_options = get_option('easify_options_customers');
     48        $this->product_options = get_option('easify_options_products');       
    4749        $this->shipping_options = get_option('easify_options_shipping');
    4850        $this->coupon_options = get_option('easify_options_coupons');       
    4951    }
    5052
     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   
    5166    /**
    5267     * Gets the Easify Order Type Id from WordPress options
  • easify-server-woocommerce/trunk/includes/class-easify-wc-plugin-settings-page.php

    r1879096 r2183884  
    11<?php
    22/**
    3  * Copyright (C) 2017  Easify Ltd (email:support@easify.co.uk)
     3 * Copyright (C) 2019  Easify Ltd (email:support@easify.co.uk)
    44 * This program is free software; you can redistribute it and/or
    55 * modify it under the terms of the GNU General Public License
     
    3030 *
    3131 * @class       Easify_WC__Plugin_Settings_Page
    32  * @version     4.8
     32 * @version     4.15
    3333 * @package     easify-woocommerce-connector
    3434 * @author      Easify
     
    9393        $this->init_orders();
    9494        $this->init_customers();
     95        $this->init_products();
    9596        $this->init_coupons();
    9697        $this->init_shipping();
     
    166167            'orders' => 'Orders',
    167168            'customers' => 'Customers',
     169            'products' => 'Products',
    168170            'coupons' => 'Coupons',
    169171            'shipping' => 'Shipping',
     
    676678        );
    677679    }
    678 
     680 
    679681    /**
    680682     * HTML to display for the Customers section
     
    686688    }
    687689
     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&apos;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   
    688745    /**
    689746     * Initialise Easify Coupons Settings
     
    792849    }
    793850
     851   
     852
     853   
     854   
     855   
     856   
    794857    /**
    795858     * initialise Easify Shipping page
     
    14401503        $this->options['easify_options_orders'] = get_option('easify_options_orders');
    14411504        $this->options['easify_options_customers'] = get_option('easify_options_customers');
     1505        $this->options['easify_options_products'] = get_option('easify_options_products');       
    14421506        $this->options['easify_options_shipping'] = get_option('easify_options_shipping');
    14431507        $this->options['easify_options_payment'] = get_option('easify_options_payment');
     
    16101674            </div>     
    16111675
     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           
    16121692            <!-- OPTIONS COUPONS -->
    16131693            <div id="coupons-discount-sku-tip">
  • easify-server-woocommerce/trunk/includes/class-easify-wc-shop.php

    r1932557 r2183884  
    22
    33/**
    4  * Copyright (C) 2017  Easify Ltd (email:support@easify.co.uk)
     4 * Copyright (C) 2019  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.12
     30 * @version     4.15
    3131 * @package     easify-woocommerce-connector
    3232 * @author      Easify
     
    3434class Easify_WC_Shop extends Easify_Generic_Shop {
    3535
     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   
    3646    /**
    3747     * Public implementation of abstract methods in superclass
     
    231241            $Product->Weight = (isset($Product->Weight) && is_numeric($Product->Weight) ? $Product->Weight : 0);
    232242
    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
    250267
    251268            // get WooCommerce product id from Easify SKU
     
    264281            $ProductId = wp_update_post($ProductStub);
    265282
    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            }
    268290
    269291            // get WooCommerce tax class from Easify tax id
  • easify-server-woocommerce/trunk/readme.txt

    r2177899 r2183884  
    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: 4.0
    6 Tested up to: 5.23
    7 Stable tag: 4.14
     6Tested up to: 5.2.4
     7Stable tag: 4.15
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    100100
    101101== Changelog ==
     102= 4.15 =
     103* Added Products Options Page that allows you to prevent Easify overwriting
     104WooCommerce product categories when they are updated. This is useful if you
     105prefer to manage your product categories in WooCommerce instead of automatically
     106using the Easify product categories.
    102107= 4.14 =
    103 * Tested up to V5.23
     108* Tested up to V5.2.4
    104109= 4.13 =
    105110* Changed to use 24hr time when sending orders to Easify.
     
    143148
    144149== 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
     152WooCommerce product categories when they are updated. This is useful if you
     153prefer to manage your product categories in WooCommerce instead of automatically
     154using the Easify product categories.
Note: See TracChangeset for help on using the changeset viewer.