Changeset 1999880
- Timestamp:
- 12/21/2018 04:37:09 PM (7 years ago)
- Location:
- drivefx-woocommerce/trunk
- Files:
-
- 2 edited
-
class.DriveFxWoocommerce.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
drivefx-woocommerce/trunk/class.DriveFxWoocommerce.php
r1898537 r1999880 1726 1726 } 1727 1727 1728 if($billing_country=="GB" ){ 1729 $this->paramsQuery('Countries', 'nomeabrv', "UK"); 1730 }else if($billing_country_=="GB"){ 1731 $this->paramsQuery('Countries', 'nomeabrv', "UK"); 1732 } 1728 1733 1729 1734 curl_setopt($ch, CURLOPT_URL, $this->url); … … 2517 2522 } 2518 2523 2519 2524 2525 //get taxes from drive fx 2526 $url = $settings['backend']['url'] . $this->extraurl . "/REST/SearchWS/QueryAsEntities"; 2527 2528 2529 $params = array('itemQuery' => '{"distinct": true, 2530 "groupByItems": [], 2531 "orderByItems": [ 2532 { 2533 "OrderItem": "dataini", 2534 "OrderType": 1 2535 } 2536 ], 2537 "SelectItems": [], 2538 "entityName": "TaxasIVA", 2539 "filterItems": [], 2540 "joinEntities": [] 2541 }' 2542 ); 2543 2544 $queryActEntity = http_build_query($params); 2545 curl_setopt($ch, CURLOPT_URL, $url); 2546 curl_setopt($ch, CURLOPT_POST, false); 2547 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 2548 curl_setopt($ch, CURLOPT_POSTFIELDS, $queryActEntity); 2549 curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8'); 2550 $responseQueryAsEntities = curl_exec($ch); 2551 2552 2553 $responseQueryAsEntities = json_decode($responseQueryAsEntities, true); 2554 2555 2556 if (is_array($_SESSION['listOfSku'])){ 2557 foreach ($_SESSION['listOfSku'] as $key => $value){ 2558 if( $_SESSION['listOfQuantity'][$key]*$_SESSION['listOfValueItem'][$key]!=0){ 2559 //get product id from sku 2560 $getProductId = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_sku' AND meta_value='%s' LIMIT 1", $value ) ); 2561 2562 //get product From id 2563 $getProduct = wc_get_product($getProductId); 2564 2565 //get product tax rate 2566 $getProductTax = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate FROM ".$wpdb->prefix."woocommerce_tax_rates WHERE tax_rate_class='%s' LIMIT 1", $getProduct->get_tax_class() ) ); 2567 //get product tax rate country 2568 $getTaxCountry = $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_country FROM ".$wpdb->prefix."woocommerce_tax_rates WHERE tax_rate_class='%s' LIMIT 1", $getProduct->get_tax_class() ) ); 2569 2570 foreach ($responseQueryAsEntities['result'] as $tax) { 2571 2572 If ($getProductTax == $tax['taxa'] && $getTaxCountry == $tax['regiao'] ) { 2573 $response['result'][0]['bis'][$key]['iva'] = $tax['taxa']; 2574 $response['result'][0]['bis'][$key]['tabiva'] = $tax['codigo']; 2575 2576 break; 2577 } 2578 } 2579 2580 } 2581 } 2582 } 2583 2520 2584 2521 2585 $urlActEntity = $settings['backend']['url'] . $this->extraurl . "/REST/BoWS/actEntity"; -
drivefx-woocommerce/trunk/readme.txt
r1898537 r1999880 4 4 Requires at least: 4.5 5 5 Tested up to: 4.8 6 Stable tag: 4.5. 76 Stable tag: 4.5.8 7 7 License: GPLv2 or later 8 8
Note: See TracChangeset
for help on using the changeset viewer.