WooCommerce Correios - Version 3.1.5

Version Description

  • 2016/12/31 =

  • Adicionado link para a pgina de rastreio do pedido nas notas do pedido.

  • Corrigido valor declarado utilizando o valor do pacote atual e no do carrinho.

  • Adicionado objeto do pacote no filtro woocommerce_correios_{$method_id}_rate.

Download this release

Release Info

Developer claudiosanches
Plugin Icon 128x128 WooCommerce Correios
Version 3.1.5
Comparing to
See all releases

Code changes from version 3.1.4 to 3.1.5

includes/abstracts/abstract-wc-correios-shipping-carta.php CHANGED
@@ -228,7 +228,7 @@ abstract class WC_Correios_Shipping_Carta extends WC_Correios_Shipping {
228
  'id' => $this->id . $this->instance_id,
229
  'label' => $this->title,
230
  'cost' => $cost + $fee,
231
- ), $this->instance_id );
232
 
233
  // Add rate to WooCommerce.
234
  $this->add_rate( $rate );
228
  'id' => $this->id . $this->instance_id,
229
  'label' => $this->title,
230
  'cost' => $cost + $fee,
231
+ ), $this->instance_id, $package );
232
 
233
  // Add rate to WooCommerce.
234
  $this->add_rate( $rate );
includes/abstracts/abstract-wc-correios-shipping-international.php CHANGED
@@ -197,7 +197,7 @@ abstract class WC_Correios_Shipping_International extends WC_Correios_Shipping {
197
  'id' => $this->id . $this->instance_id,
198
  'label' => $label,
199
  'cost' => $cost + $fee,
200
- ), $this->instance_id );
201
 
202
  // Deprecated filter.
203
  $rates = apply_filters( 'woocommerce_correios_shipping_methods', array( $rate ), $package );
197
  'id' => $this->id . $this->instance_id,
198
  'label' => $label,
199
  'cost' => $cost + $fee,
200
+ ), $this->instance_id, $package );
201
 
202
  // Deprecated filter.
203
  $rates = apply_filters( 'woocommerce_correios_shipping_methods', array( $rate ), $package );
includes/abstracts/abstract-wc-correios-shipping.php CHANGED
@@ -298,19 +298,6 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
298
  return $this->is_corporate() ? $this->password : '';
299
  }
300
 
