Changeset 2945883
- Timestamp:
- 08/01/2023 08:33:45 AM (3 years ago)
- Location:
- extendago-wp-connection/trunk
- Files:
-
- 7 edited
-
extendago-wp-connection.php (modified) (1 diff)
-
includes/api/class-extendago-web-api-functions.php (modified) (1 diff)
-
includes/api/class-extendago-web-api.php (modified) (1 diff)
-
includes/class-extendago-wp-connection-functions.php (modified) (1 diff)
-
includes/cronjob/class-extendago-cronjob-functions.php (modified) (7 diffs)
-
includes/woocommerce/class-extendago-woocommerce-functions.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
extendago-wp-connection/trunk/extendago-wp-connection.php
r2941124 r2945883 4 4 Plugin URI: http://www.arture.nl/extendago 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.4. 06 Version: 1.4.1 7 7 Author: Arture B.V. 8 8 Author URI: https://arture.nl/ -
extendago-wp-connection/trunk/includes/api/class-extendago-web-api-functions.php
r2935547 r2945883 745 745 $Variation->set_attributes($variation_attributes); 746 746 $Variation->set_manage_stock('yes'); 747 $Variation->set_stock_quantity($variation['stock']); 747 748 if( isset($variation['stock']) ) { 749 $Variation->set_stock_quantity($variation['stock']); 750 } 751 else{ 752 $Variation->set_stock_quantity(0); 753 } 748 754 749 755 if( empty($Variation->get_sku()) || $Variation->get_sku() != $variation['sku'] ){ -
extendago-wp-connection/trunk/includes/api/class-extendago-web-api.php
r2930779 r2945883 329 329 330 330 if (isset($Result['id'])) return $Result['id']; 331 331 332 return ''; 332 333 } -
extendago-wp-connection/trunk/includes/class-extendago-wp-connection-functions.php
r2930779 r2945883 112 112 return intval( $variation_query->posts[0] ); 113 113 } 114 else{ 115 $variation = get_post($id); 116 if( isset($variation->ID) && $variation->post_type == 'product_variation' ){ 117 update_post_meta($id, 'extendago_size_id', $id); 118 return $id; 119 } 120 } 114 121 115 122 return 0; -
extendago-wp-connection/trunk/includes/cronjob/class-extendago-cronjob-functions.php
r2941124 r2945883 640 640 if( (isset($processing_export_time) && $processing_export_time >= $past_minute) ){ 641 641 $this->logging->log_file_write( 'Product cronjob | Processing export files already running' ); 642 return;642 return; 643 643 } 644 644 … … 852 852 } 853 853 854 854 855 if( empty($ProductResponse) || isset($ProductResponse['error']) ){ 855 856 $this->logging->log_file_write('EXPORT | ' . $ProductResponse['error']); … … 878 879 else{ 879 880 $this->logging->log_file_write('EXPORT | ' . $ProductResponse['error']); 881 } 882 } 883 884 // Update Extenda Go id's 885 if( isset($ProductResponse['product_variants']) ){ 886 foreach( $ProductResponse['product_variants'] as $extenda_product_variant_data ){ 887 888 $args = array( 889 'post_type' => 'product_variation', 890 'post_status' => 'any', 891 'posts_per_page' => -1, 892 'meta_query' => array( 893 array( 894 'key' => '_sku', 895 'value' => $extenda_product_variant_data['sku'], 896 'compare' => '=' 897 ), 898 ), 899 'fields' => 'ids' 900 ); 901 $product_variation_query = new WP_Query($args); 902 903 if( !empty($product_variation_query->posts) ) { 904 905 $found_variation_id = $product_variation_query->posts[0]; 906 907 $extendago_size_id = get_post_meta($found_variation_id, 'extendago_size_id', true); 908 if( $extendago_size_id != $extenda_product_variant_data['id'] ) { 909 update_post_meta($found_variation_id, 'extendago_size_id', $extenda_product_variant_data['id']); 910 $this->logging->log_file_write('EXPORT | Product variation ID ' . $found_variation_id . ' has new Extendago ID: ' . $extenda_product_variant_data['id']); 911 } 912 } 913 880 914 } 881 915 } … … 933 967 $Response = $Extendago->CurlRequest('/stock_values?filter-product_variant_id='.$product_variant['id'], 'GET'); 934 968 935 $stock_value['reference_id'] = 'UpdateStock - webshop';936 $stock_value['stock_event_lines'] = json_encode( array( array(937 'current_quantity' => $variation->stock,938 'product_id' => $product['id'],939 'product_variant_id' => $product_variant['id'],940 'name' => $product_variant['title'],941 'sku' => $product_variant['sku'],942 )943 ));944 945 969 if( !isset($variation->stock) || empty($variation->stock) ) { 946 970 $this->logging->log_file_write('EXPORT | Product variation ID ' . $product_variant['id'] . ' has no stock value!'); … … 949 973 950 974 if( !empty($Response) ){ 951 if( isset($Response[0]['quantity']) && $Response[0]['quantity'] != $product['quantity'] ){ 975 if( isset($Response[0]['quantity']) && $Response[0]['quantity'] != $variation->stock ){ 976 $stock_value['reference_id'] = 'UpdateStock - webshop'; 977 $stock_value['stock_event_lines'] = json_encode( array( array( 978 'current_quantity' => $variation->stock, 979 'product_id' => $product['id'], 980 'product_variant_id' => $product_variant['id'], 981 'name' => $product_variant['product_variant_name'], 982 'sku' => $product_variant['sku'], 983 ) 984 )); 985 952 986 $Response = $Extendago->CurlRequest('/count_stock', 'POST', $stock_value, false, true); 953 987 $this->logging->log_file_write('EXPORT | Product variation ID ' .$product_variant['id']. ' updated to stock: ' .$variation->stock); … … 955 989 } 956 990 else{ 991 992 $stock_value['reference_id'] = 'UpdateStock - webshop'; 993 $stock_value['stock_event_lines'] = json_encode( array( array( 994 'current_quantity' => $variation->stock, 995 'product_id' => $product['id'], 996 'product_variant_id' => $product_variant['id'], 997 'name' => $product_variant['product_variant_name'], 998 'sku' => $product_variant['sku'], 999 ) 1000 )); 1001 957 1002 $Response = $Extendago->CurlRequest('/count_stock', 'POST', $stock_value, false, true); 958 1003 $this->logging->log_file_write('EXPORT | Product variation ID ' .$product_variant['id']. ' set stock: ' .$variation->stock); … … 1442 1487 1443 1488 $results = $web_api->listStockChanges(); 1489 1444 1490 $total_sychronized_stock_changes = 0; 1445 1491 if( isset($results) && is_array($results) && !empty($results) ) { -
extendago-wp-connection/trunk/includes/woocommerce/class-extendago-woocommerce-functions.php
r2941124 r2945883 183 183 184 184 // Get Product Prices 185 $product_data['price'] = ( $product->get_price() / 100 ) * ( $default_tax + 100 ); 186 187 $product_regular_price = $product->get_regular_price(); 188 if( isset($product_regular_price) && !empty($product_regular_price) ){ 189 $product_data['regular_price'] = ( $product_regular_price / 100 ) * ( $default_tax + 100 ); 190 } 191 else{ 192 $product_data['regular_price'] = $product_data['price']; 185 $product_data['price'] = 0; 186 if( $product->get_price() ) { 187 $product_data['price'] = ($product->get_price() / 100) * ($default_tax + 100); 188 } 189 190 $product_data['regular_price'] = 0; 191 if( $product->get_regular_price() ) { 192 $product_regular_price = $product->get_regular_price(); 193 if (isset($product_regular_price) && !empty($product_regular_price)) { 194 $product_data['regular_price'] = ($product_regular_price / 100) * ($default_tax + 100); 195 } else { 196 $product_data['regular_price'] = $product_data['price']; 197 } 193 198 } 194 199 -
extendago-wp-connection/trunk/readme.txt
r2941124 r2945883 5 5 Requires at least: 6.0 6 6 Tested up to: 6.2.2 7 Stable tag: 1.4. 07 Stable tag: 1.4.1 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 30 30 31 31 == Changelog == 32 33 = 1.4.1 = 34 * Some optimalisations and improvements 32 35 33 36 = 1.4.0 =
Note: See TracChangeset
for help on using the changeset viewer.