Changeset 2839827
- Timestamp:
- 12/27/2022 01:11:49 PM (3 years ago)
- Location:
- extendago-wp-connection/trunk
- Files:
-
- 5 edited
-
extendago-wp-connection.php (modified) (1 diff)
-
includes/api/class-arture-web-api.php (modified) (1 diff)
-
includes/cronjob/class-extendago-cronjob-functions.php (modified) (10 diffs)
-
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
r2826526 r2839827 4 4 Plugin URI: http://www.arture.nl/extendago 5 5 Description: The Wordpress plugin for connecting Woocommerce with Extendago / Wallmob. Manage your products inside Extendago and let our connection do the magic. 6 Version: 1.2. 56 Version: 1.2.6 7 7 Author: Arture B.V. 8 8 Author URI: https://arture.nl/ -
extendago-wp-connection/trunk/includes/api/class-arture-web-api.php
r2722441 r2839827 74 74 $current_screen = get_current_screen(); 75 75 if (!isset($current_screen) || $current_screen->base == 'toplevel_page_extendago-wp-connection-panel') { 76 $request_url = '/validate/' . $api_key . '/' . str_replace(array('http://', 'https://', 'www.'), '', get_bloginfo('wpurl')); 76 $site_url = get_bloginfo('wpurl'); 77 $site_url = str_replace(array('http://', 'https://', 'www.'), '', $site_url); 78 $site_url = str_replace('/', '_', $site_url); 79 $request_url = '/validate/' . $api_key . '/' . $site_url; 77 80 $results = $this->curl_request($request_url); 78 81 -
extendago-wp-connection/trunk/includes/cronjob/class-extendago-cronjob-functions.php
r2826526 r2839827 71 71 } 72 72 73 public function extendago_woocommerce_sync( ){73 public function extendago_woocommerce_sync( $product_id = '' ){ 74 74 75 75 $extendago_masterdata = array(); … … 108 108 if( !isset($_POST['product_id']) ) $this->logging->log_file_write( 'GetAllWebshopProducts | ' .count($products) ); 109 109 110 if( isset($_POST['sc_product_id']) && !empty($_POST['sc_product_id']) ) { 111 $this->logging->log_file_write( 'Manual | Manual triggered synchronisation for product: ' .$_POST['sc_product_id']); 112 } 113 110 114 // Process all products 111 115 if( isset($products) && !empty($products) ) { … … 120 124 $total_sychronized_products = 0; 121 125 $total_products = count($products); 122 if( isset($_POST['product_id']) ) $total_products = 1;126 if( ( isset($_POST['product_id']) && !empty($_POST['product_id']) ) || ( isset($product_id) && !empty($product_id) ) ) $total_products = 1; 123 127 $products_array = array(); 124 128 foreach( $products as $product ) { 125 129 126 130 if( isset($_POST['product_id']) && !empty($_POST['product_id']) && $product['id'] != $_POST['product_id'] ){ 131 continue; 132 } 133 134 if( isset($product_id) && !empty($product_id) && $product['id'] != $product_id ){ 127 135 continue; 128 136 } … … 206 214 $this->logging->log_file_write( 'MasterData | SAVED' ); 207 215 208 wp_send_json_success( 209 array( 210 'html' => '<div class="notice notice-success"><p>'. __( 'Manual triggered the init synchronization', 'extendago-wp-connection-plugin' ). '</p></div>' 211 ) 212 ); 216 if( !isset($product_id) || empty($product_id) ){ 217 wp_send_json_success( 218 array( 219 'html' => '<div class="notice notice-success"><p>'. __( 'Manual triggered the init synchronization', 'extendago-wp-connection-plugin' ). '</p></div>' 220 ) 221 ); 222 } 223 213 224 } 214 225 … … 291 302 foreach( $product_data['attributes'] as $attribute => $attribute_value ){ 292 303 if( isset($variation_meta['attribute_'.$attribute]) ){ 293 $product_variant_name = $variation_meta['attribute_'.$attribute][0]; 304 $Variation = new WC_Product_Variation( $product_variation_id ); 305 $attribute_name = $Variation->get_name(); 306 $attribute_name = explode(" - ", $attribute_name); 307 $product_variant_name = end($attribute_name); 294 308 break; 295 309 } … … 632 646 } 633 647 648 $unit_id = get_post_meta($product['id'], 'unit_id', true); 649 if( !isset($unit_id) || empty($unit_id) ){ 650 $unit_id = 'pc'; 651 } 652 653 $ExtendagoProductJSON['product_data'] = json_encode(array( 654 array( 655 'id' => $product['id'], 656 'type_id' => '523', 657 'retail_price' => number_format(((float)$product['price'] * 100), 0, '.', ''), // price in cents 658 //'cost_price' => '0', 659 'product_id' => $product['id'], 660 'price_region_id' => $price_region_id, 661 'vat_rate_id' => null, 662 'least_quantity' => null, 663 'weekcover' => 0, 664 'sales_tax_rate_id' => null, 665 'unit_id' => $unit_id 666 ) 667 )); 668 634 669 if( isset($product['variations']) && !empty($product['variations']) ) { 635 670 … … 654 689 'type_id' => '523', 655 690 'retail_price' => number_format(((float)$variation->retail_price * 100), 0, '.', ''), // price in cents 656 'cost_price' => '0',691 //'cost_price' => '0', 657 692 'product_id' => $product['id'], 658 693 'price_region_id' => $price_region_id, … … 675 710 'type_id' => '523', 676 711 'retail_price' => number_format(((float)$variation->retail_price * 100), 0, '.', ''), // price in cents 677 'cost_price' => '0',712 //'cost_price' => '0', 678 713 'product_id' => $product['id'], 679 714 'product_variant_id' => $variation->id, … … 692 727 693 728 $ExtendagoProductJSON['product_variants'] = json_encode($ExtendagoProductJSON['product_variants']); 694 }695 else{696 697 $unit_id = get_post_meta($product['id'], 'unit_id', true);698 if( !isset($unit_id) || empty($unit_id) ){699 $unit_id = 'pc';700 }701 702 $ExtendagoProductJSON['product_data'] = json_encode(array(703 array(704 'id' => $product['id'],705 'type_id' => '523',706 'retail_price' => number_format(((float)$product['price'] * 100), 0, '.', ''), // price in cents707 'cost_price' => '0',708 'product_id' => $product['id'],709 'price_region_id' => $price_region_id,710 'vat_rate_id' => null,711 'least_quantity' => null,712 'weekcover' => 0,713 'sales_tax_rate_id' => null,714 'unit_id' => $unit_id715 )716 ));717 729 } 718 730 … … 892 904 893 905 if( isset($changes) && $changes['changes_found'] > 0 ) { 906 907 $this->logging->log_file_write('Changes | Extendago product changes amount: ' . $changes['changes_found']); 894 908 895 909 $sync_round_identifier = time(); -
extendago-wp-connection/trunk/includes/woocommerce/class-extendago-woocommerce-functions.php
r2826334 r2839827 176 176 } 177 177 178 $variation_meta = get_post_meta($product_variation_id); 179 foreach( $product_data['attributes'] as $attribute => $attribute_value ){ 180 if( isset($variation_meta['attribute_'.$attribute]) ){ 181 $Variation = new WC_Product_Variation( $product_variation_id ); 182 $attribute_name = $Variation->get_name(); 183 $attribute_name = explode(" - ", $attribute_name); 184 $product_variant_name = end($attribute_name); 185 break; 186 } 187 } 188 178 189 if( isset($product_variant_name) ) { 179 190 $product_data['variations'][] = array( … … 558 569 } 559 570 560 echo '<pre>'; 561 print_r($order->get_items( 'shipping' ) ); 562 echo '</pre>'; 571 if (!empty($order_data['shipping']['email'])) { 572 $data['shipping_information']['email'] = $order_data['shipping']['email']; 573 } else { 574 $data['shipping_information']['email'] = $order_data['billing']['email']; 575 } 576 577 if (!empty($order_data['shipping']['phone'])) { 578 $data['shipping_information']['phone'] = $order_data['shipping']['phone']; 579 } else { 580 $data['shipping_information']['phone'] = $order_data['billing']['phone']; 581 } 563 582 564 583 // Iterating through order shipping items -
extendago-wp-connection/trunk/readme.txt
r2826526 r2839827 5 5 Requires at least: 6.0 6 6 Tested up to: 6.1.1 7 Stable tag: 1.2. 57 Stable tag: 1.2.6 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 30 30 31 31 == Changelog == 32 33 = 1.2.6 = 34 * Better performance of export products with variation names 35 * Bugfix with cost_price and export processing 36 * Added phone and email to order shipping fields 32 37 33 38 = 1.2.5 =
Note: See TracChangeset
for help on using the changeset viewer.