Changeset 2688315
- Timestamp:
- 03/03/2022 04:43:56 PM (4 years ago)
- Location:
- drivefx-woocommerce/trunk
- Files:
-
- 3 edited
-
PHCLibrary/orders.php (modified) (11 diffs)
-
drivefx-woocommerce.php (modified) (1 diff)
-
settings/syncro_gate.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
drivefx-woocommerce/trunk/PHCLibrary/orders.php
r2633497 r2688315 356 356 $shipping = $dataPack->shipping; 357 357 358 359 358 //Obtain new instance of Bo 360 359 $response = $this->utils_services->paramsNewInstance($ch, $credentials, 'BoWS', $settings->typeOfOrder); … … 382 381 $response = $this->utils_services->actEntity($ch, $credentials, 'BoWS', $response); 383 382 384 //$this->logs->writeFileLog('actEntity:', $response ['result'][0]);383 //$this->logs->writeFileLog('actEntity:', $response); 385 384 386 385 if (curl_error($ch)) { … … 429 428 $bi->ref = $product['ref']; 430 429 $bi->design = $product['design']; 430 $bi->armazem = $settings->warehouseOrder; 431 431 //fulfill Bis 432 432 $response['result'][0]['bis'][] = $bi; 433 434 //$this->logs->writeFileLog('bis build:', $response['result'][0]['bis']); 433 435 } 434 436 } … … 442 444 $responseSt = $this->utils_services->filterItem_Query($ch, $credentials, 'St', 'ref', $settings->shippingName); 443 445 444 //$this->logs->writeFileLog('ResponseST.01', $response );446 //$this->logs->writeFileLog('ResponseST.01', $responseSt); 445 447 446 448 if(empty($responseSt)) { … … 448 450 $this->logs->writeFileLog('Warning', "We couldn't find a reference for Shipping, so we'll use WC data"); 449 451 $bi->ref = ""; 450 $bi->design = $shipping->shipping_name; 452 $bi->design = $shipping->shipping_name; 451 453 } else { 452 454 //Set Service Data from PHC GO 453 455 $bi->ref = $responseSt['result'][0]['ref']; 454 456 $bi->design = $responseSt['result'][0]['design']; 457 //$bi->armazem = $settings->warehouseOrder; 455 458 456 459 } … … 480 483 481 484 if($bi->edebito == 0){ 482 $bi->qtt = 0;485 //$bi->qtt = 0; 483 486 $bi->ivaincl = false; 484 487 } … … 488 491 $response2 = $this->utils_services->actEntity($ch, $credentials, 'BoWS', $response); 489 492 490 //$this->logs->writeFileLog(' actEntity.0.1:', $response2['result']);493 //$this->logs->writeFileLog('response2:', $response2['result']); 491 494 492 495 // Update shipping value … … 688 691 } 689 692 $bi->edebito = $bi->ettdeb = 0; 690 $bi->qtt = 0;693 //$bi->qtt = 0; 691 694 $bi->ivaincl=false; 692 695 //fulfill Bis … … 793 796 $response = $this->utils_services->paramsSave($ch, $credentials, 'BoWS', $response); 794 797 795 // $this->logs->writeFileLog('save2:', $response);798 //$this->logs->writeFileLog('save2:', $response); 796 799 797 800 if (curl_error($ch)) { … … 825 828 } 826 829 } 830 $this->logs->writeFileLog('addNewOrder17.2', "Order number: ".$response['obrano']." was created!" ); 827 831 } 828 832 } … … 831 835 } 832 836 } 833 $this->logs->writeFileLog('addNewOrder17.2', "Order number: ".$response['obrano']." was created!" );834 837 835 838 return $response; -
drivefx-woocommerce/trunk/drivefx-woocommerce.php
r2645266 r2688315 3 3 * Plugin Name: PHC GO WooCommerce 4 4 * Description: Easy integration between Woocommerce WordPress and your PHC GO installation. 5 * Version: 4. 8.05 * Version: 4.9.0 6 6 * Author: PHC Software, S.A. 7 7 * Author URI: https://www.phcgo.net/ -
drivefx-woocommerce/trunk/settings/syncro_gate.php
r2645234 r2688315 29 29 30 30 $settings = get_option(DRIVEFXWOOCOMMERCE_PLUGIN_NAME); 31 32 //$this->logs->writeFileLog('settings', $settings); 31 33 32 34 // get token … … 280 282 $getTaxName = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM ".$wpdb->prefix."woocommerce_order_itemmeta WHERE meta_key='label' ORDER BY order_item_id DESC " ) ); 281 283 $syncroData->taxCountry = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_country FROM ".$wpdb->prefix."woocommerce_tax_rates WHERE tax_rate_name='".$getTaxName."' LIMIT 1" ) ); 282 283 284 284 285 /******************************************************************* 285 286 * --- Alternative select Data --- * … … 569 570 $cart_contents = WC()->cart->cart_contents; 570 571 572 // $this->logs->writeFileLog('cart_contents', $cart_contents); 573 571 574 if (is_array($cart_contents)){ 572 575 foreach (WC()->cart->cart_contents as $key => $value){ … … 575 578 $productData = WC()->cart->cart_contents[$key]; 576 579 577 //$this->logs->writeFileLog('productData', $productData);580 //$this->logs->writeFileLog('productData', $productData); 578 581 579 582 //obtain reference items in cart … … 642 645 $getproducttype = wc_get_product($product_id); 643 646 $typeproduct = $getproducttype->get_type(); 647 644 648 if ($typeproduct == 'variation'){ 645 649 if ( $product_id ) $wc_product = new WC_Product_Variation( $product_id ); 646 } 647 else { 650 651 //for variation type, if exists, set the product designation according to the description 652 if ($wc_product->get_description()) $product['design'] = $wc_product->get_description(); else $product['design'] = $wc_product->get_name(); 653 } else { 648 654 if ( $product_id ) $wc_product = new WC_Product( $product_id ); 649 } 650 651 $product['design'] = $wc_product->get_name(); 655 656 //for simple type, set the product designation according to name 657 $product['design'] = $wc_product->get_name(); 658 } 652 659 653 660 // order tax rate country 654 661 $getTaxID = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM ".$wpdb->prefix."woocommerce_order_itemmeta WHERE meta_key='rate_id' ORDER BY order_item_id DESC LIMIT 1" ) ); 655 662 $getTaxCountry = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_country FROM ".$wpdb->prefix."woocommerce_tax_rates WHERE tax_rate_id='".$getTaxID."' LIMIT 1" ) ); 656 663 657 664 //order Item ID 658 $getOrderItemID = $wpdb->get_var( $wpdb->prepare("SELECT order_item_id FROM ".$wpdb->prefix."woocommerce_order_items WHERE order_item_name ='".$product['design']."' and order_item_type = 'line_item' and order_id = '".$orderid."' LIMIT 1" ) ); 665 //$getOrderItemID = $wpdb->get_var( $wpdb->prepare("SELECT order_item_id FROM ".$wpdb->prefix."woocommerce_order_items WHERE order_item_name ='".$product['design']."' and order_item_type = 'line_item' and order_id = '".$orderid."' LIMIT 1" ) ); 666 $getOrderItemID = $wpdb->get_var( $wpdb->prepare("SELECT order_item_id FROM ".$wpdb->prefix."woocommerce_order_items WHERE order_item_name ='".$wc_product->get_name()."' and order_item_type = 'line_item' and order_id = '".$orderid."' LIMIT 1" ) ); 667 659 668 //order Item product by order Item ID 660 669 $item = new WC_Order_Item_Product($getOrderItemID); 661 670 662 //$this->logs->writeFileLog('item', $item);663 664 671 // The product name 665 672 $item_name = $item->get_name(); 666 667 if($item_name == $ product['design']){673 674 if($item_name == $wc_product->get_name()){ 668 675 //get taxes array for item 669 676 $taxes = $item->get_taxes(); … … 833 840 $getproducttype = wc_get_product($product_id); 834 841 $typeproduct = $getproducttype->get_type(); 842 843 /* if ($typeproduct == 'variation'){ 844 if ( $product_id ) $wc_prod = new WC_Product_Variation( $product_id ); 845 } 846 else { 847 if ( $product_id ) $wc_prod = new WC_Product( $product_id ); 848 } 849 850 $product['design'] = $wc_prod->get_name(); */ 851 835 852 if ($typeproduct == 'variation'){ 836 853 if ( $product_id ) $wc_prod = new WC_Product_Variation( $product_id ); 837 } 838 else { 854 855 //for variation type, if exists, set the product designation according to the description 856 if ($wc_product->get_description()) $product['design'] = $wc_prod->get_description(); else $product['design'] = $wc_prod->get_name(); 857 } else { 839 858 if ( $product_id ) $wc_prod = new WC_Product( $product_id ); 840 } 841 842 $product['design'] = $wc_prod->get_name(); 859 860 //for simple type, set the product designation according to name 861 $product['design'] = $wc_prod->get_name(); 862 } 843 863 844 864 global $wpdb; … … 848 868 849 869 //order Item ID 850 $getOrderItemID = $wpdb->get_var( $wpdb->prepare("SELECT order_item_id FROM ".$wpdb->prefix."woocommerce_order_items WHERE order_item_name ='".$product['design']."' and order_item_type = 'line_item' and order_id = '".$orderid."' LIMIT 1" ) ); 870 //$getOrderItemID = $wpdb->get_var( $wpdb->prepare("SELECT order_item_id FROM ".$wpdb->prefix."woocommerce_order_items WHERE order_item_name ='".$product['design']."' and order_item_type = 'line_item' and order_id = '".$orderid."' LIMIT 1" ) ); 871 $getOrderItemID = $wpdb->get_var( $wpdb->prepare("SELECT order_item_id FROM ".$wpdb->prefix."woocommerce_order_items WHERE order_item_name ='".$wc_prod->get_name()."' and order_item_type = 'line_item' and order_id = '".$orderid."' LIMIT 1" ) ); 851 872 //order Item product by order Item ID 852 873 $item = new WC_Order_Item_Product($getOrderItemID); 853 874 854 875 //$this->logs->writeFileLog('item', $item); 855 876 856 877 // The product name 857 878 $item_name = $item->get_name(); 858 879 859 if($item_name == $ product['design']){880 if($item_name == $wc_prod->get_name()){ 860 881 //get taxes array for item 861 882 $taxes = $item->get_taxes(); … … 1024 1045 $ft->shipping_name = $wooOrder->shipping_name; 1025 1046 $ft->shipping_value = $wooOrder->shipping_value; 1026 $ft->shipping_country = $wooOrder->shipping_country; ;1047 $ft->shipping_country = $wooOrder->shipping_country; 1027 1048 $ft->shipping_taxValue = $wooOrder->shipping_taxValue; 1028 1049 $ft->shipping_tax = $wooOrder->shipping_tax;
Note: See TracChangeset
for help on using the changeset viewer.