Plugin Directory

Changeset 3359195


Ignore:
Timestamp:
09/10/2025 12:48:07 PM (6 months ago)
Author:
extendago
Message:

Version 1.6.8

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

Legend:

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

    r3335917 r3359195  
    44Plugin URI:  https://extendago-connect.com/
    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.6.7
     6Version:     1.6.8
    77Requires Plugins: woocommerce
    88Author:      Arture B.V.
  • extendago-wp-connection/trunk/includes/api/class-extendago-web-api-functions.php

    r3335917 r3359195  
    263263        }
    264264
    265         /* VARIABLE PRODUCT | Loop variations and check for sale
    266         if( isset($product['product_variants']) && !empty($product['product_variants']) ){
    267             $all_product_variations = $Product->get_children();
    268             if( isset($all_product_variations) && !empty($all_product_variations) ){
    269 
    270                 // Bij een full sync controleren of het aantal variaties overeenkomt met aantal in Woocommerce; nee = opschonen
    271                 if( $full_sync && count($all_product_variations) > count($product['product_variants']) ){
    272 
    273                     // Array met alle nieuwe size_ids vanuit extendago
    274                     $new_product_size_list = array();
    275                     foreach( $product['product_variants'] as $product_variation ){
    276                         $new_product_size_list[$product_variation->id] = $product_variation->id;
    277                     }
    278                 }
    279 
    280                 foreach( $all_product_variations as $variation_post_id ) {
    281 
    282                     $extendago_size_id = get_post_meta($variation_post_id, 'extendago_size_id', true);
    283 
    284                     // Als de variatie niet meer bestaat in Extendago dan verwijderen
    285                     if( isset($new_product_size_list) && !empty($new_product_size_list) ) {
    286                         if (!in_array($extendago_size_id, $new_product_size_list)) {
    287                             $this->logging->log_file_write('NOTICE | Variation ' . $variation_post_id . ' deleted from product: ' . $post_id);
    288                             wp_delete_post($variation_post_id, true);
    289                         }
    290                     }
    291 
    292                     $Variation = new WC_Product_Variation($variation_post_id);
    293 
    294                     // Check if variotion has his own price
    295 //                    if( isset($variation['product_data'][0]->retail_price) && !empty($variation['product_data'][0]->retail_price) ){
    296 //                        $variation_regular_price = number_format(($variation['product_data'][0]->retail_price/100), 2, '.', '');
    297 //                    }
    298 //                    else{
    299 //                        $variation_regular_price = number_format(($product['product_data'][0]->retail_price/100), 2, '.', '');
    300 //                    }
    301 
    302                     if( isset($product['sale_product']) && $product['sale_product'] ){
    303 
    304                         $variation_regular_price = (float)get_post_meta($variation_post_id, '_regular_price', true);
    305                         if( isset($product['discount_percentage']) && !empty($product['discount_percentage']) ){
    306                             $sale_price = $variation_regular_price / 100 * ( 100 - $product['discount_percentage'] );
    307                             $sale_price = number_format($sale_price, 2, '.', '');
    308                             $Variation->set_sale_price($sale_price);
    309                         }
    310                         elseif( isset($product['discount_amount']) && !empty($product['discount_amount']) ){
    311                             $sale_price = $variation_regular_price - $product['discount_amount'];
    312                             $sale_price = number_format($sale_price, 2, '.', '');
    313                             $Variation->set_sale_price($sale_price);
    314                         }
    315                         elseif( isset($product['discount_fixed_price']) && !empty($product['discount_fixed_price']) ){
    316                             $sale_price = number_format(($product['discount_fixed_price']/100), 2, '.', '');
    317                             $Variation->set_sale_price($sale_price);
    318                         }
    319 
    320                         $Variation->set_date_on_sale_from( $product['discount_date_from'] );
    321 
    322                         if( $product['discount_date_until'] > $product['discount_date_from'] ){
    323                             $product['discount_date_until'] = $product['discount_date_until'] + 12*60*60;
    324                             $Variation->set_date_on_sale_to( $product['discount_date_until'] );
    325                         }
    326                         else{
    327                             update_post_meta( $variation_post_id, '_sale_price_dates_to', '' );
    328                             $Variation->set_date_on_sale_to( '' );
    329                         }
    330                     }
    331                     else{
    332                         $variation_regular_price = get_post_meta($variation_post_id, '_regular_price', true);
    333                         $Variation->set_regular_price($variation_regular_price);
    334                         $Variation->set_price($variation_regular_price);
    335                         $Variation->set_sale_price( '' );
    336                         $Variation->set_date_on_sale_from( '' );
    337                         $Variation->set_date_on_sale_to( '' );
    338                     }
    339                     $Variation->save();
    340                 }
    341             }
    342 
    343         }
    344         else{
    345             $Product->set_stock_quantity($product['stock'] );
    346         }*/
    347 
    348265        $wc_tax_class = get_option( $product['product_data'][0]->vat_rate_id );
    349266        if (isset($wc_tax_class) && !empty($wc_tax_class) ) {
     
    465382            $Product->set_stock_status($product_stock_status);
    466383        }
     384        elseif( isset($product['stock']) ){
     385            $Product->set_stock_quantity( $product['stock'] );
     386            //$this->logging->log_file_write('Info | Set stock quantity for product ' .$post_id. ' with new amount of ' . $product['stock']);
     387        }
    467388
    468389        $extendago_keep_product_images = get_option('extendago_keep_product_images');
     
    488409
    489410        return true;
    490     }
    491 
    492     public function update_main_product_stock_status( $post_id, $stock_status ){
    493         if( $stock_status == 'outofstock' ){
    494             wc_update_product_stock_status( $post_id, 'outofstock' );
    495             $old_meta_value = get_post_meta( $post_id, '_stock_status', true );
    496             update_post_meta( $post_id, '_stock_status', 'outofstock', $old_meta_value );
    497 
    498             wp_set_object_terms($post_id, 'outofstock', 'product_visibility', true);
    499         }
    500         else{
    501             wc_update_product_stock_status( $post_id, 'instock' );
    502             $old_meta_value = get_post_meta( $post_id, '_stock_status', true );
    503             update_post_meta( $post_id, '_stock_status', 'instock', $old_meta_value );
    504 
    505             wp_remove_object_terms($post_id, 'outofstock', 'product_visibility' );
    506         }
    507411    }
    508412
     
    853757                    $Variation->set_price($discount_price);
    854758                    $Variation->set_sale_price($discount_price);
    855                 } else {
     759                }
     760                else {
    856761                    $Variation->set_regular_price($product['from_price']);
    857762                    $Variation->set_price($product['to_price']);
    858763                    $Variation->set_sale_price($product['to_price']);
    859764                }
     765
     766                if ( !empty($product['discount_date_from']) ) {
     767                    $Variation->set_date_on_sale_from( date('Y-m-d', $product['discount_date_from']));
     768                }
     769
     770                if ( !empty($product['discount_date_until']) ) {
     771                    $Variation->set_date_on_sale_to( date('Y-m-d', $product['discount_date_until']));
     772                }
     773
    860774            }
    861775            else{
     
    863777                $Variation->set_price(number_format($variation_retail_price, 2, '.', ''));
    864778                $Variation->set_sale_price('');
     779                $Variation->set_date_on_sale_from('');
     780                $Variation->set_date_on_sale_to('');
    865781            }
    866782
  • extendago-wp-connection/trunk/includes/cronjob/class-extendago-cronjob-functions.php

    r3335917 r3359195  
    212212                    $products_array = json_encode($products_array);
    213213
    214                     $success = file_put_contents($new_upload_dir . '/products_batch_' . $batch . '.json', $products_array);
     214                    if( isset($product_id) && !empty($product_id)  ){
     215                        $success = file_put_contents($new_upload_dir . '/products_batch_' . $product_id . '.json', $products_array);
     216                    }
     217                    else{
     218                        $success = file_put_contents($new_upload_dir . '/products_batch_' . $batch . '.json', $products_array);
     219                    }
    215220                    if( $success === FALSE ){
    216221                        $this->logging->log_file_write( 'ERROR | Product batch ' .$batch. 'not created!' );
  • extendago-wp-connection/trunk/includes/woocommerce/class-extendago-woocommerce-functions.php

    r3335917 r3359195  
    10131013                    }
    10141014
     1015                    $vat_rate = str_pad($vat_rate, 2, '0', STR_PAD_LEFT);
    10151016                    $order_line_item['vat_rate'] = '0.' . $vat_rate; // 0021 = 21%
    10161017                    $order_line_item['effective_vat_rate'] = $order_line_item['vat_rate'];
     
    11401141                    }
    11411142
     1143                    $vat_rate = str_pad($vat_rate, 2, '0', STR_PAD_LEFT);
    11421144                    $order_line_item['vat_rate'] = '0.' . $vat_rate; // 0021 = 21%
    11431145                    $data['order_line_items'][] = $order_line_item;
  • extendago-wp-connection/trunk/readme.txt

    r3335917 r3359195  
    55Requires at least: 6.0
    66Tested up to: 6.8.1
    7 Stable tag: 1.6.7
     7Stable tag: 1.6.8
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    3131== Changelog =
    3232
     33= 1.6.9 =
     34* Single product import batch changed with product ID
     35
     36= 1.6.8 =
     37* Bugfix for simple product updates with stock
     38
    3339= 1.6.7 =
    3440* Bugfix for product fixed price discounts
Note: See TracChangeset for help on using the changeset viewer.