301
- /**
302
- * Get cart total.
303
- *
304
- * @return float
305
- */
306
- protected function get_cart_total() {
307
- if ( ! WC()->cart->prices_include_tax ) {
308
- return WC()->cart->cart_contents_total;
309
- }
310
-
311
- return WC()->cart->cart_contents_total + WC()->cart->tax_total;
312
- }
313
-
314
  /**
315
  * Get shipping rate.
316
  *
@@ -327,7 +314,7 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
327
  $api->set_destination_postcode( $package['destination']['postcode'] );
328
 
329
  if ( 'yes' === $this->declare_value ) {
330
- $api->set_declared_value( $this->get_cart_total() );
331
  }
332
 
333
  $api->set_own_hands( 'yes' === $this->own_hands ? 'S' : 'N' );
@@ -433,7 +420,7 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
433
  'id' => $this->id . $this->instance_id,
434
  'label' => $label,
435
  'cost' => $cost + $fee,
436
- ), $this->instance_id );
437
 
438
  // Deprecated filter.
439
  $rates = apply_filters( 'woocommerce_correios_shipping_methods', array( $rate ), $package );
298
  return $this->is_corporate() ? $this->password : '';
299
  }
300
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  /**
302
  * Get shipping rate.
303
  *
314
  $api->set_destination_postcode( $package['destination']['postcode'] );
315
 
316
  if ( 'yes' === $this->declare_value ) {
317
+ $api->set_declared_value( $package['contents_cost'] );
318
  }
319
 
320
  $api->set_own_hands( 'yes' === $this->own_hands ? 'S' : 'N' );
420
  'id' => $this->id . $this->instance_id,
421
  'label' => $label,
422
  'cost' => $cost + $fee,
423
+ ), $this->instance_id, $package );
424
 
425
  // Deprecated filter.
426
  $rates = apply_filters( 'woocommerce_correios_shipping_methods', array( $rate ), $package );
includes/shipping/class-wc-correios-shipping-legacy.php CHANGED
@@ -282,19 +282,6 @@ class WC_Correios_Shipping_Legacy extends WC_Shipping_Method {
282
  return array_filter( $services );
283
  }
284
 
285
- /**
286
- * Get cart total.
287
- *
288
- * @return float
289
- */
290
- protected function get_cart_total() {
291
- if ( ! WC()->cart->prices_include_tax ) {
292
- return WC()->cart->cart_contents_total;
293
- }
294
-
295
- return WC()->cart->cart_contents_total + WC()->cart->tax_total;
296
- }
297
-
298
  /**
299
  * Gets the price of shipping.
300
  *
@@ -312,7 +299,7 @@ class WC_Correios_Shipping_Legacy extends WC_Shipping_Method {
312
  $connect->set_destination_postcode( $package['destination']['postcode'] );
313
 
314
  if ( 'declare' == $this->declare_value ) {
315
- $connect->set_declared_value( $this->get_cart_total() );
316
  }
317
 
318
  if ( 'corporate' == $this->corporate_service ) {
282
  return array_filter( $services );
283
  }
284
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  /**
286
  * Gets the price of shipping.
287
  *
299
  $connect->set_destination_postcode( $package['destination']['postcode'] );
300
 
301
  if ( 'declare' == $this->declare_value ) {
302
+ $connect->set_declared_value( $package['contents_cost'] );
303
  }
304
 
305
  if ( 'corporate' == $this->corporate_service ) {
includes/wc-correios-functions.php CHANGED
@@ -143,8 +143,11 @@ function wc_correios_update_tracking_code( $order_id, $tracking_code ) {
143
  // Gets order data.
144
  $order = wc_get_order( $order_id );
145
 
 
 
 
146
  // Add order note.
147
- $order->add_order_note( sprintf( __( 'Added a Correios tracking code: %s', 'woocommerce-correios' ), $tracking_code ) );
148
 
149
  // Send email notification.
150
  wc_correios_trigger_tracking_code_email( $order, $tracking_code );
143
  // Gets order data.
144
  $order = wc_get_order( $order_id );
145
 
146
+ // Build tracking link.
147
+ $tracking_link = sprintf( '<a href="http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=$tracking_code" target="_blank">%s</a>', $tracking_code );
148
+
149
  // Add order note.
150
+ $order->add_order_note( sprintf( __( 'Added a Correios tracking code: %s', 'woocommerce-correios' ), $tracking_link ) );
151
 
152
  // Send email notification.
153
  wc_correios_trigger_tracking_code_email( $order, $tracking_code );
languages/woocommerce-correios.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Correios 3.1.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/plugins/woocommerce-domination/\n"
7
- "POT-Creation-Date: 2016-12-24 01:20:03+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -505,7 +505,7 @@ msgstr ""
505
  #: includes/integrations/class-wc-correios-integration.php:24
506
  #: includes/shipping/class-wc-correios-shipping-legacy.php:17
507
  #: includes/shipping/class-wc-correios-shipping-legacy.php:89
508
- #: includes/shipping/class-wc-correios-shipping-legacy.php:439
509
  #: templates/myaccount/tracking-code.php:16
510
  msgid "Correios"
511
  msgstr ""
@@ -819,7 +819,7 @@ msgstr ""
819
  msgid "Area with delivery temporarily subjected to different periods."
820
  msgstr ""
821
 
822
- #: includes/wc-correios-functions.php:147
823
  msgid "Added a Correios tracking code: %s"
824
  msgstr ""
825
 
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Correios 3.1.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/plugins/woocommerce-domination/\n"
7
+ "POT-Creation-Date: 2016-12-31 02:40:55+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
505
  #: includes/integrations/class-wc-correios-integration.php:24
506
  #: includes/shipping/class-wc-correios-shipping-legacy.php:17
507
  #: includes/shipping/class-wc-correios-shipping-legacy.php:89
508
+ #: includes/shipping/class-wc-correios-shipping-legacy.php:426
509
  #: templates/myaccount/tracking-code.php:16
510
  msgid "Correios"
511
  msgstr ""
819
  msgid "Area with delivery temporarily subjected to different periods."
820
  msgstr ""
821
 
822
+ #: includes/wc-correios-functions.php:150
823
  msgid "Added a Correios tracking code: %s"
824
  msgstr ""
825
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://claudiosmweb.com/doacoes/
4
  Tags: shipping, delivery, woocommerce, correios
5
  Requires at least: 4.0
6
  Tested up to: 4.7
7
- Stable tag: 3.1.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -203,6 +203,12 @@ Em caso de dúvidas, basta abrir um tópico no [fórum de suporte do plugin](htt
203
 
204
  == Changelog ==
205
 
 
 
 
 
 
 
206
  = 3.1.4 - 2016/12/23 =
207
 
208
  - Adicionada prevenção de erros no PHP quando todos os valores de peso e dimensões estão em branco.
@@ -268,9 +274,8 @@ Em caso de dúvidas, basta abrir um tópico no [fórum de suporte do plugin](htt
268
 
269
  == Upgrade Notice ==
270
 
271
- = 3.1.4 =
272
 
273
- - Adicionada prevenção de erros no PHP quando todos os valores de peso e dimensões estão em branco.
274
- - Introduzido o filtro `woocommerce_correios_get_estimating_delivery` para edição da estimativa de entrega.
275
- - Adicionada informações do pacote nos filtros para tornar possível calcular frete para múltiplos pacotes.
276
- - Adicionada prevenção de erro quando Correios retorna apenas um objeto no rastreio de entrega.
4
  Tags: shipping, delivery, woocommerce, correios
5
  Requires at least: 4.0
6
  Tested up to: 4.7
7
+ Stable tag: 3.1.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
203
 
204
  == Changelog ==
205
 
206
+ = 3.1.5 - 2016/12/31 =
207
+
208
+ - Adicionado link para a página de rastreio do pedido nas notas do pedido.
209
+ - Corrigido valor declarado utilizando o valor do pacote atual e não do carrinho.
210
+ - Adicionado objeto do pacote no filtro `woocommerce_correios_{$method_id}_rate`.
211
+
212
  = 3.1.4 - 2016/12/23 =
213
 
214
  - Adicionada prevenção de erros no PHP quando todos os valores de peso e dimensões estão em branco.
274
 
275
  == Upgrade Notice ==
276
 
277
+ = 3.1.5 =
278
 
279
+ - Adicionado link para a página de rastreio do pedido nas notas do pedido.
280
+ - Corrigido valor declarado utilizando o valor do pacote atual e não do carrinho.
281
+ - Adicionado objeto do pacote no filtro `woocommerce_correios_{$method_id}_rate`.
 
woocommerce-correios.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Adds Correios shipping methods to your WooCommerce store.
6
  * Author: Claudio Sanches
7
  * Author URI: https://claudiosmweb.com
8
- * Version: 3.1.4
9
  * License: GPLv2 or later
10
  * Text Domain: woocommerce-correios
11
  * Domain Path: /languages
@@ -44,7 +44,7 @@ if ( ! class_exists( 'WC_Correios' ) ) :
44
  *
45
  * @var string
46
  */
47
- const VERSION = '3.1.4';
48
 
49
  /**
50
  * Instance of this class.
5
  * Description: Adds Correios shipping methods to your WooCommerce store.
6
  * Author: Claudio Sanches
7
  * Author URI: https://claudiosmweb.com
8
+ * Version: 3.1.5
9
  * License: GPLv2 or later
10
  * Text Domain: woocommerce-correios
11
  * Domain Path: /languages
44
  *
45
  * @var string
46
  */
47
+ const VERSION = '3.1.5';
48
 
49
  /**
50
  * Instance of this class.