Plugin Directory

Changeset 2688315


Ignore:
Timestamp:
03/03/2022 04:43:56 PM (4 years ago)
Author:
phcwordpress
Message:

upd 20220303

Location:
drivefx-woocommerce/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • drivefx-woocommerce/trunk/PHCLibrary/orders.php

    r2633497 r2688315  
    356356        $shipping = $dataPack->shipping;
    357357
    358 
    359358        //Obtain new instance of Bo
    360359        $response = $this->utils_services->paramsNewInstance($ch, $credentials, 'BoWS', $settings->typeOfOrder);
     
    382381            $response = $this->utils_services->actEntity($ch, $credentials, 'BoWS', $response);
    383382
    384             //$this->logs->writeFileLog('actEntity:', $response['result'][0]);
     383            //$this->logs->writeFileLog('actEntity:', $response);
    385384
    386385            if (curl_error($ch)) {
     
    429428                        $bi->ref =  $product['ref'];
    430429                        $bi->design = $product['design'];
     430                        $bi->armazem = $settings->warehouseOrder;
    431431                        //fulfill Bis
    432432                        $response['result'][0]['bis'][] = $bi;
     433
     434                        //$this->logs->writeFileLog('bis build:', $response['result'][0]['bis']);
    433435                    }
    434436                }
     
    442444                        $responseSt = $this->utils_services->filterItem_Query($ch, $credentials, 'St', 'ref', $settings->shippingName);
    443445
    444                         //$this->logs->writeFileLog('ResponseST.01', $response);
     446                        //$this->logs->writeFileLog('ResponseST.01', $responseSt);
    445447
    446448                        if(empty($responseSt)) {                                       
     
    448450                            $this->logs->writeFileLog('Warning', "We couldn't find a reference for Shipping, so we'll use WC data");
    449451                            $bi->ref = "";                             
    450                             $bi->design = $shipping->shipping_name;                                     
     452                            $bi->design = $shipping->shipping_name;                                                              
    451453                        } else {
    452454                            //Set Service Data from PHC GO
    453455                            $bi->ref = $responseSt['result'][0]['ref'];
    454456                            $bi->design = $responseSt['result'][0]['design'];
     457                            //$bi->armazem = $settings->warehouseOrder;
    455458   
    456459                        }
     
    480483
    481484                    if($bi->edebito == 0){
    482                         $bi->qtt = 0;
     485                        //$bi->qtt = 0;
    483486                        $bi->ivaincl = false;
    484487                    }
     
    488491                $response2 = $this->utils_services->actEntity($ch, $credentials, 'BoWS', $response);
    489492
    490                 //$this->logs->writeFileLog('actEntity.0.1:', $response2['result']);
     493                //$this->logs->writeFileLog('response2:', $response2['result']);
    491494
    492495                // Update shipping value
     
    688691                                }
    689692                                $bi->edebito = $bi->ettdeb = 0;
    690                                 $bi->qtt = 0;
     693                                //$bi->qtt = 0;
    691694                                $bi->ivaincl=false;
    692695                                //fulfill Bis
     
    793796                                $response = $this->utils_services->paramsSave($ch, $credentials, 'BoWS', $response);
    794797
    795                                 // $this->logs->writeFileLog('save2:', $response);
     798                                //$this->logs->writeFileLog('save2:', $response);
    796799
    797800                                if (curl_error($ch)) {
     
    825828                                    }
    826829                                }
     830                                $this->logs->writeFileLog('addNewOrder17.2', "Order number: ".$response['obrano']." was created!" );
    827831                            }
    828832                        }
     
    831835            }
    832836        }
    833         $this->logs->writeFileLog('addNewOrder17.2', "Order number: ".$response['obrano']." was created!" );
    834837
    835838        return $response;
  • drivefx-woocommerce/trunk/drivefx-woocommerce.php

    r2645266 r2688315  
    33 * Plugin Name: PHC GO WooCommerce
    44 * Description: Easy integration between Woocommerce WordPress and your PHC GO installation.
    5  * Version: 4.8.0
     5 * Version: 4.9.0
    66 * Author: PHC Software, S.A.
    77 * Author URI: https://www.phcgo.net/
  • drivefx-woocommerce/trunk/settings/syncro_gate.php

    r2645234 r2688315  
    2929
    3030            $settings = get_option(DRIVEFXWOOCOMMERCE_PLUGIN_NAME);
     31
     32            //$this->logs->writeFileLog('settings', $settings);
    3133
    3234            // get token
     
    280282                $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 " ) );
    281283                $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               
    284285            /*******************************************************************
    285286            *               --- Alternative select Data  ---                   *
     
    569570            $cart_contents = WC()->cart->cart_contents;
    570571
     572           // $this->logs->writeFileLog('cart_contents', $cart_contents);
     573
    571574            if (is_array($cart_contents)){
    572575                foreach (WC()->cart->cart_contents as $key => $value){
     
    575578                    $productData = WC()->cart->cart_contents[$key];
    576579
    577                     //$this->logs->writeFileLog('productData', $productData);
     580                   //$this->logs->writeFileLog('productData', $productData);
    578581
    579582                    //obtain reference items in cart
     
    642645                    $getproducttype = wc_get_product($product_id);
    643646                    $typeproduct = $getproducttype->get_type();
     647
    644648                    if ($typeproduct == 'variation'){
    645649                        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 {
    648654                        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                    } 
    652659
    653660                    // order tax rate country
    654661                    $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" ) );
    655662                    $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                   
    657664                    //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                                     
    659668                    //order Item product by order Item ID
    660669                    $item = new WC_Order_Item_Product($getOrderItemID);
    661670
    662                     //$this->logs->writeFileLog('item', $item);
    663 
    664671                    // The product name
    665672                    $item_name = $item->get_name();
    666 
    667                     if($item_name == $product['design']){
     673                   
     674                    if($item_name == $wc_product->get_name()){
    668675                        //get taxes array for item
    669676                        $taxes = $item->get_taxes();
     
    833840                    $getproducttype = wc_get_product($product_id);
    834841                    $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
    835852                    if ($typeproduct == 'variation'){
    836853                        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 {
    839858                        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                    } 
    843863
    844864                    global $wpdb;
     
    848868
    849869                    //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" ) );                                     
    851872                    //order Item product by order Item ID
    852873                    $item = new WC_Order_Item_Product($getOrderItemID);
    853874
    854875                    //$this->logs->writeFileLog('item', $item);
    855 
     876 
    856877                    // The product name
    857878                    $item_name = $item->get_name();
    858879
    859                     if($item_name == $product['design']){
     880                    if($item_name == $wc_prod->get_name()){
    860881                        //get taxes array for item
    861882                        $taxes = $item->get_taxes();
     
    10241045                $ft->shipping_name = $wooOrder->shipping_name;
    10251046                $ft->shipping_value = $wooOrder->shipping_value;
    1026                 $ft->shipping_country = $wooOrder->shipping_country;;
     1047                $ft->shipping_country = $wooOrder->shipping_country;
    10271048                $ft->shipping_taxValue = $wooOrder->shipping_taxValue;
    10281049                $ft->shipping_tax = $wooOrder->shipping_tax;
Note: See TracChangeset for help on using the changeset viewer.