Plugin Directory

Changeset 3335917


Ignore:
Timestamp:
07/29/2025 11:49:28 AM (8 months ago)
Author:
extendago
Message:

Version 1.6.7

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

Legend:

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

    r3309632 r3335917  
    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.6
     6Version:     1.6.7
    77Requires Plugins: woocommerce
    88Author:      Arture B.V.
  • extendago-wp-connection/trunk/includes/api/class-extendago-web-api-functions.php

    r3309632 r3335917  
    3838        $post_id = $this->functions->custom_get_product_id_by_sku( $product['id'], $product['sku'] );
    3939        $hide_from_web = 0;
    40         foreach( $product['attributes'] as $key => $value){
    41             $value = (array)$value;
    42             if( isset($value['hide_from_web']) ){
    43                 $hide_from_web = $value['hide_from_web'];
    44                 break;
     40        if( isset($product['attributes']) ) {
     41            foreach ($product['attributes'] as $key => $value) {
     42                $value = (array)$value;
     43                if (isset($value['hide_from_web'])) {
     44                    $hide_from_web = $value['hide_from_web'];
     45                    break;
     46                }
    4547            }
    4648        }
     
    8082        elseif( isset($product['discount_fixed_price']) && $product['discount_fixed_price'] > 0){
    8183            $regular_price = $retail_price;
    82             $discount_price = $product['discount_fixed_price'];
    83             $discount_price = (float)$discount_price;
     84            $discount_price = number_format(($product['discount_fixed_price']/100), 2, '.', '');
    8485        }
    8586        else{
     
    262263        }
    263264
    264         // VARIABLE PRODUCT | Loop variations and check for sale
     265        /* VARIABLE PRODUCT | Loop variations and check for sale
    265266        if( isset($product['product_variants']) && !empty($product['product_variants']) ){
    266267            $all_product_variations = $Product->get_children();
    267 
    268268            if( isset($all_product_variations) && !empty($all_product_variations) ){
    269269
     
    290290                    }
    291291
    292 
    293292                    $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//                    }
    294301
    295302                    if( isset($product['sale_product']) && $product['sale_product'] ){
     
    307314                        }
    308315                        elseif( isset($product['discount_fixed_price']) && !empty($product['discount_fixed_price']) ){
    309                             $sale_price = number_format($product['discount_fixed_price'], 2, '.', '');
     316                            $sale_price = number_format(($product['discount_fixed_price']/100), 2, '.', '');
    310317                            $Variation->set_sale_price($sale_price);
    311318                        }
     
    330337                        $Variation->set_date_on_sale_to( '' );
    331338                    }
    332 
    333339                    $Variation->save();
    334340                }
     
    338344        else{
    339345            $Product->set_stock_quantity($product['stock'] );
    340         }
     346        }*/
    341347
    342348        $wc_tax_class = get_option( $product['product_data'][0]->vat_rate_id );
     
    837843                        $discount_price = $product['discount_price'];
    838844                        $discount_price = number_format($discount_price,'2', '.', '');
    839                     } else {
     845                    }
     846                    elseif( isset($product['discount_fixed_price']) && !empty($product['discount_fixed_price']) ){
     847                        $discount_price = number_format(($product['discount_fixed_price']/100), 2, '.', '');
     848                    }
     849                    else {
    840850                        $discount_price = NULL;
    841851                    }
  • extendago-wp-connection/trunk/includes/cronjob/class-extendago-cronjob-functions.php

    r3309632 r3335917  
    137137            $batch = 0;
    138138            $i = 0;
    139             $total_sychronized_products = 0;
    140139            $total_products = count($products);
    141140            if( isset($product_id) && !empty($product_id) ) $total_products = 1;
     
    182181                        // Check for specific stock location
    183182                        $stock_values = $web_api->CurlRequest('/stock_values?filter-product_variant_id=' . $product_variant['id'], 'GET');
    184                         if (isset($extendago_location_id) && !empty($extendago_location_id)) {
    185                             foreach ($stock_values as $stock_value) {
    186                                 if ($stock_value['stock_location_id'] == $extendago_location_id) {
    187                                     $product['product_variants'][$index]['stock'] = floor($stock_value['quantity']);
    188                                     break;
    189                                 }
    190                             }
    191                         } else {
    192                             $product['product_variants'][$index]['stock'] = floor($stock_values[0]['quantity']);
     183                        if( !empty($stock_values) ) {
     184                            if (isset($extendago_location_id) && !empty($extendago_location_id)) {
     185                                foreach ($stock_values as $stock_value) {
     186                                    if ($stock_value['stock_location_id'] == $extendago_location_id) {
     187                                        $product['product_variants'][$index]['stock'] = floor($stock_value['quantity']);
     188                                        break;
     189                                    }
     190                                }
     191                            } else {
     192                                $product['product_variants'][$index]['stock'] = floor($stock_values[0]['quantity']);
     193                            }
     194                        }
     195                        else{
     196                            $product['product_variants'][$index]['stock'] = 0;
    193197                        }
    194198                    }
     
    201205                    $products_array[$product['id']] = $product;
    202206                }
    203 
    204                 $total_sychronized_products ++;
    205207
    206208                // 50 producten per batch
  • extendago-wp-connection/trunk/includes/woocommerce/class-extendago-woocommerce-functions.php

    r3264425 r3335917  
    943943                        $order_line_item['product_variant_id']      = get_post_meta($item_data['variation_id'], 'extendago_size_id', true);
    944944                        $order_line_item['product_variant_name']    = ( isset($product_full_name[1]) )? $product_full_name[1] : $product_full_name[0];
    945 
    946                         $retail_price = (float)get_post_meta($item_data['variation_id'], '_regular_price', true);
    947                         $retail_price = number_format($retail_price, 2, '', '');
    948945                    }
    949946                    else{
    950947                        // Show full name if it's not a variable product
    951948                        $order_line_item['product_name'] = $item_data['name'];
    952 
    953949                        $order_line_item['product_id']      = get_post_meta($item_data['product_id'], 'extendago_product_id', true);
    954                         $retail_price = (float)get_post_meta($item_data['product_id'], '_price', true);
    955                         $retail_price = number_format($retail_price, 2, '', '');
    956                     }
     950                    }
     951
     952                    $retail_price = $item->get_total() + $item->get_total_tax();
     953                    $retail_price = $retail_price / $item->get_quantity();
     954                    $retail_price = number_format($retail_price, 2, '', '');
    957955
    958956                    $product_cat_terms = wp_get_object_terms( $order_line_item['product_id'], 'product_cat' );
     
    10281026                    }
    10291027                    elseif( $item_data['total'] != $item_data['subtotal'] ){
    1030 
    10311028                        $retail_price = ($retail_price / 100);
    10321029                        $selling_price = ($selling_price / 100);
  • extendago-wp-connection/trunk/readme.txt

    r3309632 r3335917  
    55Requires at least: 6.0
    66Tested up to: 6.8.1
    7 Stable tag: 1.6.6
     7Stable tag: 1.6.7
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    3131== Changelog =
    3232
     33= 1.6.7 =
     34* Bugfix for product fixed price discounts
     35* Fallback for different order line price and product price
     36
    3337= 1.6.6 =
    3438* Bugfix for product discount batches
Note: See TracChangeset for help on using the changeset viewer.