Changeset 2941124
- Timestamp:
- 07/21/2023 06:30:59 AM (3 years ago)
- Location:
- extendago-wp-connection/trunk
- Files:
-
- 5 edited
-
extendago-wp-connection.php (modified) (1 diff)
-
includes/class-extendago-wp-connection.php (modified) (1 diff)
-
includes/cronjob/class-extendago-cronjob-functions.php (modified) (8 diffs)
-
includes/woocommerce/class-extendago-woocommerce-functions.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
extendago-wp-connection/trunk/extendago-wp-connection.php
r2940233 r2941124 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. 3.96 Version: 1.4.0 7 7 Author: Arture B.V. 8 8 Author URI: https://arture.nl/ -
extendago-wp-connection/trunk/includes/class-extendago-wp-connection.php
r2940233 r2941124 68 68 $this->loader->add_action( 'wp_ajax_check_extendago_voucher', $woocommerce, 'check_extendago_voucher' ); 69 69 $this->loader->add_action( 'wp_ajax_nopriv_check_extendago_voucher', $woocommerce, 'check_extendago_voucher' ); 70 //$this->loader->add_action( 'woocommerce_order_status_changed', $woocommerce, 'create_extendago_new_order' );70 $this->loader->add_action( 'woocommerce_order_status_changed', $woocommerce, 'create_extendago_new_order' ); 71 71 $this->loader->add_action( 'manage_edit-shop_order_columns', $woocommerce, 'add_extendago_order_returned_column' ); 72 72 $this->loader->add_action( 'manage_shop_order_posts_custom_column', $woocommerce, 'add_extendago_order_returned_column_value' ); -
extendago-wp-connection/trunk/includes/cronjob/class-extendago-cronjob-functions.php
r2930779 r2941124 109 109 110 110 if( isset($_POST['product_id']) && !empty($_POST['product_id']) ) { 111 $product_id = $_POST['product_id']; 111 112 $this->logging->log_file_write( 'Manual | Manual triggered synchronisation for product: ' .$_POST['product_id']); 112 113 } … … 114 115 $import_shop_products = get_option( 'extendago_import_shop_products' ); 115 116 $extendago_shop_group_ids = get_option( 'extendago_shop_group_ids' ); 117 116 118 117 119 // Process all products … … 127 129 $total_sychronized_products = 0; 128 130 $total_products = count($products); 129 if( ( isset($_POST['product_id']) && !empty($_POST['product_id']) ) || ( isset($product_id) && !empty($product_id)) ) $total_products = 1;131 if( isset($product_id) && !empty($product_id) ) $total_products = 1; 130 132 $products_array = array(); 131 133 foreach( $products as $product ) { 132 134 $skip_product = false; 133 135 134 if( isset($_POST['product_id']) && !empty($_POST['product_id']) && $product['id'] != $_POST['product_id'] ){135 $total_products--;136 $skip_product = true;137 }138 139 136 if( isset($product_id) && !empty($product_id) && $product['id'] != $product_id ){ 140 $total_products--; 141 $skip_product = true; 137 continue; 142 138 } 143 139 144 140 // Skip producten met de optie "Hide form web" 145 141 if( isset($product['attributes'][1]['hide_from_web']) && $product['attributes'][1]['hide_from_web'] == '1' ){ 146 $total_products --;142 $total_products = $total_products - 1; 147 143 $skip_product = true; 148 144 } … … 154 150 } 155 151 else{ 156 $total_products --;152 $total_products = $total_products - 1; 157 153 $skip_product = true; 158 154 } … … 162 158 if( !$skip_product ) { 163 159 $stock_values = $web_api->CurlRequest('/stock_values?filter-product_id=' . $product['id'], 'GET'); 164 if (isset($extendago_location_id) && !empty($extendago_location_id)) { 165 foreach ($stock_values as $stock_value) { 166 if ($stock_value['stock_location_id'] == $extendago_location_id) { 167 $product['stock'] = floor($stock_value['quantity']); 168 break; 169 } 170 } 171 } else { 172 $product['stock'] = floor($stock_values[0]['quantity']); 160 if( isset($stock_values) && !empty($stock_values) ) { 161 if (isset($extendago_location_id) && !empty($extendago_location_id)) { 162 foreach ($stock_values as $stock_value) { 163 if ($stock_value['stock_location_id'] == $extendago_location_id) { 164 $product['stock'] = floor($stock_value['quantity']); 165 break; 166 } 167 } 168 } else { 169 $product['stock'] = floor($stock_values[0]['quantity']); 170 } 171 } 172 else{ 173 $product['stock'] = 0; 173 174 } 174 175 … … 934 935 $stock_value['reference_id'] = 'UpdateStock - webshop'; 935 936 $stock_value['stock_event_lines'] = json_encode( array( array( 936 'current_quantity' => $variation->stock,937 'product_id' => $product['id'],938 'product_variant_id' => $product_variant['id'],939 'name' => $product_variant['title'],940 'sku' => $product_variant['sku'],941 )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 ) 942 943 )); 943 944 … … 958 959 } 959 960 } 960 }961 }961 } 962 } 962 963 else{ 963 964 $Response = $Extendago->CurlRequest('/stock_values?filter-product_id='.$product['id'], 'GET'); … … 965 966 $stock_value['reference_id'] = 'UpdateStock - webshop'; 966 967 $stock_value['stock_event_lines'] = json_encode( array( array( 967 'current_quantity' => (string)$product['quantity'],968 'product_id' => (string)$product['id'],969 'product_variant_id' => null,970 'name' => $product['title'],971 'sku' => (string)$product['sku'],972 )968 'current_quantity' => (string)$product['quantity'], 969 'product_id' => (string)$product['id'], 970 'product_variant_id' => null, 971 'name' => $product['title'], 972 'sku' => (string)$product['sku'], 973 ) 973 974 ) ); 974 975 -
extendago-wp-connection/trunk/includes/woocommerce/class-extendago-woocommerce-functions.php
r2940233 r2941124 15 15 add_action( 'woocommerce_process_product_meta', array($this, 'woocommerce_extendago_product_fields_save') ); 16 16 17 add_action( 'save_post_shop_order', array($this, 'process_order_to_extendago'), 10, 3 );17 //add_action( 'save_post_shop_order', array($this, 'process_order_to_extendago'), 10, 3 ); 18 18 } 19 19 … … 435 435 } 436 436 437 // public function handle_update_post_shop_order($post_id, $post, $update){ 438 // 439 // if( $update ){ 440 // 441 // 442 // } 443 // 444 // 445 // echo '<pre>'; 446 // print_r($post_id); 447 // echo '</pre>'; 448 // echo '<pre>'; 449 // print_r($post); 450 // echo '</pre>'; 451 // echo '<pre>'; 452 // var_dump($update); 453 // echo '</pre>'; 454 // exit; 455 // 456 // } 457 458 //public function create_extendago_new_order( $order_id, $response = false ) { 459 public function process_order_to_extendago($order_id, $post, $update){ 437 public function create_extendago_new_order( $order_id, $response = false ) { 460 438 461 439 // Check if "New order" option is enabled … … 470 448 $logging->log_file_write('NewOrder | WebOrder status changed to: '.$order->get_status()); 471 449 472 // Update already processed orders 473 $update_existing_order = false; 450 // Skip already processed orders 474 451 $order_returned_successfully_to_extendago = get_post_meta($order_id, 'order_returned_successfully_to_extendago', true); 475 452 if( $order_returned_successfully_to_extendago == '1' ) { 476 $update_existing_order = true; 477 } 478 elseif( $update ){ 479 $update_existing_order = true; 480 } 481 482 $extendago_order_id = get_post_meta($order_id, 'extendago_order_id', true); 483 if( $update_existing_order && ( !isset($extendago_order_id) || empty($extendago_order_id)) ) { 484 return; 453 return ''; 485 454 } 486 455 … … 811 780 812 781 // Save order 813 if( !$update_existing_order && isset($extendago_order_id) && !empty($extendago_order_id) ) { 814 $results = $web_api->createOrder($data); 815 } 816 else{ 817 $results = $web_api->CurlRequest('/orders/'.$extendago_order_id, 'PUT', $data); 818 } 782 $results = $web_api->createOrder($data); 819 783 820 784 $logging = new ExtendaGo_WP_Connection_Logging(); … … 827 791 else{ 828 792 $message = 'OrderId processed: ' . $order_data['id']; 829 update_post_meta($order_id, 'extendago_order_id', $results['id']);793 //update_post_meta($order_id, 'extendago_order_id', $results['id']); 830 794 update_post_meta($order_id, 'order_returned_successfully_to_extendago', '1'); 831 795 update_post_meta($order_id, 'click_and_collect_order', $click_and_collect_order); -
extendago-wp-connection/trunk/readme.txt
r2940233 r2941124 5 5 Requires at least: 6.0 6 6 Tested up to: 6.2.2 7 Stable tag: 1. 3.97 Stable tag: 1.4.0 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 30 30 31 31 == Changelog == 32 33 = 1.4.0 = 34 * Bugfix with order processing in custom cases 32 35 33 36 = 1.3.9 =
Note: See TracChangeset
for help on using the changeset viewer.