Changeset 2752559
- Timestamp:
- 07/06/2022 12:04:11 PM (4 years ago)
- Location:
- unienvios/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
unienvios/trunk/api.php
r2614696 r2752559 50 50 $endpoint = $this->urlBase . '/external-integration/quotation/create'; 51 51 52 //calculo de cubagem 53 $cubagemTotal = 0; 54 $pesoTotal = 0; 55 56 $priceOrderTotal = 0; 57 58 $my_width = $dados['estimate_width']; 59 $my_height = $dados['estimate_height']; 60 $my_length = $dados['estimate_length']; 61 $my_weight = $dados['estimate_weight']; 62 63 $medidas = [ 64 doubleval($my_width) * 1, 65 doubleval($my_height) * 1, 66 doubleval($my_length) * 1, 67 doubleval($my_weight) * 1 68 ]; 69 70 $priceOrderTotal += doubleval($item['price']) * 1; 71 72 73 $pesoTotal += $medidas[3]; 74 75 $cubagem = ($medidas[0] * $medidas[1] * $medidas[2]) / 6000; 76 array_push($medidas, $cubagem); 77 78 $cubagem = $cubagem; 79 $cubagemTotal += $cubagem; 80 81 82 $cubagemTotal = round($cubagemTotal, 4); 83 84 $cubagemReversa = $cubagemTotal * doubleval(6000); 85 86 $raizCubica = pow($cubagemReversa, 1.0 / 3.0); 87 88 $raizCubica = round($raizCubica, 1); 89 90 52 91 $body = array( 53 92 'zipcode_destiny' => $dados['zipcode_destiny'], … … 56 95 'email_recipient' => $dados['email_recipient'], 57 96 'phone_recipient' => $dados['phone_recipient'], 58 'estimate_height' => $ dados['estimate_height'],59 'estimate_width' => $ dados['estimate_width'],60 'estimate_length' => $ dados['estimate_length'],61 'estimate_weight' => $ dados['estimate_weight'],97 'estimate_height' => $raizCubica, 98 'estimate_width' => $raizCubica, 99 'estimate_length' => $raizCubica, 100 'estimate_weight' => $pesoTotal, 62 101 'order_value' => $dados['order_value'], 63 102 'address' => $dados['address'], … … 86 125 87 126 $response = wp_remote_post($endpoint, $options); 127 echo "<pre>"; 128 var_dump($response); 129 echo "</pre>"; 88 130 89 131 if (is_wp_error($response)) { -
unienvios/trunk/index.php
r2642520 r2752559 4 4 Plugin URI: https://unienvios.com.br/ 5 5 Description: Plugin de Entrega 6 Version: 1.2. 16 Version: 1.2.2 7 7 Author: Unienvios 8 8 Author URI: https://unienvios.com.br/ … … 59 59 60 60 $quotation = $api->create_quotation($dados, $dimensoes); 61 61 // echo "<pre>"; 62 // var_dump($quotation); 63 // echo "</pre>"; 62 64 if ($quotation) { 63 65 … … 92 94 $api = new API_UNIENVIOS('https://api.unienvios.com.br'); 93 95 $order = wc_get_order($this_get_id); 96 94 97 $cotacao = $order->get_meta('cotacao'); 95 98 $cotacao_shipping_id = $order->get_meta('shipping_id'); … … 111 114 'order_value' => $cotacao['order_value'], 112 115 'address' => $order->data['shipping']['address_1'], 113 'number' => $number ? $number : " ",116 'number' => $number ? $number : "NÃO INFORMADO", 114 117 'city' => $order->data['shipping']['city'], 115 'neighbourhood' => $neighbourhood ? $neighbourhood : " ",118 'neighbourhood' => $neighbourhood ? $neighbourhood : "NÃO INFORMADO", 116 119 'state' => $order->data['shipping']['state'], 117 'complement' => " teste",120 'complement' => "NÃO INFORMADO", 118 121 'shipping_id' => $cotacao_shipping_id, 119 122 'token_cotacao' => $cotacao['token'], … … 122 125 ]; 123 126 $quotation = $api->cadastrar_cotacao($dados); 127 error_log('teste abaixo'); 128 error_log(json_encode($cotacao['estimate_height'])); 124 129 endif; 125 130 //add message -
unienvios/trunk/readme.txt
r2618384 r2752559 5 5 Requires at least: 4.7 6 6 Tested up to: 5.8 7 Stable tag: 1.2. 07 Stable tag: 1.2.2 8 8 Requires PHP: 7.2 9 9 License: GPLv3 or later … … 68 68 69 69 * Adicionado mais informações no readme, no tópico de instalação 70 = 1.2.2 = 71 72 * Adicionado calculo de medidas
Note: See TracChangeset
for help on using the changeset viewer.