Changeset 3359195
- Timestamp:
- 09/10/2025 12:48:07 PM (6 months ago)
- Location:
- extendago-wp-connection/trunk
- Files:
-
- 5 edited
-
extendago-wp-connection.php (modified) (1 diff)
-
includes/api/class-extendago-web-api-functions.php (modified) (5 diffs)
-
includes/cronjob/class-extendago-cronjob-functions.php (modified) (1 diff)
-
includes/woocommerce/class-extendago-woocommerce-functions.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
extendago-wp-connection/trunk/extendago-wp-connection.php
r3335917 r3359195 4 4 Plugin URI: https://extendago-connect.com/ 5 5 Description: 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. 76 Version: 1.6.8 7 7 Requires Plugins: woocommerce 8 8 Author: Arture B.V. -
extendago-wp-connection/trunk/includes/api/class-extendago-web-api-functions.php
r3335917 r3359195 263 263 } 264 264 265 /* VARIABLE PRODUCT | Loop variations and check for sale266 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 = opschonen271 if( $full_sync && count($all_product_variations) > count($product['product_variants']) ){272 273 // Array met alle nieuwe size_ids vanuit extendago274 $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 verwijderen285 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 price295 // 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 348 265 $wc_tax_class = get_option( $product['product_data'][0]->vat_rate_id ); 349 266 if (isset($wc_tax_class) && !empty($wc_tax_class) ) { … … 465 382 $Product->set_stock_status($product_stock_status); 466 383 } 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 } 467 388 468 389 $extendago_keep_product_images = get_option('extendago_keep_product_images'); … … 488 409 489 410 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 }507 411 } 508 412 … … 853 757 $Variation->set_price($discount_price); 854 758 $Variation->set_sale_price($discount_price); 855 } else { 759 } 760 else { 856 761 $Variation->set_regular_price($product['from_price']); 857 762 $Variation->set_price($product['to_price']); 858 763 $Variation->set_sale_price($product['to_price']); 859 764 } 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 860 774 } 861 775 else{ … … 863 777 $Variation->set_price(number_format($variation_retail_price, 2, '.', '')); 864 778 $Variation->set_sale_price(''); 779 $Variation->set_date_on_sale_from(''); 780 $Variation->set_date_on_sale_to(''); 865 781 } 866 782 -
extendago-wp-connection/trunk/includes/cronjob/class-extendago-cronjob-functions.php
r3335917 r3359195 212 212 $products_array = json_encode($products_array); 213 213 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 } 215 220 if( $success === FALSE ){ 216 221 $this->logging->log_file_write( 'ERROR | Product batch ' .$batch. 'not created!' ); -
extendago-wp-connection/trunk/includes/woocommerce/class-extendago-woocommerce-functions.php
r3335917 r3359195 1013 1013 } 1014 1014 1015 $vat_rate = str_pad($vat_rate, 2, '0', STR_PAD_LEFT); 1015 1016 $order_line_item['vat_rate'] = '0.' . $vat_rate; // 0021 = 21% 1016 1017 $order_line_item['effective_vat_rate'] = $order_line_item['vat_rate']; … … 1140 1141 } 1141 1142 1143 $vat_rate = str_pad($vat_rate, 2, '0', STR_PAD_LEFT); 1142 1144 $order_line_item['vat_rate'] = '0.' . $vat_rate; // 0021 = 21% 1143 1145 $data['order_line_items'][] = $order_line_item; -
extendago-wp-connection/trunk/readme.txt
r3335917 r3359195 5 5 Requires at least: 6.0 6 6 Tested up to: 6.8.1 7 Stable tag: 1.6. 77 Stable tag: 1.6.8 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 31 31 == Changelog = 32 32 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 33 39 = 1.6.7 = 34 40 * Bugfix for product fixed price discounts
Note: See TracChangeset
for help on using the changeset viewer.