Plugin Directory

Changeset 3043693


Ignore:
Timestamp:
03/01/2024 02:15:15 PM (2 years ago)
Author:
extendago
Message:

Version 1.4.8

Location:
extendago-wp-connection/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extendago-wp-connection/trunk/extendago-wp-connection.php

    r3020847 r3043693  
    44Plugin URI:  http://www.arture.nl/extendago
    55Description: The Wordpress plugin for connecting Woocommerce with Extenda GO / Wallmob. You can manage your products inside Extenda GO or make your webshop as leading foor product manangement. You Stock changes will be two-way binding.
    6 Version:     1.4.7
     6Version:     1.4.8
    77Author:      Arture B.V.
    88Author URI:  https://arture.nl/
  • extendago-wp-connection/trunk/includes/admin/class-extendago-wp-connection-admin.php

    r3020847 r3043693  
    115115        add_settings_field('extendago_tax_rates', 'Tax rates',  array( $this, 'display_extendago_tax_rates_element' ), 'extendago_woocommerce_options', 'woocommerce_section');
    116116        add_settings_field('extendago_wc_new_order', esc_html(__('Orders', 'extendago-wp-connection-plugin')),  array( $this, 'display_extendago_wc_new_order_element' ), 'extendago_woocommerce_options', 'woocommerce_section');
     117        add_settings_field('extendago_skip_order_processing', esc_html(__('Exclude orders', 'extendago-wp-connection-plugin')),  array( $this, 'display_extendago_skip_order_processing_element' ), 'extendago_woocommerce_options', 'woocommerce_section');
    117118        add_settings_field('extendago_costs_field', esc_html(__('Costs field', 'extendago-wp-connection-plugin')),  array( $this, 'display_extendago_costs_field_element' ), 'extendago_woocommerce_options', 'woocommerce_section');
    118119        add_settings_field('extendago_click_and_collect', esc_html(__('Click and Collect BETA!', 'extendago-wp-connection-plugin')),  array( $this, 'display_extendago_click_and_collect_element' ), 'extendago_woocommerce_options', 'woocommerce_section');
     
    142143        register_setting('extendago_woocommerce_options', 'extendago_location_id');
    143144        register_setting('extendago_woocommerce_options', 'extendago_wc_new_order');
     145        register_setting('extendago_woocommerce_options', 'extendago_skip_order_processing');
    144146        register_setting('extendago_woocommerce_options', 'extendago_costs_field');
    145147        register_setting('extendago_woocommerce_options', 'extendago_click_and_collect');
     
    475477            <?php echo __('On: Images are updated/processed from ExtendaGo in Woocommerce. ( Recommended )', 'extendago-wp-connection'); ?>
    476478            <br/>
    477             <?php echo __('Off: Off images will be processed in Woocommerce.', 'extendago-wp-connection'); ?>
     479            <?php echo __('Off: Images will be processed in Woocommerce.', 'extendago-wp-connection'); ?>
    478480        </div>
    479481        <?php
     
    505507        <div class="info">
    506508            <?php echo __('On: The description present in ExtendaGo is also processed, in addition to processing in the content, as a short product description in Woocommerce.', 'extendago-wp-connection'); ?><br/>
    507             <?php echo __('Off: The product short description in Woocommerce is Offt filled. ( Recommended )', 'extendago-wp-connection'); ?>
     509            <?php echo __('Off: The product short description in Woocommerce won\'t be filled ( Recommended )', 'extendago-wp-connection'); ?>
    508510        </div>
    509511        <?php
     
    516518        </label>
    517519        <div class="info">
    518             <?php echo __('On: The first image from ExtendaGo will Offt be added to the product gallery and will only be set as a featured image. ( Recommended )', 'extendago-wp-connection'); ?><br/>
     520            <?php echo __('On: The first image from ExtendaGo won\'t be added to the product gallery and will only be set as a featured image. ( Recommended )', 'extendago-wp-connection'); ?><br/>
    519521            <?php echo __('Off: The first image from ExtendaGo is also added to the product gallery.', 'extendago-wp-connection'); ?>
    520522        </div>
     
    529531        <div class="info">
    530532            <?php echo __('On: The category structure is automatically created/updated from ExtendaGo as set per product. ( Recommended )', 'extendago-wp-connection'); ?><br/>
    531             <?php echo __('Off: The category structure is Offt processed in Woocommerce.', 'extendago-wp-connection'); ?>
     533            <?php echo __('Off: The category structure won\'t created inside Woocommerce.', 'extendago-wp-connection'); ?>
    532534        </div>
    533535        <?php
     
    562564        </label>
    563565        <div class="info">
    564             <?php echo __('On: The product title is Offt updated and can be changed manually in Woocommerce.', 'extendago-wp-connection'); ?><br/>
    565             <?php echo __('Off: The product title is automatically processed from ExtendaGo. ( Recommended )', 'extendago-wp-connection'); ?>
     566            <?php echo __('On: The product title won\'t updated and can be changed manually in Woocommerce.', 'extendago-wp-connection'); ?><br/>
     567            <?php echo __('Off: The product title is automatically updated from ExtendaGo. ( Recommended )', 'extendago-wp-connection'); ?>
    566568        </div>
    567569        <?php
     
    574576        </label>
    575577        <div class="info">
    576             <?php echo __('On: The product description is Offt updated and can be changed manually in Woocommerce.', 'extendago-wp-connection'); ?><br/>
    577             <?php echo __('Off: The product description is automatically processed from ExtendaGo. ( Recommended )', 'extendago-wp-connection'); ?>
     578            <?php echo __('On: The product description won\'t updated and can be changed manually in Woocommerce.', 'extendago-wp-connection'); ?><br/>
     579            <?php echo __('Off: The product description is automatically updated from ExtendaGo. ( Recommended )', 'extendago-wp-connection'); ?>
    578580        </div>
    579581        <?php
     
    587589        <div class="info">
    588590            <?php echo __('On: The product category structure will remain unchanged and can be changed manually in Woocommerce.', 'extendago-wp-connection'); ?><br/>
    589             <?php echo __('Off: The product category structure is automatically processed from ExtendaGo. ( Recommended )', 'extendago-wp-connection'); ?>
     591            <?php echo __('Off: The product category structure is automatically updated from ExtendaGo. ( Recommended )', 'extendago-wp-connection'); ?>
    590592        </div>
    591593        <?php
     
    819821
    820822                <div class="info"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
    821                     <?php echo __('When enabled; new paid order(s) will automatically created in ExtendaGo including refund orders!', 'extendago-wp-connection-plugin'); ?>
     823                    <?php echo __('When enabled; new paid (with status processing/completed) order(s) will automatically created in ExtendaGo including refund orders!', 'extendago-wp-connection-plugin'); ?>
     824                </div>
     825                <?php
     826            }
     827            else{
     828                echo '<div class="alert alert-warning" role="alert">'. __( 'Unable to activate this action. API settings are empty or wrong!', 'extendago-wp-connection-plugin' ) . '</div>';
     829            }
     830        }
     831        else {
     832            echo '<div class="alert alert-warning" role="alert">' . __( 'Woocommerce not activated!', 'extendago-wp-connection-plugin' ) . '</div>';
     833        }
     834    }
     835
     836    public function display_extendago_skip_order_processing_element() {
     837
     838        global $woocommerce;
     839
     840        $wc_payment_gateways = $woocommerce->payment_gateways->payment_gateways();
     841        $extendago_skip_order_processing = (array)get_option( 'extendago_skip_order_processing' );
     842
     843        if ( class_exists( 'WooCommerce' ) ) {
     844
     845            // Check if connection available
     846            if ( $this->active_connection ) { ?>
     847                <select name="extendago_skip_order_processing[]" multiple>
     848                    <option value=""><?php echo __( 'Select payment method', 'extendago-wp-connection-plugin' ); ?></option>
     849                    <?php
     850                    // Iterate Woocommerce vat rates
     851                    foreach ( $wc_payment_gateways as $wc_payment_gateway ): ?>
     852                        <option value="<?php echo $wc_payment_gateway->id; ?>" <?php echo ( isset( $extendago_skip_order_processing ) && in_array($wc_payment_gateway->id, $extendago_skip_order_processing) ) ? 'selected=selected' : ''; ?>><?php echo $wc_payment_gateway->title; ?></option>
     853                    <?php endforeach;?>
     854                </select>
     855
     856                <div class="info"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
     857                    <?php echo __('When payment method selected these type of orders will be skipped from processing in Extenda GO', 'extendago-wp-connection-plugin'); ?>
    822858                </div>
    823859                <?php
  • extendago-wp-connection/trunk/includes/cronjob/class-extendago-cronjob-functions.php

    r3020847 r3043693  
    414414                            if ( isset($extendago_costs_field) && !empty($extendago_costs_field) ) {
    415415                                $cost_price = get_post_meta($product_variation_id, $extendago_costs_field, true);
    416                                 $variant_data['cost_price'] = number_format(((float)$cost_price * 100), 0, '.', '');
     416
     417                                $cost_price = str_replace(',', '.', $cost_price);
     418                                $cost_price = preg_replace("/[^0-9\.]/", "", $cost_price);
     419                                $cost_price = str_replace('.', '',substr($cost_price, 0, -3)) . substr($cost_price, -3);
     420                                $variant_data['cost_price'] = number_format($cost_price, 2 );
    417421                            }
    418422
     
    432436            if ( isset($extendago_costs_field) && !empty($extendago_costs_field) ) {
    433437                $cost_price = get_post_meta($product->get_id(), $extendago_costs_field, true);
    434                 $product_data['cost_price'] = number_format(((float)$cost_price * 100), 0, '.', '');
     438
     439                $cost_price = str_replace(',', '.', $cost_price);
     440                $cost_price = preg_replace("/[^0-9\.]/", "", $cost_price);
     441                $cost_price = str_replace('.', '',substr($cost_price, 0, -3)) . substr($cost_price, -3);
     442                $product_data['cost_price'] = number_format($cost_price, 2 );
    435443            }
    436444
     
    795803                        // Costs of goods
    796804                        if ( isset($extendago_costs_field) && !empty($extendago_costs_field) && !empty($product['cost_price']) ) {
    797                             $product_data[0]['cost_price'] = number_format(((float)$product['cost_price'] * 100), 0, '.', '');
     805
     806                            $cost_price = str_replace(',', '.', $product['cost_price']);
     807                            $cost_price = preg_replace("/[^0-9\.]/", "", $cost_price);
     808                            $cost_price = str_replace('.', '',substr($cost_price, 0, -3)) . substr($cost_price, -3);
     809                            $product_data[0]['cost_price'] = number_format($cost_price, 2 );
    798810                        }
    799811
     
    860872                                // Costs of goods
    861873                                if ( isset($extendago_costs_field) && !empty($extendago_costs_field) ) {
    862                                     $product_variant['product_data'][0]['cost_price'] = number_format(((float)$variation->cost_price * 100), 0, '.', '');
     874
     875                                    $cost_price = str_replace(',', '.', $variation->cost_price);
     876                                    $cost_price = preg_replace("/[^0-9\.]/", "", $cost_price);
     877                                    $cost_price = str_replace('.', '',substr($cost_price, 0, -3)) . substr($cost_price, -3);
     878                                    $product_variant['product_data'][0]['cost_price'] = number_format($cost_price, 2 );
    863879                                }
    864880
  • extendago-wp-connection/trunk/includes/woocommerce/class-extendago-woocommerce-functions.php

    r3020847 r3043693  
    193193        if ( isset($extendago_costs_field) && !empty($extendago_costs_field) ) {
    194194            $cost_price = get_post_meta($product->get_id(), $extendago_costs_field, true);
    195             $product_data['cost_price'] = number_format(((float)$cost_price * 100), 0, '.', '');
     195
     196            $cost_price = str_replace(',', '.', $cost_price);
     197            $cost_price = preg_replace("/[^0-9\.]/", "", $cost_price);
     198            $cost_price = str_replace('.', '',substr($cost_price, 0, -3)) . substr($cost_price, -3);
     199            $product_data['cost_price'] = number_format($cost_price, 2 );
    196200        }
    197201
     
    315319                        if ( isset($extendago_costs_field) && !empty($extendago_costs_field) ) {
    316320                            $cost_price = get_post_meta($product_variation_id, $extendago_costs_field, true);
    317                             $variant_data['cost_price'] = number_format(((float)$cost_price * 100), 0, '.', '');
     321
     322                            $cost_price = str_replace(',', '.', $cost_price);
     323                            $cost_price = preg_replace("/[^0-9\.]/", "", $cost_price);
     324                            $cost_price = str_replace('.', '',substr($cost_price, 0, -3)) . substr($cost_price, -3);
     325                            $variant_data['cost_price'] = number_format($cost_price, 2 );
    318326                        }
    319327
     
    485493            $order = new WC_Order( $order_id );
    486494
     495
    487496            if( $refund ){
    488497                $logging->log_file_write('Refunding | WebOrder status changed to: '.$order->get_status());
     
    490499            else{
    491500                $logging->log_file_write('NewOrder | WebOrder status changed to: '.$order->get_status());
     501            }
     502
     503
     504            // SKip order processing for specific payment methods
     505            $order_payment_method = $order->get_payment_method();
     506            $extendago_skip_order_processing = (array)get_option( 'extendago_skip_order_processing' );
     507            if ( isset($order_payment_method) && in_array($order_payment_method, $extendago_skip_order_processing) ){
     508                $logging->log_file_write('NewOrder | Order with payment method '.$order_payment_method. ' are exclude from processing to Extenda!');
     509                return '';
    492510            }
    493511
  • extendago-wp-connection/trunk/readme.txt

    r3020847 r3043693  
    44Tags: extendago, extenda, woocommerce, arture, POS,
    55Requires at least: 6.0
    6 Tested up to: 6.4.2
    7 Stable tag: 1.4.7
     6Tested up to: 6.4.3
     7Stable tag: 1.4.8
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    3131== Changelog ==
    3232
     33= 1.4.8 =
     34* New setting to exclude order processing for specific payment methods
     35
    3336= 1.4.7 =
    3437* Bugfix with costprice fields and different seperators
Note: See TracChangeset for help on using the changeset viewer.