Plugin Directory

Changeset 2289263


Ignore:
Timestamp:
04/22/2020 12:52:09 PM (6 years ago)
Author:
Easify
Message:

Version 4.19

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

Legend:

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

    r2228353 r2289263  
    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.17
     7 * Version: 4.19
    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.3.2
     13 * Tested up to: 5.4
    1414 */
    1515
  • easify-server-woocommerce/trunk/includes/class-easify-wc-easify-options.php

    r2228332 r2289263  
    2323 *
    2424 * @class       Easify_WC_Easify_Options
    25  * @version     4.16
     25 * @version     4.19
    2626 * @package     easify-woocommerce-connector
    2727 * @author      Easify
     
    7676        return false;
    7777    }
     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    } 
    78117   
    79118    /**
  • easify-server-woocommerce/trunk/includes/class-easify-wc-plugin-settings-page.php

    r2228332 r2289263  
    3030 *
    3131 * @class       Easify_WC__Plugin_Settings_Page
    32  * @version     4.15
     32 * @version     4.19
    3333 * @package     easify-woocommerce-connector
    3434 * @author      Easify
     
    709709
    710710        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(
    711736                'easify_dont_overwrite_woo_categories', // id
    712                 'Product Updates', // title
     737                '', // title
    713738                array($this, 'setting_html_easify_dont_overwrite_woo_categories_enable'), // callback
    714739                'easify_options_page_products', // page
     
    734759    }
    735760   
     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&apos;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&apos;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&apos;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   
    736813        /**
    737814     * HTML to display the easify_dont_overwrite_woo_categories_enable config option
     
    16991776
    17001777            <!-- 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           
    17011808            <div id="overwrite_woo_categories-tip">
    17021809                <h3>Product Updates - Don't Overwrite WooCommerce Categories</h3>
     
    17261833                product price and stock level changes will be uploaded to WooCommerce. Editing the product image,
    17271834                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>
    17281837                <?= $this->tooltip_click_here_link('ignore-product-updates') ?>               
    17291838            </div>
  • easify-server-woocommerce/trunk/includes/class-easify-wc-shop.php

    r2228353 r2289263  
    2828 *
    2929 * @class       Easify_Generic_Shop
    30  * @version     4.17
     30 * @version     4.19
    3131 * @package     easify-woocommerce-connector
    3232 * @author      Easify
     
    6868            Easify_Logging::Log('Easify_WC_Shop.InsertProduct()');
    6969                     
     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           
    7077            // Get product from Easify Server
    7178
     
    209216            /* @var $Product ProductDetails */   
    210217           
     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           
    211226            if ($this->easify_options->get_easify_ignore_product_updates())
    212227            {
     
    238253            $Price = round(($Product->CostPrice / (100 - $Product->RetailMargin) * 100), 4);
    239254
    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       
    247267            // sanitise weight value
    248268            $Product->Weight = (isset($Product->Weight) && is_numeric($Product->Weight) ? $Product->Weight : 0);
     
    271291            }
    272292           
    273 
    274 
    275293            // get WooCommerce product id from Easify SKU
    276294            $ProductId = $this->GetWooCommerceProductIdFromEasifySKU($Product->SKU);
     
    305323             */
    306324
    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           
    344369            // physical properties
    345370            update_post_meta($ProductId, '_weight', $Product->Weight);
     
    377402            /* @var $Product ProductDetails */                   
    378403            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                 
    379412            // get product
    380413            if (empty($this->easify_server)) {
     
    383416 
    384417            $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            }
    385423           
    386424            // handling stock - we get free stock minus allocated stock
     
    419457           
    420458            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                       
    421467            // get product
    422468            if (empty($this->easify_server)) {
     
    426472            $Product = $this->easify_server->GetProductFromEasify($EasifySku);
    427473       
     474            if ($Product->Published == FALSE) {
     475                Easify_Logging::Log('Easify_WC_Shop.UpdateProductPrice() - Not published, ignoring update.');
     476                return;
     477            }
     478           
    428479            // get WooCommerce product id from Easify SKU
    429480            $ProductId = $this->GetWooCommerceProductIdFromEasifySKU($Product->SKU);
  • easify-server-woocommerce/trunk/readme.txt

    r2228353 r2289263  
    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.3.2
    7 Stable tag: 4.17
     6Tested up to: 5.4
     7Stable tag: 4.19
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     10WC tested up to: 4.0
    1011
    1112Connects Easify V4.x Small Business Software to your WooCommerce online shop,
     
    100101
    101102== Changelog ==
     103= 4.19 =
     104* Added new Product settings options to allow products to be not uploaded from
     105Easify when first published, also to ignore price and/or stock level changes
     106from Easify.
     107= 4.18 =
     108* Fixed issue where un-published product in Easify could still update stock
     109level and price of product in WooCommerce.
    102110= 4.17 =
    103111* Fixed issue with previous update where product images and HTML description
     
    157165
    158166== 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
     169Easify when first published, also to ignore price and/or stock level changes
     170from Easify.
Note: See TracChangeset for help on using the changeset viewer.