WooCommerce Correios - Version 3.2.0

Version Description

  • 2017/03/07 =

  • Adicionado suporte para o WooCommerce 2.7.

  • Atualizados os valores do Impresso Normal e Impresso Urgente (Obrigado Alex Koti).

  • Adicionado suporte para vrios cdigos de rastreamento para cara pedido.

  • Adicionado suporte a classes de entrega para todos os mtodos de entrega.

  • Corrigida compatibilidade com PHP 7.1.

Download this release

Release Info

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

Code changes from version 3.1.7 to 3.2.0

Files changed (34) hide show
  1. assets/css/admin/orders.css +62 -0
  2. assets/css/admin/orders.min.css +1 -0
  3. assets/js/admin/orders.js +146 -0
  4. assets/js/admin/orders.min.js +1 -0
  5. assets/js/admin/shipping-methods.js +1 -1
  6. assets/js/admin/shipping-methods.min.js +1 -1
  7. assets/js/frontend/autofill-address.min.js +1 -1
  8. includes/abstracts/abstract-wc-correios-shipping-carta.php +3 -3
  9. includes/abstracts/abstract-wc-correios-shipping-impresso.php +8 -8
  10. includes/abstracts/abstract-wc-correios-shipping-international.php +18 -3
  11. includes/abstracts/abstract-wc-correios-shipping.php +65 -5
  12. includes/admin/class-wc-correios-admin-orders.php +59 -18
  13. includes/admin/views/html-meta-box-tracking-code.php +45 -0
  14. includes/class-wc-correios-install.php +1 -1
  15. includes/class-wc-correios-package.php +6 -19
  16. includes/class-wc-correios-rest-api.php +3 -3
  17. includes/class-wc-correios-tracking-history.php +60 -32
  18. includes/class-wc-correios-webservice.php +1 -1
  19. includes/emails/class-wc-correios-tracking-email.php +42 -8
  20. includes/integrations/class-wc-correios-integration.php +1 -3
  21. includes/shipping/class-wc-correios-shipping-impresso-normal.php +28 -28
  22. includes/shipping/class-wc-correios-shipping-impresso-urgente.php +15 -15
  23. includes/shipping/class-wc-correios-shipping-legacy.php +1 -1
  24. includes/wc-correios-functions.php +63 -12
  25. languages/woocommerce-correios.pot +177 -151
  26. readme.txt +16 -4
  27. templates/emails/correios-tracking-code.php +11 -46
  28. templates/emails/plain/correios-tracking-code.php +13 -36
  29. templates/myaccount/tracking-code.php +0 -17
  30. templates/myaccount/tracking-codes.php +21 -0
  31. templates/myaccount/tracking-history-table.php +3 -5
  32. templates/myaccount/tracking-title.php +15 -0
  33. wc-correios.php +0 -21
  34. woocommerce-correios.php +3 -3
assets/css/admin/orders.css ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Tracking code metabox styles.
3
+ */
4
+
5
+ #poststuff #wc_correios .inside {
6
+ padding: 0;
7
+ }
8
+
9
+ .correios-tracking-code__list {
10
+ border-bottom: 1px solid #ddd;
11
+ margin-bottom: 10px;
12
+ padding: 10px;
13
+ }
14
+
15
+ .correios-tracking-code__list ul {
16
+ display: block;
17
+ list-style-type: circle;
18
+ margin: .5em 0;
19
+ padding-left: 1.2em;
20
+ }
21
+
22
+ .correios-tracking-code .dashicons-dismiss {
23
+ color: #a00;
24
+ margin-left: .4em;
25
+ text-decoration: none;
26
+ vertical-align: baseline;
27
+ }
28
+
29
+ .correios-tracking-code .dashicons-dismiss:hover {
30
+ color: red;
31
+ text-decoration: none;
32
+ }
33
+
34
+ .correios-tracking-code .dashicons-dismiss::before {
35
+ font-family: "Dashicons";
36
+ text-align: center;
37
+ text-decoration: none;
38
+ vertical-align: middle;
39
+ }
40
+
41
+ .correios-tracking-code .dashicons-plus::before {
42
+ font-family: "Dashicons";
43
+ }
44
+
45
+ .correios-tracking-code fieldset {
46
+ padding: 0 10px 10px;
47
+ }
48
+
49
+ .correios-tracking-code label {
50
+ display: block;
51
+ }
52
+
53
+ .correios-tracking-code input {
54
+ width: 225px;
55
+ }
56
+
57
+ #poststuff .correios-tracking-code button {
58
+ height: 24px;
59
+ line-height: 1;
60
+ padding: 5px;
61
+ width: 24px;
62
+ }
assets/css/admin/orders.min.css ADDED
@@ -0,0 +1 @@
 
1
+ #poststuff #wc_correios .inside{padding:0}.correios-tracking-code__list{border-bottom:1px solid #ddd;margin-bottom:10px;padding:10px}.correios-tracking-code__list ul{display:block;list-style-type:circle;margin:.5em 0;padding-left:1.2em}.correios-tracking-code .dashicons-dismiss{color:#a00;margin-left:.4em;text-decoration:none;vertical-align:baseline}.correios-tracking-code .dashicons-dismiss:hover{color:red;text-decoration:none}.correios-tracking-code .dashicons-dismiss::before{font-family:Dashicons;text-align:center;text-decoration:none;vertical-align:middle}.correios-tracking-code .dashicons-plus::before{font-family:Dashicons}.correios-tracking-code fieldset{padding:0 10px 10px}.correios-tracking-code label{display:block}.correios-tracking-code input{width:225px}#poststuff .correios-tracking-code button{height:24px;line-height:1;padding:5px;width:24px}
assets/js/admin/orders.js ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global wp, ajaxurl, WCCorreiosAdminOrdersParams */
2
+ jQuery( function( $ ) {
3
+
4
+ /**
5
+ * Admin class.
6
+ *
7
+ * @type {Object}
8
+ */
9
+ var WCCorreiosAdminOrders = {
10
+
11
+ /**
12
+ * Initialize actions.
13
+ */
14
+ init: function() {
15
+ $( document.body )
16
+ .on( 'click', '.correios-tracking-code .dashicons-dismiss', this.removeTrackingCode )
17
+ .on( 'click', '.correios-tracking-code .button-secondary', this.addTrackingCode );
18
+ },
19
+
20
+ /**
21
+ * Block meta boxes.
22
+ */
23
+ block: function() {
24
+ $( '#wc_correios' ).block({
25
+ message: null,
26
+ overlayCSS: {
27
+ background: '#fff',
28
+ opacity: 0.6
29
+ }
30
+ });
31
+ },
32
+
33
+ /**
34
+ * Unblock meta boxes.
35
+ */
36
+ unblock: function() {
37
+ $( '#wc_correios' ).unblock();
38
+ },
39
+
40
+ /**
41
+ * Add tracking fields.
42
+ *
43
+ * @param {Object} $el Current element.
44
+ */
45
+ addTrackingFields: function( trackingCodes ) {
46
+ var $wrap = $( 'body #wc_correios .correios-tracking-code' );
47
+ var template = wp.template( 'tracking-code-list' );
48
+
49
+ $( '.correios-tracking-code__list', $wrap ).remove();
50
+ $wrap.prepend( template( { 'trackingCodes': trackingCodes } ) );
51
+ },
52
+
53
+ /**
54
+ * Add tracking code.
55
+ *
56
+ * @param {Object} evt Current event.
57
+ */
58
+ addTrackingCode: function( evt ) {
59
+ evt.preventDefault();
60
+
61
+ var $el = $( '#add-tracking-code' );
62
+ var trackingCode = $el.val();
63
+
64
+ if ( '' === trackingCode ) {
65
+ return;
66
+ }
67
+
68
+ var self = WCCorreiosAdminOrders;
69
+ var data = {
70
+ action: 'woocommerce_correios_add_tracking_code',
71
+ security: WCCorreiosAdminOrdersParams.nonces.add,
72
+ order_id: WCCorreiosAdminOrdersParams.order_id,
73
+ tracking_code: trackingCode
74
+ };
75
+
76
+ self.block();
77
+
78
+ // Clean input.
79
+ $el.val( '' );
80
+
81
+ // Add tracking code.
82
+ $.ajax({
83
+ type: 'POST',
84
+ url: ajaxurl,
85
+ data: data,
86
+ success: function( response ) {
87
+ self.addTrackingFields( response.data );
88
+ self.unblock();
89
+ }
90
+ });
91
+ },
92
+
93
+ /**
94
+ * Remove tracking fields.
95
+ *
96
+ * @param {Object} $el Current element.
97
+ */
98
+ removeTrackingFields: function( $el ) {
99
+ var $wrap = $( 'body #wc_correios .correios-tracking-code__list' );
100
+
101
+ if ( 1 === $( 'li', $wrap ).length ) {
102
+ $wrap.remove();
103
+ } else {
104
+ $el.closest( 'li' ).remove();
105
+ }
106
+ },
107
+
108
+ /**
109
+ * Remove tracking code.
110
+ *
111
+ * @param {Object} evt Current event.
112
+ */
113
+ removeTrackingCode: function( evt ) {
114
+ evt.preventDefault();
115
+
116
+ // Ask if really want remove the tracking code.
117
+ if ( ! window.confirm( WCCorreiosAdminOrdersParams.i18n.removeQuestion ) ) {
118
+ return;
119
+ }
120
+
121
+ var self = WCCorreiosAdminOrders;
122
+ var $el = $( this );
123
+ var data = {
124
+ action: 'woocommerce_correios_remove_tracking_code',
125
+ security: WCCorreiosAdminOrdersParams.nonces.remove,
126
+ order_id: WCCorreiosAdminOrdersParams.order_id,
127
+ tracking_code: $el.data( 'code' )
128
+ };
129
+
130
+ self.block();
131
+
132
+ // Remove tracking code.
133
+ $.ajax({
134
+ type: 'POST',
135
+ url: ajaxurl,
136
+ data: data,
137
+ success: function() {
138
+ self.removeTrackingFields( $el );
139
+ self.unblock();
140
+ }
141
+ });
142
+ }
143
+ };
144
+
145
+ WCCorreiosAdminOrders.init();
146
+ });
assets/js/admin/orders.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(function(a){var b={init:function(){a(document.body).on("click",".correios-tracking-code .dashicons-dismiss",this.removeTrackingCode).on("click",".correios-tracking-code .button-secondary",this.addTrackingCode)},block:function(){a("#wc_correios").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){a("#wc_correios").unblock()},addTrackingFields:function(b){var c=a("body #wc_correios .correios-tracking-code"),d=wp.template("tracking-code-list");a(".correios-tracking-code__list",c).remove(),c.prepend(d({trackingCodes:b}))},addTrackingCode:function(c){c.preventDefault();var d=a("#add-tracking-code"),e=d.val();if(""!==e){var f=b,g={action:"woocommerce_correios_add_tracking_code",security:WCCorreiosAdminOrdersParams.nonces.add,order_id:WCCorreiosAdminOrdersParams.order_id,tracking_code:e};f.block(),d.val(""),a.ajax({type:"POST",url:ajaxurl,data:g,success:function(a){f.addTrackingFields(a.data),f.unblock()}})}},removeTrackingFields:function(b){var c=a("body #wc_correios .correios-tracking-code__list");1===a("li",c).length?c.remove():b.closest("li").remove()},removeTrackingCode:function(c){if(c.preventDefault(),window.confirm(WCCorreiosAdminOrdersParams.i18n.removeQuestion)){var d=b,e=a(this),f={action:"woocommerce_correios_remove_tracking_code",security:WCCorreiosAdminOrdersParams.nonces.remove,order_id:WCCorreiosAdminOrdersParams.order_id,tracking_code:e.data("code")};d.block(),a.ajax({type:"POST",url:ajaxurl,data:f,success:function(){d.removeTrackingFields(e),d.unblock()}})}}};b.init()});
assets/js/admin/shipping-methods.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery( document ).ready( function( $ ) {
2
  $( 'input[id$="_show_delivery_time"], #woocommerce_correios_display_date' ).on( 'change', function() {
3
  var field = $( 'input[id$="_additional_time"]' ).closest( 'tr' );
4
 
1
+ jQuery( function( $ ) {
2
  $( 'input[id$="_show_delivery_time"], #woocommerce_correios_display_date' ).on( 'change', function() {
3
  var field = $( 'input[id$="_additional_time"]' ).closest( 'tr' );
4
 
assets/js/admin/shipping-methods.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(a){a('input[id$="_show_delivery_time"], #woocommerce_correios_display_date').on("change",function(){var b=a('input[id$="_additional_time"]').closest("tr");a(this).is(":checked")?b.show():b.hide()}).change(),a('select[id$="_service_type"], #woocommerce_correios_corporate_service').on("change",function(){var b=a('input[id$="_login"]').closest("tr"),c=a('input[id$="_password"]').closest("tr");"corporate"===a(this).val()?(b.show(),c.show()):(b.hide(),c.hide())}).change()});
1
+ jQuery(function(a){a('input[id$="_show_delivery_time"], #woocommerce_correios_display_date').on("change",function(){var b=a('input[id$="_additional_time"]').closest("tr");a(this).is(":checked")?b.show():b.hide()}).change(),a('select[id$="_service_type"], #woocommerce_correios_corporate_service').on("change",function(){var b=a('input[id$="_login"]').closest("tr"),c=a('input[id$="_password"]').closest("tr");"corporate"===a(this).val()?(b.show(),c.show()):(b.hide(),c.hide())}).change()});
assets/js/frontend/autofill-address.min.js CHANGED
@@ -5,4 +5,4 @@
5
  *
6
  * Version: 3.0.0
7
  */
8
- jQuery(function(a){var b={init:function(){this.autofill("billing",!0),a(document.body).on("blur","#billing_postcode",function(){b.autofill("billing")}),a(document.body).on("blur","#shipping_postcode",function(){b.autofill("shipping")})},block:function(){a("form.checkout, form#order_review").addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){a("form.checkout, form#order_review").removeClass("processing").unblock()},autofill:function(c,d){if(d=d||!1,a("#"+c+"_postcode").length){var e=a("#"+c+"_postcode").val().replace(".","").replace("-",""),f=a("#"+c+"_country").val(),g=a("#"+c+"_address_1").val(),h="yes"===WCCorreiosAutofillAddressParams.force?!0:0===g.length;""!==e&&8===e.length&&"BR"===f&&h&&(b.block(),a.ajax({type:"GET",url:WCCorreiosAutofillAddressParams.url+"&postcode="+e,dataType:"json",contentType:"application/json",success:function(a){if(a.success&&(b.fillFields(c,a.data),d)){var e="billing"===c?"shipping":"billing";b.fillFields(e,a.data)}b.unblock()}}))}},fillFields:function(b,c){a("#"+b+"_address_1").val(c.address).change(),a("#"+b+"_neighborhood").length?a("#"+b+"_neighborhood").val(c.neighborhood).change():a("#"+b+"_address_2").val(c.neighborhood).change(),a("#"+b+"_city").val(c.city).change(),a("#"+b+"_state option:selected").attr("selected",!1).change(),a("#"+b+'_state option[value="'+c.state+'"]').attr("selected","selected").change(),a("#"+b+"_state").trigger("liszt:updated").trigger("chosen:updated")}};b.init()});
5
  *
6
  * Version: 3.0.0
7
  */
8
+ jQuery(function(a){var b={init:function(){this.autofill("billing",!0),a(document.body).on("blur","#billing_postcode",function(){b.autofill("billing")}),a(document.body).on("blur","#shipping_postcode",function(){b.autofill("shipping")})},block:function(){a("form.checkout, form#order_review").addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){a("form.checkout, form#order_review").removeClass("processing").unblock()},autofill:function(c,d){if(d=d||!1,a("#"+c+"_postcode").length){var e=a("#"+c+"_postcode").val().replace(".","").replace("-",""),f=a("#"+c+"_country").val(),g=a("#"+c+"_address_1").val(),h="yes"===WCCorreiosAutofillAddressParams.force||0===g.length;""!==e&&8===e.length&&"BR"===f&&h&&(b.block(),a.ajax({type:"GET",url:WCCorreiosAutofillAddressParams.url+"&postcode="+e,dataType:"json",contentType:"application/json",success:function(a){if(a.success&&(b.fillFields(c,a.data),d)){var e="billing"===c?"shipping":"billing";b.fillFields(e,a.data)}b.unblock()}}))}},fillFields:function(b,c){a("#"+b+"_address_1").val(c.address).change(),a("#"+b+"_neighborhood").length?a("#"+b+"_neighborhood").val(c.neighborhood).change():a("#"+b+"_address_2").val(c.neighborhood).change(),a("#"+b+"_city").val(c.city).change(),a("#"+b+"_state option:selected").attr("selected",!1).change(),a("#"+b+'_state option[value="'+c.state+'"]').attr("selected","selected").change(),a("#"+b+"_state").trigger("liszt:updated").trigger("chosen:updated")}};b.init()});
includes/abstracts/abstract-wc-correios-shipping-carta.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WooCommerce_Correios/Abstracts
6
  * @since 3.1.0
7
- * @version 3.1.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
@@ -217,7 +217,7 @@ abstract class WC_Correios_Shipping_Carta extends WC_Correios_Shipping {
217
  }
218
 
219
  if ( $qty > 0 && $product->needs_shipping() ) {
220
- $product_weight = wc_get_weight( str_replace( ',', '.', $product->weight ), 'g' );
221
 
222
  if ( $qty > 1 ) {
223
  $product_weight *= $qty;
@@ -255,7 +255,7 @@ abstract class WC_Correios_Shipping_Carta extends WC_Correios_Shipping {
255
  $rate = apply_filters( 'woocommerce_correios_' . $this->id . '_rate', array(
256
  'id' => $this->id . $this->instance_id,
257
  'label' => $this->get_shipping_method_label( (int) $this->get_shipping_time( $package ), $package ),
258
- 'cost' => $cost + $fee,
259
  ), $this->instance_id, $package );
260
 
261
  // Add rate to WooCommerce.
4
  *
5
  * @package WooCommerce_Correios/Abstracts
6
  * @since 3.1.0
7
+ * @version 3.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
217
  }
218
 
219
  if ( $qty > 0 && $product->needs_shipping() ) {
220
+ $product_weight = wc_get_weight( (float) $product->get_weight(), 'g' );
221
 
222
  if ( $qty > 1 ) {
223
  $product_weight *= $qty;
255
  $rate = apply_filters( 'woocommerce_correios_' . $this->id . '_rate', array(
256
  'id' => $this->id . $this->instance_id,
257
  'label' => $this->get_shipping_method_label( (int) $this->get_shipping_time( $package ), $package ),
258
+ 'cost' => (float) $cost + (float) $fee,
259
  ), $this->instance_id, $package );
260
 
261
  // Add rate to WooCommerce.
includes/abstracts/abstract-wc-correios-shipping-impresso.php CHANGED
@@ -21,7 +21,7 @@ abstract class WC_Correios_Shipping_Impresso extends WC_Correios_Shipping_Carta
21
  /**
22
  * National Registry cost.
23
  *
24
- * Cost based in 25/08/2016 from:
25
  * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-adicionais-nacionais
26
  *
27
  * @var float
@@ -31,7 +31,7 @@ abstract class WC_Correios_Shipping_Impresso extends WC_Correios_Shipping_Carta
31
  /**
32
  * Reasonable Registry cost.
33
  *
34
- * Cost based in 25/08/2016 from:
35
  * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-adicionais-nacionais
36
  *
37
  * @var float
@@ -41,8 +41,8 @@ abstract class WC_Correios_Shipping_Impresso extends WC_Correios_Shipping_Carta
41
  /**
42
  * Receipt Notice cost.
43
  *
44
- * Cost based in 25/08/2016 from:
45
- * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-adicionais-nacionais
46
  *
47
  * @var float
48
  */
@@ -51,8 +51,8 @@ abstract class WC_Correios_Shipping_Impresso extends WC_Correios_Shipping_Carta
51
  /**
52
  * Own Hands cost.
53
  *
54
- * Cost based in 25/08/2016 from:
55
- * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-adicionais-nacionais
56
  *
57
  * @var float
58
  */
@@ -61,8 +61,8 @@ abstract class WC_Correios_Shipping_Impresso extends WC_Correios_Shipping_Carta
61
  /**
62
  * Weight limit for reasonable registry.
63
  *
64
- * Value based in 25/08/2016 from:
65
- * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
66
  *
67
  * @var float
68
  */
21
  /**
22
  * National Registry cost.
23
  *
24
+ * Cost based in 01/10/2016 from:
25
  * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-adicionais-nacionais
26
  *
27
  * @var float
31
  /**
32
  * Reasonable Registry cost.
33
  *
34
+ * Cost based in 01/10/2016 from:
35
  * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-adicionais-nacionais
36
  *
37
  * @var float
41
  /**
42
  * Receipt Notice cost.
43
  *
44
+ * Cost based in 01/10/2016 from:
45
+ * https://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-adicionais-nacionais
46
  *
47
  * @var float
48
  */
51
  /**
52
  * Own Hands cost.
53
  *
54
+ * Cost based in 01/10/2016 from:
55
+ * https://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-adicionais-nacionais
56
  *
57
  * @var float
58
  */
61
  /**
62
  * Weight limit for reasonable registry.
63
  *
64
+ * Value based in 01/02/2017 from:
65
+ * https://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
66
  *
67
  * @var float
68
  */
includes/abstracts/abstract-wc-correios-shipping-international.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WooCommerce_Correios/Abstracts
6
  * @since 3.0.0
7
- * @version 3.0.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
@@ -39,6 +39,7 @@ abstract class WC_Correios_Shipping_International extends WC_Correios_Shipping {
39
  $this->title = $this->get_option( 'title' );
40
  $this->origin_state = $this->get_option( 'origin_state' );
41
  $this->origin_location = $this->get_option( 'origin_location' );
 
42
  $this->show_delivery_time = $this->get_option( 'show_delivery_time' );
43
  $this->fee = $this->get_option( 'fee' );
44
  $this->debug = $this->get_option( 'debug' );
@@ -91,6 +92,15 @@ abstract class WC_Correios_Shipping_International extends WC_Correios_Shipping {
91
  'I' => __( 'Interior', 'woocommerce-correios' ),
92
  ),
93
  ),
 
 
 
 
 
 
 
 
 
94
  'show_delivery_time' => array(
95
  'title' => __( 'Delivery Time', 'woocommerce-correios' ),
96
  'type' => 'checkbox',
@@ -142,7 +152,7 @@ abstract class WC_Correios_Shipping_International extends WC_Correios_Shipping {
142
  *
143
  * @param array $package Order package.
144
  *
145
- * @return SimpleXMLElement
146
  */
147
  protected function get_rate( $package ) {
148
  $api = new WC_Correios_Webservice_International( $this->id, $this->instance_id );
@@ -171,6 +181,11 @@ abstract class WC_Correios_Shipping_International extends WC_Correios_Shipping {
171
  return;
172
  }
173
 
 
 
 
 
 
174
  $shipping = $this->get_rate( $package );
175
 
176
  if ( empty( $shipping->dados_postais->preco_postal ) ) {
@@ -196,7 +211,7 @@ abstract class WC_Correios_Shipping_International extends WC_Correios_Shipping {
196
  $rate = apply_filters( 'woocommerce_correios_' . $this->id . '_rate', array(
197
  'id' => $this->id . $this->instance_id,
198
  'label' => $label,
199
- 'cost' => $cost + $fee,
200
  ), $this->instance_id, $package );
201
 
202
  // Deprecated filter.
4
  *
5
  * @package WooCommerce_Correios/Abstracts
6
  * @since 3.0.0
7
+ * @version 3.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
39
  $this->title = $this->get_option( 'title' );
40
  $this->origin_state = $this->get_option( 'origin_state' );
41
  $this->origin_location = $this->get_option( 'origin_location' );
42
+ $this->shipping_class_id = (int) $this->get_option( 'shipping_class_id', '-1' );
43
  $this->show_delivery_time = $this->get_option( 'show_delivery_time' );
44
  $this->fee = $this->get_option( 'fee' );
45
  $this->debug = $this->get_option( 'debug' );
92
  'I' => __( 'Interior', 'woocommerce-correios' ),
93
  ),
94
  ),
95
+ 'shipping_class_id' => array(
96
+ 'title' => __( 'Shipping Class', 'woocommerce-correios' ),
97
+ 'type' => 'select',
98
+ 'description' => __( 'If necessary, select a shipping class to apply this method.', 'woocommerce-correios' ),
99
+ 'desc_tip' => true,
100
+ 'default' => '',
101
+ 'class' => 'wc-enhanced-select',
102
+ 'options' => $this->get_shipping_classes_options(),
103
+ ),
104
  'show_delivery_time' => array(
105
  'title' => __( 'Delivery Time', 'woocommerce-correios' ),
106
  'type' => 'checkbox',
152
  *
153
  * @param array $package Order package.
154
  *
155
+ * @return SimpleXMLElement|null
156
  */
157
  protected function get_rate( $package ) {
158
  $api = new WC_Correios_Webservice_International( $this->id, $this->instance_id );
181
  return;
182
  }
183
 
184
+ // Check for shipping classes.
185
+ if ( ! $this->has_only_selected_shipping_class( $package ) ) {
186
+ return;
187
+ }
188
+
189
  $shipping = $this->get_rate( $package );
190
 
191
  if ( empty( $shipping->dados_postais->preco_postal ) ) {
211
  $rate = apply_filters( 'woocommerce_correios_' . $this->id . '_rate', array(
212
  'id' => $this->id . $this->instance_id,
213
  'label' => $label,
214
+ 'cost' => (float) $cost + (float) $fee,
215
  ), $this->instance_id, $package );
216
 
217
  // Deprecated filter.
includes/abstracts/abstract-wc-correios-shipping.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WooCommerce_Correios/Abstracts
6
  * @since 3.0.0
7
- * @version 3.0.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
@@ -52,6 +52,7 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
52
  $this->enabled = $this->get_option( 'enabled' );
53
  $this->title = $this->get_option( 'title' );
54
  $this->origin_postcode = $this->get_option( 'origin_postcode' );
 
55
  $this->show_delivery_time = $this->get_option( 'show_delivery_time' );
56
  $this->additional_time = $this->get_option( 'additional_time' );
57
  $this->fee = $this->get_option( 'fee' );
@@ -77,9 +78,26 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
77
  * @return string
78
  */
79
  protected function get_log_link() {
80
- if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.2', '>=' ) ) {
81
- return ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-status&tab=logs&log_file=' . esc_attr( $this->id ) . '-' . sanitize_file_name( wp_hash( $this->id ) ) . '.log' ) ) . '">' . __( 'View logs.', 'woocommerce-correios' ) . '</a>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  }
 
 
83
  }
84
 
85
  /**
@@ -113,6 +131,15 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
113
  'placeholder' => '00000-000',
114
  'default' => '',
115
  ),
 
 
 
 
 
 
 
 
 
116
  'show_delivery_time' => array(
117
  'title' => __( 'Delivery Time', 'woocommerce-correios' ),
118
  'type' => 'checkbox',
@@ -315,7 +342,7 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
315
  *
316
  * @param array $package Cart package.
317
  *
318
- * @return SimpleXMLElement
319
  */
320
  protected function get_rate( $package ) {
321
  $api = new WC_Correios_Webservice( $this->id, $this->instance_id );
@@ -383,6 +410,34 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
383
  return $this->title;
384
  }
385
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  /**
387
  * Calculates the shipping rate.
388
  *
@@ -394,6 +449,11 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
394
  return;
395
  }
396
 
 
 
 
 
 
397
  $shipping = $this->get_rate( $package );
398
 
399
  if ( ! isset( $shipping->Erro ) ) {
@@ -431,7 +491,7 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
431
  $rate = apply_filters( 'woocommerce_correios_' . $this->id . '_rate', array(
432
  'id' => $this->id . $this->instance_id,
433
  'label' => $label,
434
- 'cost' => $cost + $fee,
435
  ), $this->instance_id, $package );
436
 
437
  // Deprecated filter.
4
  *
5
  * @package WooCommerce_Correios/Abstracts
6
  * @since 3.0.0
7
+ * @version 3.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
52
  $this->enabled = $this->get_option( 'enabled' );
53
  $this->title = $this->get_option( 'title' );
54
  $this->origin_postcode = $this->get_option( 'origin_postcode' );
55
+ $this->shipping_class_id = (int) $this->get_option( 'shipping_class_id', '-1' );
56
  $this->show_delivery_time = $this->get_option( 'show_delivery_time' );
57
  $this->additional_time = $this->get_option( 'additional_time' );
58
  $this->fee = $this->get_option( 'fee' );
78
  * @return string
79
  */
80
  protected function get_log_link() {
81
+ return ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-status&tab=logs&log_file=' . esc_attr( $this->id ) . '-' . sanitize_file_name( wp_hash( $this->id ) ) . '.log' ) ) . '">' . __( 'View logs.', 'woocommerce-correios' ) . '</a>';
82
+ }
83
+
84
+ /**
85
+ * Get shipping classes options.
86
+ *
87
+ * @return array
88
+ */
89
+ protected function get_shipping_classes_options() {
90
+ $shipping_classes = WC()->shipping->get_shipping_classes();
91
+ $options = array(
92
+ '-1' => __( 'Any Shipping Class', 'woocommerce-correios' ),
93
+ '0' => __( 'No Shipping Class', 'woocommerce-correios' ),
94
+ );
95
+
96
+ if ( ! empty( $shipping_classes ) ) {
97
+ $options += wp_list_pluck( $shipping_classes, 'name', 'term_id' );
98
  }
99
+
100
+ return $options;
101
  }
102
 
103
  /**
131
  'placeholder' => '00000-000',
132
  'default' => '',
133
  ),
134
+ 'shipping_class_id' => array(
135
+ 'title' => __( 'Shipping Class', 'woocommerce-correios' ),
136
+ 'type' => 'select',
137
+ 'description' => __( 'If necessary, select a shipping class to apply this method.', 'woocommerce-correios' ),
138
+ 'desc_tip' => true,
139
+ 'default' => '',
140
+ 'class' => 'wc-enhanced-select',
141
+ 'options' => $this->get_shipping_classes_options(),
142
+ ),
143
  'show_delivery_time' => array(
144
  'title' => __( 'Delivery Time', 'woocommerce-correios' ),
145
  'type' => 'checkbox',
342
  *
343
  * @param array $package Cart package.
344
  *
345
+ * @return SimpleXMLElement|null
346
  */
347
  protected function get_rate( $package ) {
348
  $api = new WC_Correios_Webservice( $this->id, $this->instance_id );
410
  return $this->title;
411
  }
412
 
413
+ /**
414
+ * Check if package uses only the selected shipping class.
415
+ *
416
+ * @param array $package Cart package.
417
+ * @return bool
418
+ */
419
+ protected function has_only_selected_shipping_class( $package ) {
420
+ $only_selected = true;
421
+
422
+ if ( -1 === $this->shipping_class_id ) {
423
+ return $only_selected;
424
+ }
425
+
426
+ foreach ( $package['contents'] as $item_id => $values ) {
427
+ $product = $values['data'];
428
+ $qty = $values['quantity'];
429
+
430
+ if ( $qty > 0 && $product->needs_shipping() ) {
431
+ if ( $this->shipping_class_id !== $product->get_shipping_class_id() ) {
432
+ $only_selected = false;
433
+ break;
434
+ }
435
+ }
436
+ }
437
+
438
+ return $only_selected;
439
+ }
440
+
441
  /**
442
  * Calculates the shipping rate.
443
  *
449
  return;
450
  }
451
 
452
+ // Check for shipping classes.
453
+ if ( ! $this->has_only_selected_shipping_class( $package ) ) {
454
+ return;
455
+ }
456
+
457
  $shipping = $this->get_rate( $package );
458
 
459
  if ( ! isset( $shipping->Erro ) ) {
491
  $rate = apply_filters( 'woocommerce_correios_' . $this->id . '_rate', array(
492
  'id' => $this->id . $this->instance_id,
493
  'label' => $label,
494
+ 'cost' => (float) $cost + (float) $fee,
495
  ), $this->instance_id, $package );
496
 
497
  // Deprecated filter.
includes/admin/class-wc-correios-admin-orders.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WooCommerce_Correios/Admin/Orders
6
  * @since 3.0.0
7
- * @version 3.0.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
@@ -21,8 +21,9 @@ class WC_Correios_Admin_Orders {
21
  */
22
  public function __construct() {
23
  add_action( 'add_meta_boxes', array( $this, 'register_metabox' ) );
24
- add_action( 'woocommerce_process_shop_order_meta', array( $this, 'save_tracking_code' ) );
25
  add_filter( 'woocommerce_resend_order_emails_available', array( $this, 'resend_tracking_code_email' ) );
 
 
26
  }
27
 
28
  /**
@@ -45,23 +46,27 @@ class WC_Correios_Admin_Orders {
45
  * @param WC_Post $post Post data.
46
  */
47
  public function metabox_content( $post ) {
48
- echo '<label for="correios_tracking">' . esc_html__( 'Tracking code:', 'woocommerce-correios' ) . '</label><br />';
49
- echo '<input type="text" id="correios_tracking" name="correios_tracking" value="' . esc_attr( get_post_meta( $post->ID, '_correios_tracking_code', true ) ) . '" style="width: 100%;" />';
50
- }
51
 
52
- /**
53
- * Save tracking code.
54
- *
55
- * @param int $post_id Current post type ID.
56
- */
57
- public function save_tracking_code( $post_id ) {
58
- if ( empty( $_POST['woocommerce_meta_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['woocommerce_meta_nonce'] ) ), 'woocommerce_save_data' ) ) {
59
- return;
60
- }
61
-
62
- if ( isset( $_POST['correios_tracking'] ) ) {
63
- wc_correios_update_tracking_code( $post_id, wp_unslash( $_POST['correios_tracking'] ) );
64
- }
 
 
 
 
 
 
65
  }
66
 
67
  /**
@@ -76,6 +81,42 @@ class WC_Correios_Admin_Orders {
76
 
77
  return $emails;
78
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
 
81
  new WC_Correios_Admin_Orders();
4
  *
5
  * @package WooCommerce_Correios/Admin/Orders
6
  * @since 3.0.0
7
+ * @version 3.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
21
  */
22
  public function __construct() {
23
  add_action( 'add_meta_boxes', array( $this, 'register_metabox' ) );
 
24
  add_filter( 'woocommerce_resend_order_emails_available', array( $this, 'resend_tracking_code_email' ) );
25
+ add_action( 'wp_ajax_woocommerce_correios_add_tracking_code', array( $this, 'ajax_add_tracking_code' ) );
26
+ add_action( 'wp_ajax_woocommerce_correios_remove_tracking_code', array( $this, 'ajax_remove_tracking_code' ) );
27
  }
28
 
29
  /**
46
  * @param WC_Post $post Post data.
47
  */
48
  public function metabox_content( $post ) {
49
+ $tracking_codes = wc_correios_get_tracking_codes( $post->ID );
 
 
50
 
51
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
52
+ wp_enqueue_style( 'woocommerce-correios-orders-admin', plugins_url( 'assets/css/admin/orders' . $suffix . '.css', WC_Correios::get_main_file() ), array(), WC_Correios::VERSION );
53
+ wp_enqueue_script( 'woocommerce-correios-orders-admin', plugins_url( 'assets/js/admin/orders' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery', 'jquery-blockui', 'wp-util' ), WC_Correios::VERSION, true );
54
+ wp_localize_script(
55
+ 'woocommerce-correios-orders-admin',
56
+ 'WCCorreiosAdminOrdersParams',
57
+ array(
58
+ 'order_id' => $post->ID,
59
+ 'i18n' => array(
60
+ 'removeQuestion' => esc_js( __( 'Are you sure you want to remove this tracking code?', 'woocommerce-correios' ) ),
61
+ ),
62
+ 'nonces' => array(
63
+ 'add' => wp_create_nonce( 'woocommerce-correios-add-tracking-code' ),
64
+ 'remove' => wp_create_nonce( 'woocommerce-correios-remove-tracking-code' ),
65
+ ),
66
+ )
67
+ );
68
+
69
+ include_once dirname( __FILE__ ) . '/views/html-meta-box-tracking-code.php';
70
  }
71
 
72
  /**
81
 
82
  return $emails;
83
  }
84
+
85
+ /**
86
+ * Ajax - Add tracking code.
87
+ */
88
+ public function ajax_add_tracking_code() {
89
+ check_ajax_referer( 'woocommerce-correios-add-tracking-code', 'security' );
90
+
91
+ $args = filter_input_array( INPUT_POST, [
92
+ 'order_id' => FILTER_SANITIZE_NUMBER_INT,
93
+ 'tracking_code' => FILTER_SANITIZE_STRING,
94
+ ] );
95
+
96
+ $order = wc_get_order( $args['order_id'] );
97
+
98
+ wc_correios_update_tracking_code( $order, $args['tracking_code'] );
99
+
100
+ $tracking_codes = wc_correios_get_tracking_codes( $order );
101
+
102
+ wp_send_json_success( $tracking_codes );
103
+ }
104
+
105
+ /**
106
+ * Ajax - Remove tracking code.
107
+ */
108
+ public function ajax_remove_tracking_code() {
109
+ check_ajax_referer( 'woocommerce-correios-remove-tracking-code', 'security' );
110
+
111
+ $args = filter_input_array( INPUT_POST, [
112
+ 'order_id' => FILTER_SANITIZE_NUMBER_INT,
113
+ 'tracking_code' => FILTER_SANITIZE_STRING,
114
+ ] );
115
+
116
+ wc_correios_update_tracking_code( $args['order_id'], $args['tracking_code'], true );
117
+
118
+ wp_send_json_success();
119
+ }
120
  }
121
 
122
  new WC_Correios_Admin_Orders();
includes/admin/views/html-meta-box-tracking-code.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Meta box - Tracking Code
4
+ *
5
+ * @package WooCommerce_Correios/Admin/Settings
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+ ?>
12
+
13
+ <div class="correios-tracking-code">
14
+ <?php if ( ! empty( $tracking_codes ) ) : ?>
15
+ <div class="correios-tracking-code__list">
16
+ <strong><?php echo esc_html( _n( 'Tracking code', 'Tracking codes:', count( $tracking_codes ), 'woocommerce-correios' ) ); ?></strong>
17
+ <ul>
18
+ <?php foreach ( $tracking_codes as $tracking_code ) : ?>
19
+ <li><a href="<?php echo esc_url( 'http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=' . $tracking_code ) ?>" title="<?php esc_attr_e( 'View tracking code', 'woocommerce-correios' ); ?>" aria-label="<?php esc_attr_e( 'Tracking code', 'woocommerce-correios' ) ?>" target="_blank"><?php echo esc_html( $tracking_code ); ?></a> <a href="#" class="dashicons-dismiss" title="<?php esc_attr_e( 'Remove tracking code', 'woocommerce-correios' ) ?>" aria-label="<?php esc_attr_e( 'Remove tracking code', 'woocommerce-correios' ) ?>" data-code="<?php echo esc_attr( $tracking_code ); ?>"></a></li>
20
+ <?php endforeach; ?>
21
+ </ul>
22
+ </div>
23
+ <?php endif; ?>
24
+
25
+ <fieldset>
26
+ <label for="add-tracking-code"><?php esc_html_e( 'Add tracking code', 'woocommerce-correios' ); ?></label>
27
+ <input type="text" id="add-tracking-code" name="correios_tracking" value="" />
28
+ <button type="button" class="button-secondary dashicons-plus" aria-label="<?php esc_attr_e( 'Add new tracking code', 'woocommerce-correios' ); ?>"></button>
29
+ </fieldset>
30
+ </div>
31
+
32
+ <script type="text/html" id="tmpl-tracking-code-list">
33
+ <div class="correios-tracking-code__list">
34
+ <# if ( 1 < data.trackingCodes.length ) { #>
35
+ <strong><?php esc_html_e( 'Tracking codes:', 'woocommerce-correios' ); ?></strong>
36
+ <# } else { #>
37
+ <strong><?php esc_html_e( 'Tracking code:', 'woocommerce-correios' ); ?></strong>
38
+ <# } #>
39
+ <ul>
40
+ <# _.each( data.trackingCodes, function( trackingCode ) { #>
41
+ <li><a href="http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI={{trackingCode}}" title="<?php esc_attr_e( 'View tracking code', 'woocommerce-correios' ); ?>" aria-label="<?php esc_attr_e( 'Tracking code', 'woocommerce-correios' ) ?>" target="_blank">{{trackingCode}}</a> <a href="#" class="dashicons-dismiss" title="<?php esc_attr_e( 'Remove tracking code', 'woocommerce-correios' ) ?>" aria-label="<?php esc_attr_e( 'Remove tracking code', 'woocommerce-correios' ) ?>" data-code="{{trackingCode}}"></a></li>
42
+ <# }); #>
43
+ </ul>
44
+ </div>
45
+ </script>
includes/class-wc-correios-install.php CHANGED
@@ -48,7 +48,7 @@ class WC_Correios_Install {
48
  /**
49
  * Upgrade to 3.0.0 while using WooCommerce 2.6.0.
50
  */
51
- public static function upgrade_300_to_wc_260() {
52
  if ( $old_options = get_option( 'woocommerce_correios_settings' ) ) {
53
  if ( isset( $old_options['tracking_history'] ) ) {
54
  $integration_options = get_option( 'woocommerce_correios-integration_settings', array(
48
  /**
49
  * Upgrade to 3.0.0 while using WooCommerce 2.6.0.
50
  */
51
+ public static function upgrade_300_from_wc_260() {
52
  if ( $old_options = get_option( 'woocommerce_correios_settings' ) ) {
53
  if ( isset( $old_options['tracking_history'] ) ) {
54
  $integration_options = get_option( 'woocommerce_correios-integration_settings', array(
includes/class-wc-correios-package.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WooCommerce_Correios/Classes
6
  * @since 3.0.0
7
- * @version 3.0.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
@@ -34,19 +34,6 @@ class WC_Correios_Package {
34
  $this->package = $package;
35
  }
36
 
37
- /**
38
- * Replace comma by dot.
39
- *
40
- * @param mixed $value Value to fix.
41
- *
42
- * @return mixed
43
- */
44
- private function fix_format( $value ) {
45
- $value = str_replace( ',', '.', $value );
46
-
47
- return $value;
48
- }
49
-
50
  /**
51
  * Extracts the weight and dimensions from the package.
52
  *
@@ -66,10 +53,10 @@ class WC_Correios_Package {
66
 
67
  if ( $qty > 0 && $product->needs_shipping() ) {
68
 
69
- $_height = wc_get_dimension( $this->fix_format( $product->height ), 'cm' );
70
- $_width = wc_get_dimension( $this->fix_format( $product->width ), 'cm' );
71
- $_length = wc_get_dimension( $this->fix_format( $product->length ), 'cm' );
72
- $_weight = wc_get_weight( $this->fix_format( $product->weight ), 'kg' );
73
 
74
  $height[ $count ] = $_height;
75
  $width[ $count ] = $_width;
@@ -160,7 +147,7 @@ class WC_Correios_Package {
160
  $root = 0;
161
  $biggest = max( $max_values );
162
 
163
- if ( 0 !== $cubage_total && 0 !== $biggest ) {
164
  // Dividing the value of scaling of all products.
165
  // With the measured value of greater.
166
  $division = $cubage_total / $biggest;
4
  *
5
  * @package WooCommerce_Correios/Classes
6
  * @since 3.0.0
7
+ * @version 3.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
34
  $this->package = $package;
35
  }
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  /**
38
  * Extracts the weight and dimensions from the package.
39
  *
53
 
54
  if ( $qty > 0 && $product->needs_shipping() ) {
55
 
56
+ $_height = wc_get_dimension( (float) $product->get_length(), 'cm' );
57
+ $_width = wc_get_dimension( (float) $product->get_width(), 'cm' );
58
+ $_length = wc_get_dimension( (float) $product->get_height(), 'cm' );
59
+ $_weight = wc_get_weight( (float) $product->get_weight(), 'kg' );
60
 
61
  $height[ $count ] = $_height;
62
  $width[ $count ] = $_width;
147
  $root = 0;
148
  $biggest = max( $max_values );
149
 
150
+ if ( 0 !== $cubage_total && 0 < $biggest ) {
151
  // Dividing the value of scaling of all products.
152
  // With the measured value of greater.
153
  $division = $cubage_total / $biggest;
includes/class-wc-correios-rest-api.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WooCommerce_Correios/Classes
6
  * @since 3.0.0
7
- * @version 3.0.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
@@ -36,7 +36,7 @@ class WC_Correios_REST_API {
36
  * @return array
37
  */
38
  public function legacy_orders_response( $data, $order, $fields ) {
39
- $data['correios_tracking_code'] = $order->correios_tracking_code;
40
 
41
  if ( $fields ) {
42
  $data = WC()->api->WC_API_Customers->filter_response_fields( $data, $order, $fields );
@@ -89,7 +89,7 @@ class WC_Correios_REST_API {
89
  * @return string
90
  */
91
  function get_tracking_code_callback( $data, $field, $request ) {
92
- return get_post_meta( $data['id'], '_' . $field, true );
93
  }
94
 
95
  /**
4
  *
5
  * @package WooCommerce_Correios/Classes
6
  * @since 3.0.0
7
+ * @version 3.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
36
  * @return array
37
  */
38
  public function legacy_orders_response( $data, $order, $fields ) {
39
+ $data['correios_tracking_code'] = implode( ',', wc_correios_get_tracking_codes( $order ) );
40
 
41
  if ( $fields ) {
42
  $data = WC()->api->WC_API_Customers->filter_response_fields( $data, $order, $fields );
89
  * @return string
90
  */
91
  function get_tracking_code_callback( $data, $field, $request ) {
92
+ return implode( ',', wc_correios_get_tracking_codes( $data['id'] ) );
93
  }
94
 
95
  /**
includes/class-wc-correios-tracking-history.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WooCommerce_Correios/Classes/Tracking
6
  * @since 3.0.0
7
- * @version 3.0.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
@@ -65,16 +65,16 @@ class WC_Correios_Tracking_History {
65
  /**
66
  * Access API Correios.
67
  *
68
- * @param string $tracking_code Tracking code.
69
  *
70
  * @return array
71
  */
72
- protected function get_tracking_history( $tracking_code ) {
73
  include_once dirname( __FILE__ ) . '/class-wc-correios-soap-client.php';
74
 
75
- $this->logger( sprintf( 'Fetching tracking history for "%s" on Correios Webservices...', $tracking_code ) );
76
 
77
- $events = null;
78
  $user_data = $this->get_user_data();
79
  $args = apply_filters( 'woocommerce_correios_tracking_history_webservice_args', array(
80
  'usuario' => $user_data['login'],
@@ -82,30 +82,48 @@ class WC_Correios_Tracking_History {
82
  'tipo' => 'L', // L - List of objects, F - Object Range.
83
  'resultado' => 'T', // T - Returns all the object's events, U - Returns only last event object.
84
  'lingua' => '101',
85
- 'objetos' => $tracking_code,
86
  ) );
87
 
88
  try {
89
  $soap = new WC_Correios_Soap_Client( $this->get_tracking_history_webservice_url() );
90
  $response = $soap->buscaEventos( $args );
91
 
92
- if ( isset( $response->return->objeto->evento ) ) {
93
- $events = (array) $response->return->objeto->evento;
94
-
95
- if ( isset( $events['tipo'] ) ) {
96
- $events = array( (object) $events );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  }
98
-
99
  }
100
  } catch ( Exception $e ) {
101
- $this->logger( sprintf( 'An error occurred while trying to fetch the tracking history for "%s": %s', $tracking_code, $e->getMessage() ) );
102
  }
103
 
104
- if ( ! is_null( $events ) ) {
105
- $this->logger( sprintf( 'Tracking history for "%s" found successfully: %s', $tracking_code, print_r( $events, true ) ) );
106
  }
107
 
108
- return apply_filters( 'woocommerce_correios_tracking_response', $events, $tracking_code );
109
  }
110
 
111
  /**
@@ -114,35 +132,45 @@ class WC_Correios_Tracking_History {
114
  * @param WC_Order $order Order data.
115
  */
116
  public function view( $order ) {
117
- $events = false;
118
- $tracking_code = get_post_meta( $order->id, '_correios_tracking_code', true );
 
119
 
120
  // Check if exist a tracking code for the order.
121
- if ( ! $tracking_code ) {
122
  return;
123
  }
124
 
125
  // Try to connect to Correios Webservices and get the tracking history.
126
  if ( apply_filters( 'woocommerce_correios_enable_tracking_history', false ) ) {
127
- $events = $this->get_tracking_history( $tracking_code );
128
  }
129
 
 
 
 
 
 
 
 
130
  // Display the right template for show the tracking code or tracking history.
131
- if ( is_array( $events ) ) {
132
- wc_get_template(
133
- 'myaccount/tracking-history-table.php',
134
- array(
135
- 'events' => $events,
136
- 'code' => $tracking_code,
137
- ),
138
- '',
139
- WC_Correios::get_templates_path()
140
- );
 
 
141
  } else {
142
  wc_get_template(
143
- 'myaccount/tracking-code.php',
144
  array(
145
- 'code' => $tracking_code,
146
  ),
147
  '',
148
  WC_Correios::get_templates_path()
4
  *
5
  * @package WooCommerce_Correios/Classes/Tracking
6
  * @since 3.0.0
7
+ * @version 3.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
65
  /**
66
  * Access API Correios.
67
  *
68
+ * @param array $tracking_code Tracking code.
69
  *
70
  * @return array
71
  */
72
+ protected function get_tracking_history( $tracking_codes ) {
73
  include_once dirname( __FILE__ ) . '/class-wc-correios-soap-client.php';
74
 
75
+ $this->logger( sprintf( 'Fetching tracking history for "%s" on Correios Webservices...', implode( ', ', $tracking_codes ) ) );
76
 
77
+ $objects = null;
78
  $user_data = $this->get_user_data();
79
  $args = apply_filters( 'woocommerce_correios_tracking_history_webservice_args', array(
80
  'usuario' => $user_data['login'],
82
  'tipo' => 'L', // L - List of objects, F - Object Range.
83
  'resultado' => 'T', // T - Returns all the object's events, U - Returns only last event object.
84
  'lingua' => '101',
85
+ 'objetos' => implode( '', $tracking_codes ),
86
  ) );
87
 
88
  try {
89
  $soap = new WC_Correios_Soap_Client( $this->get_tracking_history_webservice_url() );
90
  $response = $soap->buscaEventos( $args );
91
 
92
+ // Handle Correios multiple formats response.
93
+ if ( ! empty( $response->return->objeto ) ) {
94
+ // Handle multiple objects.
95
+ if ( is_array( $response->return->objeto ) ) {
96
+ $objects = (array) $response->return->objeto;
97
+
98
+ // Fix when return only last event for each object.
99
+ if ( is_object( $objects[0]->evento ) ) {
100
+ $new_objects = array();
101
+ foreach ( $objects as $key => $object ) {
102
+ $new_objects[ $key ] = $object;
103
+ $new_objects[ $key ]->evento = array( $new_objects[ $key ]->evento );
104
+ }
105
+ $objects = $new_objects;
106
+ }
107
+
108
+ // Handle single object.
109
+ } elseif ( is_object( $response->return->objeto ) ) {
110
+ $objects = array( $response->return->objeto );
111
+
112
+ // Fix when return only last event.
113
+ if ( is_object( $objects[0]->evento ) ) {
114
+ $objects[0]->evento = array( $objects[0]->evento );
115
+ }
116
  }
 
117
  }
118
  } catch ( Exception $e ) {
119
+ $this->logger( sprintf( 'An error occurred while trying to fetch the tracking history for "%s": %s', implode( ', ', $tracking_codes ), $e->getMessage() ) );
120
  }
121
 
122
+ if ( ! is_null( $objects ) ) {
123
+ $this->logger( sprintf( 'Tracking history found successfully: %s', print_r( $objects, true ) ) );
124
  }
125
 
126
+ return apply_filters( 'woocommerce_correios_tracking_objects', $objects, $tracking_codes );
127
  }
128
 
129
  /**
132
  * @param WC_Order $order Order data.
133
  */
134
  public function view( $order ) {
135
+ $objects = array();
136
+
137
+ $tracking_codes = wc_correios_get_tracking_codes( $order );
138
 
139
  // Check if exist a tracking code for the order.
140
+ if ( empty( $tracking_codes ) ) {
141
  return;
142
  }
143
 
144
  // Try to connect to Correios Webservices and get the tracking history.
145
  if ( apply_filters( 'woocommerce_correios_enable_tracking_history', false ) ) {
146
+ $objects = $this->get_tracking_history( $tracking_codes );
147
  }
148
 
149
+ wc_get_template(
150
+ 'myaccount/tracking-title.php',
151
+ array(),
152
+ '',
153
+ WC_Correios::get_templates_path()
154
+ );
155
+
156
  // Display the right template for show the tracking code or tracking history.
157
+ if ( ! empty( $objects ) ) {
158
+ foreach ( $objects as $object ) {
159
+ wc_get_template(
160
+ 'myaccount/tracking-history-table.php',
161
+ array(
162
+ 'events' => (array) $object->evento,
163
+ 'code' => (string) $object->numero,
164
+ ),
165
+ '',
166
+ WC_Correios::get_templates_path()
167
+ );
168
+ }
169
  } else {
170
  wc_get_template(
171
+ 'myaccount/tracking-codes.php',
172
  array(
173
+ 'codes' => $tracking_codes,
174
  ),
175
  '',
176
  WC_Correios::get_templates_path()
includes/class-wc-correios-webservice.php CHANGED
@@ -43,7 +43,7 @@ class WC_Correios_Webservice {
43
  * @var string|array
44
  */
45
  protected $service = '';
46
-
47
  /**
48
  * WooCommerce package containing the products.
49
  *
43
  * @var string|array
44
  */
45
  protected $service = '';
46
+
47
  /**
48
  * WooCommerce package containing the products.
49
  *
includes/emails/class-wc-correios-tracking-email.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WooCommerce_Correios/Classes/Emails
6
  * @since 3.0.0
7
- * @version 3.0.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
@@ -28,7 +28,7 @@ class WC_Correios_Tracking_Email extends WC_Email {
28
  $this->subject = __( '[{site_title}] Your order {order_number} has been sent by Correios', 'woocommerce-correios' );
29
  $this->message = __( 'Hi there. Your recent order on {site_title} has been sent by Correios.', 'woocommerce-correios' )
30
  . PHP_EOL . ' ' . PHP_EOL
31
- . __( 'To track your delivery, use the following the tracking code: {tracking_code}.', 'woocommerce-correios' )
32
  . PHP_EOL . ' ' . PHP_EOL
33
  . __( 'The delivery service is the responsibility of the Correios, but if you have any questions, please contact us.', 'woocommerce-correios' );
34
  $this->tracking_message = $this->get_option( 'tracking_message', $this->message );
@@ -134,6 +134,25 @@ class WC_Correios_Tracking_Email extends WC_Email {
134
  return apply_filters( 'woocommerce_correios_email_tracking_core_url', $url, $tracking_code, $this->object );
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  /**
138
  * Trigger email.
139
  *
@@ -147,21 +166,28 @@ class WC_Correios_Tracking_Email extends WC_Email {
147
  }
148
 
149
  if ( is_object( $order ) ) {
150
- $this->object = $order;
151
- $this->recipient = $this->object->billing_email;
 
 
 
 
 
152
 
153
  $this->find[] = '{order_number}';
154
- $this->replace[] = $this->object->get_order_number();
155
 
156
  $this->find[] = '{date}';
157
  $this->replace[] = date_i18n( wc_date_format(), time() );
158
 
159
  if ( empty( $tracking_code ) ) {
160
- $tracking_code = get_post_meta( $this->object->id, '_correios_tracking_code', true );
 
 
161
  }
162
 
163
  $this->find[] = '{tracking_code}';
164
- $this->replace[] = $this->get_tracking_code_url( $tracking_code );
165
  }
166
 
167
  if ( ! $this->get_recipient() ) {
@@ -185,6 +211,7 @@ class WC_Correios_Tracking_Email extends WC_Email {
185
  'tracking_message' => $this->get_tracking_message(),
186
  'sent_to_admin' => false,
187
  'plain_text' => false,
 
188
  ), '', $this->template_base );
189
 
190
  return ob_get_clean();
@@ -198,12 +225,19 @@ class WC_Correios_Tracking_Email extends WC_Email {
198
  public function get_content_plain() {
199
  ob_start();
200
 
 
 
 
 
 
 
201
  wc_get_template( $this->template_plain, array(
202
  'order' => $this->object,
203
  'email_heading' => $this->get_heading(),
204
- 'tracking_message' => $this->get_tracking_message(),
205
  'sent_to_admin' => false,
206
  'plain_text' => true,
 
207
  ), '', $this->template_base );
208
 
209
  return ob_get_clean();
4
  *
5
  * @package WooCommerce_Correios/Classes/Emails
6
  * @since 3.0.0
7
+ * @version 3.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
28
  $this->subject = __( '[{site_title}] Your order {order_number} has been sent by Correios', 'woocommerce-correios' );
29
  $this->message = __( 'Hi there. Your recent order on {site_title} has been sent by Correios.', 'woocommerce-correios' )
30
  . PHP_EOL . ' ' . PHP_EOL
31
+ . __( 'To track your delivery, use the following the tracking code(s): {tracking_code}', 'woocommerce-correios' )
32
  . PHP_EOL . ' ' . PHP_EOL
33
  . __( 'The delivery service is the responsibility of the Correios, but if you have any questions, please contact us.', 'woocommerce-correios' );
34
  $this->tracking_message = $this->get_option( 'tracking_message', $this->message );
134
  return apply_filters( 'woocommerce_correios_email_tracking_core_url', $url, $tracking_code, $this->object );
135
  }
136
 
137
+ /**
138
+ * Get tracking codes HTML.
139
+ *
140
+ * @param array $tracking_codes Tracking codes.
141
+ *
142
+ * @return string
143
+ */
144
+ public function get_tracking_codes( $tracking_codes ) {
145
+ $html = '<ul>';
146
+
147
+ foreach ( $tracking_codes as $tracking_code ) {
148
+ $html .= '<li>' . $this->get_tracking_code_url( $tracking_code ) . '</li>';
149
+ }
150
+
151
+ $html .= '</ul>';
152
+
153
+ return $html;
154
+ }
155
+
156
  /**
157
  * Trigger email.
158
  *
166
  }
167
 
168
  if ( is_object( $order ) ) {
169
+ $this->object = $order;
170
+
171
+ if ( method_exists( $order, 'get_billing_email' ) ) {
172
+ $this->recipient = $order->get_billing_email();
173
+ } else {
174
+ $this->recipient = $order->billing_email;
175
+ }
176
 
177
  $this->find[] = '{order_number}';
178
+ $this->replace[] = $order->get_order_number();
179
 
180
  $this->find[] = '{date}';
181
  $this->replace[] = date_i18n( wc_date_format(), time() );
182
 
183
  if ( empty( $tracking_code ) ) {
184
+ $tracking_codes = wc_correios_get_tracking_codes( $order );
185
+ } else {
186
+ $tracking_codes = array( $tracking_code );
187
  }
188
 
189
  $this->find[] = '{tracking_code}';
190
+ $this->replace[] = $this->get_tracking_codes( $tracking_codes );
191
  }
192
 
193
  if ( ! $this->get_recipient() ) {
211
  'tracking_message' => $this->get_tracking_message(),
212
  'sent_to_admin' => false,
213
  'plain_text' => false,
214
+ 'email' => $this,
215
  ), '', $this->template_base );
216
 
217
  return ob_get_clean();
225
  public function get_content_plain() {
226
  ob_start();
227
 
228
+ // Format list.
229
+ $message = $this->get_tracking_message();
230
+ $message = str_replace( '<ul>', "\n", $message );
231
+ $message = str_replace( '<li>', "\n - ", $message );
232
+ $message = str_replace( array( '</ul>', '</li>' ), '', $message );
233
+
234
  wc_get_template( $this->template_plain, array(
235
  'order' => $this->object,
236
  'email_heading' => $this->get_heading(),
237
+ 'tracking_message' => $message,
238
  'sent_to_admin' => false,
239
  'plain_text' => true,
240
+ 'email' => $this,
241
  ), '', $this->template_base );
242
 
243
  return ob_get_clean();
includes/integrations/class-wc-correios-integration.php CHANGED
@@ -59,9 +59,7 @@ class WC_Correios_Integration extends WC_Integration {
59
  * @return string
60
  */
61
  protected function get_tracking_log_link() {
62
- if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.2', '>=' ) ) {
63
- return ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-status&tab=logs&log_file=correios-tracking-history-' . sanitize_file_name( wp_hash( 'correios-tracking-history' ) ) . '.log' ) ) . '">' . __( 'View logs.', 'woocommerce-correios' ) . '</a>';
64
- }
65
  }
66
 
67
  /**
59
  * @return string
60
  */
61
  protected function get_tracking_log_link() {
62
+ return ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-status&tab=logs&log_file=correios-tracking-history-' . sanitize_file_name( wp_hash( 'correios-tracking-history' ) ) . '.log' ) ) . '">' . __( 'View logs.', 'woocommerce-correios' ) . '</a>';
 
 
63
  }
64
 
65
  /**
includes/shipping/class-wc-correios-shipping-impresso-normal.php CHANGED
@@ -19,18 +19,18 @@ class WC_Correios_Shipping_Impresso_Normal extends WC_Correios_Shipping_Impresso
19
  /**
20
  * Additional cost per kg or fraction.
21
  *
22
- * Cost based in 25/08/2016 from:
23
- * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
24
  *
25
  * @var float
26
  */
27
- protected $additional_cost_per_kg = 3.70;
28
 
29
  /**
30
  * Weight limit for this shipping method.
31
  *
32
- * Value based in 25/08/2016 from:
33
- * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
34
  *
35
  * @var float
36
  */
@@ -51,34 +51,34 @@ class WC_Correios_Shipping_Impresso_Normal extends WC_Correios_Shipping_Impresso
51
 
52
  /**
53
  * Get costs.
54
- * Costs based in 25/08/2016 from:
55
- * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
56
  *
57
  * @return array
58
  */
59
  protected function get_costs() {
60
  return apply_filters( 'woocommerce_correios_impresso_normal_costs', array(
61
- '20' => 0.95,
62
- '50' => 1.45,
63
- '100' => 1.95,
64
- '150' => 2.35,
65
- '200' => 2.75,
66
- '250' => 3.20,
67
- '300' => 3.65,
68
- '350' => 4.05,
69
- '400' => 4.50,
70
- '450' => 4.95,
71
- '500' => 5.40,
72
- '550' => 5.75,
73
- '600' => 6.15,
74
- '650' => 6.55,
75
- '700' => 6.90,
76
- '750' => 7.25,
77
- '800' => 7.65,
78
- '850' => 8.05,
79
- '900' => 8.50,
80
- '950' => 8.85,
81
- '1000' => 9.25,
82
  ), $this->id, $this->instance_id );
83
  }
84
 
19
  /**
20
  * Additional cost per kg or fraction.
21
  *
22
+ * Cost based in 01/02/2017 from:
23
+ * https://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
24
  *
25
  * @var float
26
  */
27
+ protected $additional_cost_per_kg = 4.05;
28
 
29
  /**
30
  * Weight limit for this shipping method.
31
  *
32
+ * Value based in 01/02/2017 from:
33
+ * https://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
34
  *
35
  * @var float
36
  */
51
 
52
  /**
53
  * Get costs.
54
+ * Costs based in 01/02/2017 from:
55
+ * https://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
56
  *
57
  * @return array
58
  */
59
  protected function get_costs() {
60
  return apply_filters( 'woocommerce_correios_impresso_normal_costs', array(
61
+ '20' => 1.05,
62
+ '50' => 1.60,
63
+ '100' => 2.10,
64
+ '150' => 2.55,
65
+ '200' => 3.00,
66
+ '250' => 3.50,
67
+ '300' => 3.95,
68
+ '350' => 4.40,
69
+ '400' => 4.90,
70
+ '450' => 5.40,
71
+ '500' => 5.90,
72
+ '550' => 6.25,
73
+ '600' => 6.70,
74
+ '650' => 7.15,
75
+ '700' => 7.50,
76
+ '750' => 7.90,
77
+ '800' => 8.30,
78
+ '850' => 8.75,
79
+ '900' => 9.25,
80
+ '950' => 9.65,
81
+ '1000' => 10.05,
82
  ), $this->id, $this->instance_id );
83
  }
84
 
includes/shipping/class-wc-correios-shipping-impresso-urgente.php CHANGED
@@ -19,8 +19,8 @@ class WC_Correios_Shipping_Impresso_Urgente extends WC_Correios_Shipping_Impress
19
  /**
20
  * Weight limit for this shipping method.
21
  *
22
- * Value based in 25/08/2016 from:
23
- * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
24
  *
25
  * @var float
26
  */
@@ -41,24 +41,24 @@ class WC_Correios_Shipping_Impresso_Urgente extends WC_Correios_Shipping_Impress
41
 
42
  /**
43
  * Get costs.
44
- * Costs based in 25/08/2016 from:
45
- * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
46
  *
47
  * @return array
48
  */
49
  protected function get_costs() {
50
  return apply_filters( 'woocommerce_correios_impresso_urgente_costs', array(
51
- '20' => 1.40,
52
- '50' => 1.95,
53
- '100' => 2.60,
54
- '150' => 3.20,
55
- '200' => 3.75,
56
- '250' => 4.40,
57
- '300' => 4.95,
58
- '350' => 5.55,
59
- '400' => 6.05,
60
- '450' => 6.70,
61
- '500' => 7.25,
62
  ), $this->id, $this->instance_id );
63
  }
64
 
19
  /**
20
  * Weight limit for this shipping method.
21
  *
22
+ * Value based in 01/02/2017 from:
23
+ * https://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
24
  *
25
  * @var float
26
  */
41
 
42
  /**
43
  * Get costs.
44
+ * Costs based in 01/02/2017 from:
45
+ * https://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
46
  *
47
  * @return array
48
  */
49
  protected function get_costs() {
50
  return apply_filters( 'woocommerce_correios_impresso_urgente_costs', array(
51
+ '20' => 1.50,
52
+ '50' => 2.10,
53
+ '100' => 2.85,
54
+ '150' => 3.50,
55
+ '200' => 4.10,
56
+ '250' => 4.80,
57
+ '300' => 5.40,
58
+ '350' => 6.05,
59
+ '400' => 6.60,
60
+ '450' => 7.30,
61
+ '500' => 7.90,
62
  ), $this->id, $this->instance_id );
63
  }
64
 
includes/shipping/class-wc-correios-shipping-legacy.php CHANGED
@@ -100,7 +100,7 @@ class WC_Correios_Shipping_Legacy extends WC_Shipping_Method {
100
  'default' => 'none',
101
  'options' => array(
102
  'declare' => __( 'Declare', 'woocommerce-correios' ),
103
- 'none' => __( 'None', 'woocommerce-correios' ),
104
  ),
105
  ),
106
  'display_date' => array(
100
  'default' => 'none',
101
  'options' => array(
102
  'declare' => __( 'Declare', 'woocommerce-correios' ),
103
+ 'none' => __( 'No', 'woocommerce-correios' ),
104
  ),
105
  ),
106
  'display_date' => array(
includes/wc-correios-functions.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @package WooCommerce_Correios/Functions
6
  * @since 3.0.0
7
- * @version 3.0.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
@@ -126,35 +126,86 @@ function wc_correios_trigger_tracking_code_email( $order, $tracking_code ) {
126
  }
127
  }
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  /**
130
  * Update tracking code.
131
  *
132
  * @param int $order_id Order ID.
133
  * @param string $tracking_code Tracking code.
 
 
134
  * @return bool
135
  */
136
- function wc_correios_update_tracking_code( $order_id, $tracking_code ) {
137
  $tracking_code = sanitize_text_field( $tracking_code );
138
- $current = get_post_meta( $order_id, '_correios_tracking_code', true );
 
 
 
 
 
 
139
 
140
- if ( '' !== $tracking_code && $tracking_code !== $current ) {
141
- update_post_meta( $order_id, '_correios_tracking_code', $tracking_code );
142
 
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=%1$s" target="_blank">%1$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 );
154
 
155
  return true;
156
- } elseif ( '' === $tracking_code ) {
157
- delete_post_meta( $order_id, '_correios_tracking_code' );
 
 
 
 
 
 
 
 
 
 
 
 
158
 
159
  return true;
160
  }
4
  *
5
  * @package WooCommerce_Correios/Functions
6
  * @since 3.0.0
7
+ * @version 3.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
126
  }
127
  }
128
 
129
+ /**
130
+ * Get tracking codes.
131
+ *
132
+ * @param WC_Order|int $order_id Order ID or order data.
133
+ *
134
+ * @return array
135
+ */
136
+ function wc_correios_get_tracking_codes( $order_id ) {
137
+ $order = wc_get_order( $order_id );
138
+
139
+ if ( method_exists( $order, 'get_meta' ) ) {
140
+ $codes = $order->get_meta( '_correios_tracking_code' );
141
+ } else {
142
+ $codes = $order->correios_tracking_code;
143
+ }
144
+
145
+ return array_filter( explode( ',', $codes ) );
146
+ }
147
+
148
  /**
149
  * Update tracking code.
150
  *
151
  * @param int $order_id Order ID.
152
  * @param string $tracking_code Tracking code.
153
+ * @param bool $remove If should remove the tracking code.
154
+ *
155
  * @return bool
156
  */
157
+ function wc_correios_update_tracking_code( $order_id, $tracking_code, $remove = false ) {
158
  $tracking_code = sanitize_text_field( $tracking_code );
159
+ $order = wc_get_order( $order_id );
160
+
161
+ if ( method_exists( $order, 'get_meta' ) ) {
162
+ $tracking_codes = $order->get_meta( '_correios_tracking_code' );
163
+ } else {
164
+ $tracking_codes = $order->correios_tracking_code;
165
+ }
166
 
167
+ $tracking_codes = array_filter( explode( ',', $tracking_codes ) );
 
168
 
169
+ if ( '' === $tracking_code ) {
170
+ if ( method_exists( $order, 'delete_meta_data' ) ) {
171
+ $order->delete_meta_data( '_correios_tracking_code' );
172
+ $order->save();
173
+ } else {
174
+ delete_post_meta( $order_id, '_correios_tracking_code' );
175
+ }
176
 
177
+ return true;
178
+ } elseif ( ! $remove && ! in_array( $tracking_code, $tracking_codes, true ) ) {
179
+ $tracking_codes[] = $tracking_code;
180
+
181
+ if ( method_exists( $order, 'update_meta_data' ) ) {
182
+ $order->update_meta_data( '_correios_tracking_code', implode( ',', $tracking_codes ) );
183
+ $order->save();
184
+ } else {
185
+ update_post_meta( $order_id, '_correios_tracking_code', implode( ',', $tracking_codes ) );
186
+ }
187
 
188
  // Add order note.
189
+ $order->add_order_note( sprintf( __( 'Added a Correios tracking code: %s', 'woocommerce-correios' ), $tracking_code ) );
190
 
191
  // Send email notification.
192
  wc_correios_trigger_tracking_code_email( $order, $tracking_code );
193
 
194
  return true;
195
+ } elseif ( $remove && in_array( $tracking_code, $tracking_codes, true ) ) {
196
+ if ( false !== ( $key = array_search( $tracking_code, $tracking_codes ) ) ) {
197
+ unset( $tracking_codes[ $key ] );
198
+ }
199
+
200
+ if ( method_exists( $order, 'update_meta_data' ) ) {
201
+ $order->update_meta_data( '_correios_tracking_code', implode( ',', $tracking_codes ) );
202
+ $order->save();
203
+ } else {
204
+ update_post_meta( $order_id, '_correios_tracking_code', implode( ',', $tracking_codes ) );
205
+ }
206
+
207
+ // Add order note.
208
+ $order->add_order_note( sprintf( __( 'Removed a Correios tracking code: %s', 'woocommerce-correios' ), $tracking_code ) );
209
 
210
  return true;
211
  }
languages/woocommerce-correios.pot CHANGED
@@ -2,15 +2,16 @@
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Correios 3.1.7\n"
6
- "Report-Msgid-Bugs-To: https://wordpress.org/plugins/woocommerce-domination/\n"
7
- "POT-Creation-Date: 2017-01-10 03:49:05+00:00\n"
 
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
  "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
- "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
14
  "X-Generator: grunt-wp-i18n 0.5.4\n"
15
 
16
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:26
@@ -25,48 +26,50 @@ msgstr ""
25
 
26
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:79
27
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:114
28
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:56
29
- #: includes/abstracts/abstract-wc-correios-shipping.php:91
30
  #: includes/emails/class-wc-correios-tracking-email.php:50
31
- #: includes/integrations/class-wc-correios-integration.php:78
32
- #: includes/integrations/class-wc-correios-integration.php:96
33
  #: includes/shipping/class-wc-correios-shipping-legacy.php:79
34
  msgid "Enable/Disable"
35
  msgstr ""
36
 
37
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:81
38
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:116
39
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:58
40
- #: includes/abstracts/abstract-wc-correios-shipping.php:93
41
  #: includes/shipping/class-wc-correios-shipping-legacy.php:81
42
  msgid "Enable this shipping method"
43
  msgstr ""
44
 
45
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:85
46
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:120
47
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:62
48
- #: includes/abstracts/abstract-wc-correios-shipping.php:97
49
  #: includes/shipping/class-wc-correios-shipping-legacy.php:85
50
  msgid "Title"
51
  msgstr ""
52
 
53
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:87
54
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:122
55
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:64
56
- #: includes/abstracts/abstract-wc-correios-shipping.php:99
57
  #: includes/shipping/class-wc-correios-shipping-legacy.php:87
58
  msgid "This controls the title which the user sees during checkout."
59
  msgstr ""
60
 
61
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:92
62
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:127
63
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:69
64
- #: includes/abstracts/abstract-wc-correios-shipping.php:104
65
  msgid "Behavior Options"
66
  msgstr ""
67
 
68
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:97
69
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:132
 
 
70
  msgid "Shipping Class"
71
  msgstr ""
72
 
@@ -77,22 +80,22 @@ msgstr ""
77
 
78
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:106
79
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:155
80
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:95
81
- #: includes/abstracts/abstract-wc-correios-shipping.php:117
82
  msgid "Delivery Time"
83
  msgstr ""
84
 
85
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:108
86
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:157
87
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:97
88
- #: includes/abstracts/abstract-wc-correios-shipping.php:119
89
  msgid "Show estimated delivery time"
90
  msgstr ""
91
 
92
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:109
93
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:158
94
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:98
95
- #: includes/abstracts/abstract-wc-correios-shipping.php:120
96
  msgid "Display the estimated delivery time in working days."
97
  msgstr ""
98
 
@@ -108,16 +111,16 @@ msgstr ""
108
 
109
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:122
110
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:171
111
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:103
112
- #: includes/abstracts/abstract-wc-correios-shipping.php:133
113
  #: includes/shipping/class-wc-correios-shipping-legacy.php:123
114
  msgid "Handling Fee"
115
  msgstr ""
116
 
117
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:124
118
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:173
119
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:105
120
- #: includes/abstracts/abstract-wc-correios-shipping.php:135
121
  #: includes/shipping/class-wc-correios-shipping-legacy.php:125
122
  msgid ""
123
  "Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to "
@@ -126,86 +129,86 @@ msgstr ""
126
 
127
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:130
128
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:179
129
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:111
130
- #: includes/abstracts/abstract-wc-correios-shipping.php:141
131
  msgid "Optional Services"
132
  msgstr ""
133
 
134
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:132
135
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:181
136
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:113
137
- #: includes/abstracts/abstract-wc-correios-shipping.php:143
138
  msgid "Use these options to add the value of each service provided by the Correios."
139
  msgstr ""
140
 
141
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:136
142
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:185
143
- #: includes/abstracts/abstract-wc-correios-shipping.php:147
144
  msgid "Receipt Notice"
145
  msgstr ""
146
 
147
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:138
148
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:187
149
- #: includes/abstracts/abstract-wc-correios-shipping.php:149
150
  msgid "Enable receipt notice"
151
  msgstr ""
152
 
153
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:139
154
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:188
155
- #: includes/abstracts/abstract-wc-correios-shipping.php:150
156
  msgid "This controls whether to add costs of the receipt notice service."
157
  msgstr ""
158
 
159
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:144
160
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:193
161
- #: includes/abstracts/abstract-wc-correios-shipping.php:155
162
  msgid "Own Hands"
163
  msgstr ""
164
 
165
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:146
166
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:195
167
- #: includes/abstracts/abstract-wc-correios-shipping.php:157
168
  msgid "Enable own hands"
169
  msgstr ""
170
 
171
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:147
172
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:196
173
- #: includes/abstracts/abstract-wc-correios-shipping.php:158
174
  msgid "This controls whether to add costs of the own hands service"
175
  msgstr ""
176
 
177
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:152
178
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:201
179
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:117
180
- #: includes/abstracts/abstract-wc-correios-shipping.php:237
181
  #: includes/shipping/class-wc-correios-shipping-legacy.php:224
182
  msgid "Testing"
183
  msgstr ""
184
 
185
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:157
186
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:206
187
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:122
188
- #: includes/abstracts/abstract-wc-correios-shipping.php:242
189
- #: includes/integrations/class-wc-correios-integration.php:84
190
- #: includes/integrations/class-wc-correios-integration.php:137
191
  #: includes/shipping/class-wc-correios-shipping-legacy.php:228
192
  msgid "Debug Log"
193
  msgstr ""
194
 
195
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:159
196
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:208
197
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:124
198
- #: includes/abstracts/abstract-wc-correios-shipping.php:244
199
  #: includes/shipping/class-wc-correios-shipping-legacy.php:230
200
  msgid "Enable logging"
201
  msgstr ""
202
 
203
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:161
204
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:210
205
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:126
206
- #: includes/abstracts/abstract-wc-correios-shipping.php:246
207
- #: includes/integrations/class-wc-correios-integration.php:88
208
- #: includes/integrations/class-wc-correios-integration.php:141
209
  msgid "Log %s events, such as WebServices requests."
210
  msgstr ""
211
 
@@ -233,156 +236,169 @@ msgstr ""
233
  msgid "%s is a international shipping method from Correios."
234
  msgstr ""
235
 
236
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:74
237
  msgid "Origin State"
238
  msgstr ""
239
 
240
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:76
241
  msgid "The UF of the location your packages are delivered from."
242
  msgstr ""
243
 
244
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:83
245
  msgid "Origin Locale"
246
  msgstr ""
247
 
248
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:85
249
  msgid "The location of your packages are delivered from."
250
  msgstr ""
251
 
252
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:90
253
  msgid "Capital"
254
  msgstr ""
255
 
256
- #: includes/abstracts/abstract-wc-correios-shipping-international.php:91
257
  msgid "Interior"
258
  msgstr ""
259
 
 
 
 
 
 
260
  #: includes/abstracts/abstract-wc-correios-shipping.php:81
261
- #: includes/integrations/class-wc-correios-integration.php:63
262
  msgid "View logs."
263
  msgstr ""
264
 
265
- #: includes/abstracts/abstract-wc-correios-shipping.php:109
 
 
 
 
 
 
 
 
266
  msgid "Origin Postcode"
267
  msgstr ""
268
 
269
- #: includes/abstracts/abstract-wc-correios-shipping.php:111
270
  msgid "The postcode of the location your packages are delivered from."
271
  msgstr ""
272
 
273
- #: includes/abstracts/abstract-wc-correios-shipping.php:125
274
  msgid "Additional Days"
275
  msgstr ""
276
 
277
- #: includes/abstracts/abstract-wc-correios-shipping.php:127
278
  msgid "Additional working days to the estimated delivery."
279
  msgstr ""
280
 
281
- #: includes/abstracts/abstract-wc-correios-shipping.php:163
282
  msgid "Declare Value for Insurance"
283
  msgstr ""
284
 
285
- #: includes/abstracts/abstract-wc-correios-shipping.php:165
286
  msgid "Enable declared value"
287
  msgstr ""
288
 
289
- #: includes/abstracts/abstract-wc-correios-shipping.php:166
290
  msgid ""
291
  "This controls if the price of the package must be declared for insurance "
292
  "purposes."
293
  msgstr ""
294
 
295
- #: includes/abstracts/abstract-wc-correios-shipping.php:171
296
  msgid "Service Options"
297
  msgstr ""
298
 
299
- #: includes/abstracts/abstract-wc-correios-shipping.php:176
300
  msgid "Service Code"
301
  msgstr ""
302
 
303
- #: includes/abstracts/abstract-wc-correios-shipping.php:178
304
  msgid "Service code, use this for custom codes."
305
  msgstr ""
306
 
307
- #: includes/abstracts/abstract-wc-correios-shipping.php:184
308
  #: includes/shipping/class-wc-correios-shipping-esedex.php:40
309
  msgid "Service Type"
310
  msgstr ""
311
 
312
- #: includes/abstracts/abstract-wc-correios-shipping.php:186
313
  #: includes/shipping/class-wc-correios-shipping-esedex.php:42
314
  #: includes/shipping/class-wc-correios-shipping-legacy.php:136
315
  msgid "Choose between conventional or corporate service."
316
  msgstr ""
317
 
318
- #: includes/abstracts/abstract-wc-correios-shipping.php:191
319
  #: includes/shipping/class-wc-correios-shipping-legacy.php:140
320
  msgid "Conventional"
321
  msgstr ""
322
 
323
- #: includes/abstracts/abstract-wc-correios-shipping.php:192
324
  #: includes/shipping/class-wc-correios-shipping-esedex.php:47
325
  #: includes/shipping/class-wc-correios-shipping-legacy.php:141
326
  msgid "Corporate"
327
  msgstr ""
328
 
329
- #: includes/abstracts/abstract-wc-correios-shipping.php:196
330
  #: includes/shipping/class-wc-correios-shipping-legacy.php:145
331
  msgid "Administrative Code"
332
  msgstr ""
333
 
334
- #: includes/abstracts/abstract-wc-correios-shipping.php:198
335
  msgid "Your Correios login. It's usually your CNPJ."
336
  msgstr ""
337
 
338
- #: includes/abstracts/abstract-wc-correios-shipping.php:203
339
  #: includes/shipping/class-wc-correios-shipping-legacy.php:151
340
  msgid "Administrative Password"
341
  msgstr ""
342
 
343
- #: includes/abstracts/abstract-wc-correios-shipping.php:205
344
  #: includes/shipping/class-wc-correios-shipping-legacy.php:153
345
  msgid "Your Correios password."
346
  msgstr ""
347
 
348
- #: includes/abstracts/abstract-wc-correios-shipping.php:210
349
  #: includes/shipping/class-wc-correios-shipping-legacy.php:197
350
  msgid "Package Standard"
351
  msgstr ""
352
 
353
- #: includes/abstracts/abstract-wc-correios-shipping.php:212
354
  msgid "Minimum measure for your shipping packages."
355
  msgstr ""
356
 
357
- #: includes/abstracts/abstract-wc-correios-shipping.php:216
358
  #: includes/shipping/class-wc-correios-shipping-legacy.php:203
359
  msgid "Minimum Height"
360
  msgstr ""
361
 
362
- #: includes/abstracts/abstract-wc-correios-shipping.php:218
363
  msgid "Minimum height of your shipping packages. Correios needs at least 2cm."
364
  msgstr ""
365
 
366
- #: includes/abstracts/abstract-wc-correios-shipping.php:223
367
  #: includes/shipping/class-wc-correios-shipping-legacy.php:210
368
  msgid "Minimum Width"
369
  msgstr ""
370
 
371
- #: includes/abstracts/abstract-wc-correios-shipping.php:225
372
  msgid "Minimum width of your shipping packages. Correios needs at least 11cm."
373
  msgstr ""
374
 
375
- #: includes/abstracts/abstract-wc-correios-shipping.php:230
376
  #: includes/shipping/class-wc-correios-shipping-legacy.php:217
377
  msgid "Minimum Length"
378
  msgstr ""
379
 
380
- #: includes/abstracts/abstract-wc-correios-shipping.php:232
381
  msgid "Minimum length of your shipping packages. Correios needs at least 16cm."
382
  msgstr ""
383
 
384
- #: includes/admin/class-wc-correios-admin-orders.php:48
385
- msgid "Tracking code:"
386
  msgstr ""
387
 
388
  #: includes/admin/views/html-admin-help-message.php:14
@@ -419,6 +435,41 @@ msgstr ""
419
  msgid "More about %s."
420
  msgstr ""
421
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
422
  #: includes/class-wc-correios-autofill-addresses.php:257
423
  msgid "Missing postcode paramater."
424
  msgstr ""
@@ -454,8 +505,8 @@ msgstr ""
454
 
455
  #: includes/emails/class-wc-correios-tracking-email.php:31
456
  msgid ""
457
- "To track your delivery, use the following the tracking code: "
458
- "{tracking_code}."
459
  msgstr ""
460
 
461
  #: includes/emails/class-wc-correios-tracking-email.php:33
@@ -522,53 +573,54 @@ msgstr ""
522
  #: includes/shipping/class-wc-correios-shipping-legacy.php:17
523
  #: includes/shipping/class-wc-correios-shipping-legacy.php:89
524
  #: includes/shipping/class-wc-correios-shipping-legacy.php:426
525
- #: templates/myaccount/tracking-code.php:16
526
  msgid "Correios"
527
  msgstr ""
528
 
529
- #: includes/integrations/class-wc-correios-integration.php:73
530
- #: includes/integrations/class-wc-correios-integration.php:88
531
  msgid "Tracking History Table"
532
  msgstr ""
533
 
534
- #: includes/integrations/class-wc-correios-integration.php:75
535
- #: includes/integrations/class-wc-correios-integration.php:93
536
  msgid ""
537
  "Displays a table with informations about the shipping in My Account > View "
538
  "Order page."
539
  msgstr ""
540
 
541
- #: includes/integrations/class-wc-correios-integration.php:80
542
  msgid "Enable Tracking History Table"
543
  msgstr ""
544
 
545
- #: includes/integrations/class-wc-correios-integration.php:86
546
  msgid "Enable logging for Tracking History"
547
  msgstr ""
548
 
549
- #: includes/integrations/class-wc-correios-integration.php:91
550
- #: includes/integrations/class-wc-correios-integration.php:141
551
  msgid "Autofill Addresses"
552
  msgstr ""
553
 
554
- #: includes/integrations/class-wc-correios-integration.php:98
555
  msgid "Enable Autofill Addresses"
556
  msgstr ""
557
 
558
- #: includes/integrations/class-wc-correios-integration.php:102
559
  msgid "Postcodes Validity"
560
  msgstr ""
561
 
562
- #: includes/integrations/class-wc-correios-integration.php:106
563
  msgid ""
564
  "Defines how long a postcode will stay saved in the database before a new "
565
  "query."
566
  msgstr ""
567
 
568
- #: includes/integrations/class-wc-correios-integration.php:108
569
  msgid "1 month"
570
  msgstr ""
571
 
 
 
572
  #: includes/integrations/class-wc-correios-integration.php:109
573
  #: includes/integrations/class-wc-correios-integration.php:110
574
  #: includes/integrations/class-wc-correios-integration.php:111
@@ -578,67 +630,65 @@ msgstr ""
578
  #: includes/integrations/class-wc-correios-integration.php:115
579
  #: includes/integrations/class-wc-correios-integration.php:116
580
  #: includes/integrations/class-wc-correios-integration.php:117
581
- #: includes/integrations/class-wc-correios-integration.php:118
582
- #: includes/integrations/class-wc-correios-integration.php:119
583
  msgid "%d month"
584
  msgstr ""
585
 
586
- #: includes/integrations/class-wc-correios-integration.php:120
587
  msgid "Forever"
588
  msgstr ""
589
 
590
- #: includes/integrations/class-wc-correios-integration.php:124
591
  msgid "Force Autofill"
592
  msgstr ""
593
 
594
- #: includes/integrations/class-wc-correios-integration.php:126
595
  msgid "Enable Force Autofill"
596
  msgstr ""
597
 
598
- #: includes/integrations/class-wc-correios-integration.php:127
599
  msgid ""
600
  "When enabled will autofill all addresses after the user finish to fill the "
601
  "postcode, even if the addresses are already filled."
602
  msgstr ""
603
 
 
604
  #: includes/integrations/class-wc-correios-integration.php:131
605
- #: includes/integrations/class-wc-correios-integration.php:133
606
  msgid "Empty Database"
607
  msgstr ""
608
 
609
- #: includes/integrations/class-wc-correios-integration.php:134
610
  msgid ""
611
  "Delete all the saved postcodes in the database, use this option if you have "
612
  "issues with outdated postcodes."
613
  msgstr ""
614
 
615
- #: includes/integrations/class-wc-correios-integration.php:139
616
  msgid "Enable logging for Autofill Addresses"
617
  msgstr ""
618
 
619
- #: includes/integrations/class-wc-correios-integration.php:160
620
  msgid ""
621
  "It's required have installed the %s on your server in order to integrate "
622
  "with the services of the Correios!"
623
  msgstr ""
624
 
625
- #: includes/integrations/class-wc-correios-integration.php:160
626
  msgid "SOAP module"
627
  msgstr ""
628
 
629
- #: includes/integrations/class-wc-correios-integration.php:169
630
  msgid "Are you sure you want to delete all postcodes from the database?"
631
  msgstr ""
632
 
633
- #: includes/integrations/class-wc-correios-integration.php:274
634
  msgid "Missing parameters!"
635
  msgstr ""
636
 
637
- #: includes/integrations/class-wc-correios-integration.php:279
638
  msgid "Invalid nonce!"
639
  msgstr ""
640
 
641
- #: includes/integrations/class-wc-correios-integration.php:288
642
  msgid "Postcode database emptied successfully!"
643
  msgstr ""
644
 
@@ -684,7 +734,7 @@ msgid "Declare"
684
  msgstr ""
685
 
686
  #: includes/shipping/class-wc-correios-shipping-legacy.php:103
687
- msgid "None"
688
  msgstr ""
689
 
690
  #: includes/shipping/class-wc-correios-shipping-legacy.php:107
@@ -835,67 +885,43 @@ msgstr ""
835
  msgid "Area with delivery temporarily subjected to different periods."
836
  msgstr ""
837
 
838
- #: includes/wc-correios-functions.php:150
839
  msgid "Added a Correios tracking code: %s"
840
  msgstr ""
841
 
 
 
 
 
842
  #: templates/emails/correios-tracking-code.php:19
843
  #: templates/emails/plain/correios-tracking-code.php:18
844
  msgid "For your reference, your order details are shown below."
845
  msgstr ""
846
 
847
- #: templates/emails/correios-tracking-code.php:23
848
- msgid "Order:"
849
- msgstr ""
850
-
851
- #: templates/emails/correios-tracking-code.php:28
852
- msgid "Product"
853
- msgstr ""
854
-
855
- #: templates/emails/correios-tracking-code.php:29
856
- msgid "Quantity"
857
- msgstr ""
858
-
859
- #: templates/emails/correios-tracking-code.php:30
860
- msgid "Price"
861
- msgstr ""
862
-
863
- #: templates/emails/plain/correios-tracking-code.php:24
864
- msgid "Order number: %s"
865
- msgstr ""
866
-
867
- #: templates/emails/plain/correios-tracking-code.php:25
868
- msgid "Order date: %s"
869
- msgstr ""
870
-
871
- #: templates/myaccount/tracking-code.php:16
872
- msgid "Your the tracking code:"
873
- msgstr ""
874
-
875
  #: templates/myaccount/tracking-history-table.php:15
876
- msgid "Correios Delivery History"
877
- msgstr ""
878
-
879
- #: templates/myaccount/tracking-history-table.php:17
880
  msgid "History for the tracking code:"
881
  msgstr ""
882
 
883
- #: templates/myaccount/tracking-history-table.php:21
884
  msgid "Date"
885
  msgstr ""
886
 
887
- #: templates/myaccount/tracking-history-table.php:22
888
  msgid "Location"
889
  msgstr ""
890
 
891
- #: templates/myaccount/tracking-history-table.php:23
892
  msgid "Status"
893
  msgstr ""
894
 
895
- #: templates/myaccount/tracking-history-table.php:34
896
  msgid "In transit to %s"
897
  msgstr ""
898
 
 
 
 
 
899
  #. Plugin URI of the plugin/theme
900
  msgid "https://github.com/claudiosanches/woocommerce-correios"
901
  msgstr ""
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Correios 3.2.0\n"
6
+ "Report-Msgid-Bugs-To: "
7
+ "https://wordpress.org/support/plugin/woocommerce-correios\n"
8
+ "POT-Creation-Date: 2017-03-08 02:20:38+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
  "X-Generator: grunt-wp-i18n 0.5.4\n"
16
 
17
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:26
26
 
27
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:79
28
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:114
29
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:57
30
+ #: includes/abstracts/abstract-wc-correios-shipping.php:109
31
  #: includes/emails/class-wc-correios-tracking-email.php:50
32
+ #: includes/integrations/class-wc-correios-integration.php:76
33
+ #: includes/integrations/class-wc-correios-integration.php:94
34
  #: includes/shipping/class-wc-correios-shipping-legacy.php:79
35
  msgid "Enable/Disable"
36
  msgstr ""
37
 
38
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:81
39
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:116
40
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:59
41
+ #: includes/abstracts/abstract-wc-correios-shipping.php:111
42
  #: includes/shipping/class-wc-correios-shipping-legacy.php:81
43
  msgid "Enable this shipping method"
44
  msgstr ""
45
 
46
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:85
47
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:120
48
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:63
49
+ #: includes/abstracts/abstract-wc-correios-shipping.php:115
50
  #: includes/shipping/class-wc-correios-shipping-legacy.php:85
51
  msgid "Title"
52
  msgstr ""
53
 
54
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:87
55
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:122
56
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:65
57
+ #: includes/abstracts/abstract-wc-correios-shipping.php:117
58
  #: includes/shipping/class-wc-correios-shipping-legacy.php:87
59
  msgid "This controls the title which the user sees during checkout."
60
  msgstr ""
61
 
62
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:92
63
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:127
64
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:70
65
+ #: includes/abstracts/abstract-wc-correios-shipping.php:122
66
  msgid "Behavior Options"
67
  msgstr ""
68
 
69
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:97
70
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:132
71
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:96
72
+ #: includes/abstracts/abstract-wc-correios-shipping.php:135
73
  msgid "Shipping Class"
74
  msgstr ""
75
 
80
 
81
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:106
82
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:155
83
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:105
84
+ #: includes/abstracts/abstract-wc-correios-shipping.php:144
85
  msgid "Delivery Time"
86
  msgstr ""
87
 
88
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:108
89
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:157
90
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:107
91
+ #: includes/abstracts/abstract-wc-correios-shipping.php:146
92
  msgid "Show estimated delivery time"
93
  msgstr ""
94
 
95
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:109
96
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:158
97
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:108
98
+ #: includes/abstracts/abstract-wc-correios-shipping.php:147
99
  msgid "Display the estimated delivery time in working days."
100
  msgstr ""
101
 
111
 
112
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:122
113
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:171
114
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:113
115
+ #: includes/abstracts/abstract-wc-correios-shipping.php:160
116
  #: includes/shipping/class-wc-correios-shipping-legacy.php:123
117
  msgid "Handling Fee"
118
  msgstr ""
119
 
120
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:124
121
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:173
122
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:115
123
+ #: includes/abstracts/abstract-wc-correios-shipping.php:162
124
  #: includes/shipping/class-wc-correios-shipping-legacy.php:125
125
  msgid ""
126
  "Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to "
129
 
130
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:130
131
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:179
132
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:121
133
+ #: includes/abstracts/abstract-wc-correios-shipping.php:168
134
  msgid "Optional Services"
135
  msgstr ""
136
 
137
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:132
138
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:181
139
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:123
140
+ #: includes/abstracts/abstract-wc-correios-shipping.php:170
141
  msgid "Use these options to add the value of each service provided by the Correios."
142
  msgstr ""
143
 
144
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:136
145
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:185
146
+ #: includes/abstracts/abstract-wc-correios-shipping.php:174
147
  msgid "Receipt Notice"
148
  msgstr ""
149
 
150
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:138
151
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:187
152
+ #: includes/abstracts/abstract-wc-correios-shipping.php:176
153
  msgid "Enable receipt notice"
154
  msgstr ""
155
 
156
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:139
157
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:188
158
+ #: includes/abstracts/abstract-wc-correios-shipping.php:177
159
  msgid "This controls whether to add costs of the receipt notice service."
160
  msgstr ""
161
 
162
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:144
163
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:193
164
+ #: includes/abstracts/abstract-wc-correios-shipping.php:182
165
  msgid "Own Hands"
166
  msgstr ""
167
 
168
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:146
169
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:195
170
+ #: includes/abstracts/abstract-wc-correios-shipping.php:184
171
  msgid "Enable own hands"
172
  msgstr ""
173
 
174
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:147
175
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:196
176
+ #: includes/abstracts/abstract-wc-correios-shipping.php:185
177
  msgid "This controls whether to add costs of the own hands service"
178
  msgstr ""
179
 
180
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:152
181
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:201
182
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:127
183
+ #: includes/abstracts/abstract-wc-correios-shipping.php:264
184
  #: includes/shipping/class-wc-correios-shipping-legacy.php:224
185
  msgid "Testing"
186
  msgstr ""
187
 
188
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:157
189
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:206
190
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:132
191
+ #: includes/abstracts/abstract-wc-correios-shipping.php:269
192
+ #: includes/integrations/class-wc-correios-integration.php:82
193
+ #: includes/integrations/class-wc-correios-integration.php:135
194
  #: includes/shipping/class-wc-correios-shipping-legacy.php:228
195
  msgid "Debug Log"
196
  msgstr ""
197
 
198
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:159
199
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:208
200
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:134
201
+ #: includes/abstracts/abstract-wc-correios-shipping.php:271
202
  #: includes/shipping/class-wc-correios-shipping-legacy.php:230
203
  msgid "Enable logging"
204
  msgstr ""
205
 
206
  #: includes/abstracts/abstract-wc-correios-shipping-carta.php:161
207
  #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:210
208
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:136
209
+ #: includes/abstracts/abstract-wc-correios-shipping.php:273
210
+ #: includes/integrations/class-wc-correios-integration.php:86
211
+ #: includes/integrations/class-wc-correios-integration.php:139
212
  msgid "Log %s events, such as WebServices requests."
213
  msgstr ""
214
 
236
  msgid "%s is a international shipping method from Correios."
237
  msgstr ""
238
 
239
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:75
240
  msgid "Origin State"
241
  msgstr ""
242
 
243
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:77
244
  msgid "The UF of the location your packages are delivered from."
245
  msgstr ""
246
 
247
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:84
248
  msgid "Origin Locale"
249
  msgstr ""
250
 
251
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:86
252
  msgid "The location of your packages are delivered from."
253
  msgstr ""
254
 
255
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:91
256
  msgid "Capital"
257
  msgstr ""
258
 
259
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:92
260
  msgid "Interior"
261
  msgstr ""
262
 
263
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:98
264
+ #: includes/abstracts/abstract-wc-correios-shipping.php:137
265
+ msgid "If necessary, select a shipping class to apply this method."
266
+ msgstr ""
267
+
268
  #: includes/abstracts/abstract-wc-correios-shipping.php:81
269
+ #: includes/integrations/class-wc-correios-integration.php:62
270
  msgid "View logs."
271
  msgstr ""
272
 
273
+ #: includes/abstracts/abstract-wc-correios-shipping.php:92
274
+ msgid "Any Shipping Class"
275
+ msgstr ""
276
+
277
+ #: includes/abstracts/abstract-wc-correios-shipping.php:93
278
+ msgid "No Shipping Class"
279
+ msgstr ""
280
+
281
+ #: includes/abstracts/abstract-wc-correios-shipping.php:127
282
  msgid "Origin Postcode"
283
  msgstr ""
284
 
285
+ #: includes/abstracts/abstract-wc-correios-shipping.php:129
286
  msgid "The postcode of the location your packages are delivered from."
287
  msgstr ""
288
 
289
+ #: includes/abstracts/abstract-wc-correios-shipping.php:152
290
  msgid "Additional Days"
291
  msgstr ""
292
 
293
+ #: includes/abstracts/abstract-wc-correios-shipping.php:154
294
  msgid "Additional working days to the estimated delivery."
295
  msgstr ""
296
 
297
+ #: includes/abstracts/abstract-wc-correios-shipping.php:190
298
  msgid "Declare Value for Insurance"
299
  msgstr ""
300
 
301
+ #: includes/abstracts/abstract-wc-correios-shipping.php:192
302
  msgid "Enable declared value"
303
  msgstr ""
304
 
305
+ #: includes/abstracts/abstract-wc-correios-shipping.php:193
306
  msgid ""
307
  "This controls if the price of the package must be declared for insurance "
308
  "purposes."
309
  msgstr ""
310
 
311
+ #: includes/abstracts/abstract-wc-correios-shipping.php:198
312
  msgid "Service Options"
313
  msgstr ""
314
 
315
+ #: includes/abstracts/abstract-wc-correios-shipping.php:203
316
  msgid "Service Code"
317
  msgstr ""
318
 
319
+ #: includes/abstracts/abstract-wc-correios-shipping.php:205
320
  msgid "Service code, use this for custom codes."
321
  msgstr ""
322
 
323
+ #: includes/abstracts/abstract-wc-correios-shipping.php:211
324
  #: includes/shipping/class-wc-correios-shipping-esedex.php:40
325
  msgid "Service Type"
326
  msgstr ""
327
 
328
+ #: includes/abstracts/abstract-wc-correios-shipping.php:213
329
  #: includes/shipping/class-wc-correios-shipping-esedex.php:42
330
  #: includes/shipping/class-wc-correios-shipping-legacy.php:136
331
  msgid "Choose between conventional or corporate service."
332
  msgstr ""
333
 
334
+ #: includes/abstracts/abstract-wc-correios-shipping.php:218
335
  #: includes/shipping/class-wc-correios-shipping-legacy.php:140
336
  msgid "Conventional"
337
  msgstr ""
338
 
339
+ #: includes/abstracts/abstract-wc-correios-shipping.php:219
340
  #: includes/shipping/class-wc-correios-shipping-esedex.php:47
341
  #: includes/shipping/class-wc-correios-shipping-legacy.php:141
342
  msgid "Corporate"
343
  msgstr ""
344
 
345
+ #: includes/abstracts/abstract-wc-correios-shipping.php:223
346
  #: includes/shipping/class-wc-correios-shipping-legacy.php:145
347
  msgid "Administrative Code"
348
  msgstr ""
349
 
350
+ #: includes/abstracts/abstract-wc-correios-shipping.php:225
351
  msgid "Your Correios login. It's usually your CNPJ."
352
  msgstr ""
353
 
354
+ #: includes/abstracts/abstract-wc-correios-shipping.php:230
355
  #: includes/shipping/class-wc-correios-shipping-legacy.php:151
356
  msgid "Administrative Password"
357
  msgstr ""
358
 
359
+ #: includes/abstracts/abstract-wc-correios-shipping.php:232
360
  #: includes/shipping/class-wc-correios-shipping-legacy.php:153
361
  msgid "Your Correios password."
362
  msgstr ""
363
 
364
+ #: includes/abstracts/abstract-wc-correios-shipping.php:237
365
  #: includes/shipping/class-wc-correios-shipping-legacy.php:197
366
  msgid "Package Standard"
367
  msgstr ""
368
 
369
+ #: includes/abstracts/abstract-wc-correios-shipping.php:239
370
  msgid "Minimum measure for your shipping packages."
371
  msgstr ""
372
 
373
+ #: includes/abstracts/abstract-wc-correios-shipping.php:243
374
  #: includes/shipping/class-wc-correios-shipping-legacy.php:203
375
  msgid "Minimum Height"
376
  msgstr ""
377
 
378
+ #: includes/abstracts/abstract-wc-correios-shipping.php:245
379
  msgid "Minimum height of your shipping packages. Correios needs at least 2cm."
380
  msgstr ""
381
 
382
+ #: includes/abstracts/abstract-wc-correios-shipping.php:250
383
  #: includes/shipping/class-wc-correios-shipping-legacy.php:210
384
  msgid "Minimum Width"
385
  msgstr ""
386
 
387
+ #: includes/abstracts/abstract-wc-correios-shipping.php:252
388
  msgid "Minimum width of your shipping packages. Correios needs at least 11cm."
389
  msgstr ""
390
 
391
+ #: includes/abstracts/abstract-wc-correios-shipping.php:257
392
  #: includes/shipping/class-wc-correios-shipping-legacy.php:217
393
  msgid "Minimum Length"
394
  msgstr ""
395
 
396
+ #: includes/abstracts/abstract-wc-correios-shipping.php:259
397
  msgid "Minimum length of your shipping packages. Correios needs at least 16cm."
398
  msgstr ""
399
 
400
+ #: includes/admin/class-wc-correios-admin-orders.php:60
401
+ msgid "Are you sure you want to remove this tracking code?"
402
  msgstr ""
403
 
404
  #: includes/admin/views/html-admin-help-message.php:14
435
  msgid "More about %s."
436
  msgstr ""
437
 
438
+ #: includes/admin/views/html-meta-box-tracking-code.php:16
439
+ #: includes/admin/views/html-meta-box-tracking-code.php:19
440
+ #: includes/admin/views/html-meta-box-tracking-code.php:41
441
+ msgid "Tracking code"
442
+ msgid_plural "Tracking codes:"
443
+ msgstr[0] ""
444
+ msgstr[1] ""
445
+
446
+ #: includes/admin/views/html-meta-box-tracking-code.php:19
447
+ #: includes/admin/views/html-meta-box-tracking-code.php:41
448
+ msgid "View tracking code"
449
+ msgstr ""
450
+
451
+ #: includes/admin/views/html-meta-box-tracking-code.php:19
452
+ #: includes/admin/views/html-meta-box-tracking-code.php:41
453
+ msgid "Remove tracking code"
454
+ msgstr ""
455
+
456
+ #: includes/admin/views/html-meta-box-tracking-code.php:26
457
+ msgid "Add tracking code"
458
+ msgstr ""
459
+
460
+ #: includes/admin/views/html-meta-box-tracking-code.php:28
461
+ msgid "Add new tracking code"
462
+ msgstr ""
463
+
464
+ #: includes/admin/views/html-meta-box-tracking-code.php:35
465
+ msgid "Tracking codes:"
466
+ msgstr ""
467
+
468
+ #: includes/admin/views/html-meta-box-tracking-code.php:37
469
+ #: templates/myaccount/tracking-codes.php:15
470
+ msgid "Tracking code:"
471
+ msgstr ""
472
+
473
  #: includes/class-wc-correios-autofill-addresses.php:257
474
  msgid "Missing postcode paramater."
475
  msgstr ""
505
 
506
  #: includes/emails/class-wc-correios-tracking-email.php:31
507
  msgid ""
508
+ "To track your delivery, use the following the tracking code(s): "
509
+ "{tracking_code}"
510
  msgstr ""
511
 
512
  #: includes/emails/class-wc-correios-tracking-email.php:33
573
  #: includes/shipping/class-wc-correios-shipping-legacy.php:17
574
  #: includes/shipping/class-wc-correios-shipping-legacy.php:89
575
  #: includes/shipping/class-wc-correios-shipping-legacy.php:426
 
576
  msgid "Correios"
577
  msgstr ""
578
 
579
+ #: includes/integrations/class-wc-correios-integration.php:71
580
+ #: includes/integrations/class-wc-correios-integration.php:86
581
  msgid "Tracking History Table"
582
  msgstr ""
583
 
584
+ #: includes/integrations/class-wc-correios-integration.php:73
585
+ #: includes/integrations/class-wc-correios-integration.php:91
586
  msgid ""
587
  "Displays a table with informations about the shipping in My Account > View "
588
  "Order page."
589
  msgstr ""
590
 
591
+ #: includes/integrations/class-wc-correios-integration.php:78
592
  msgid "Enable Tracking History Table"
593
  msgstr ""
594
 
595
+ #: includes/integrations/class-wc-correios-integration.php:84
596
  msgid "Enable logging for Tracking History"
597
  msgstr ""
598
 
599
+ #: includes/integrations/class-wc-correios-integration.php:89
600
+ #: includes/integrations/class-wc-correios-integration.php:139
601
  msgid "Autofill Addresses"
602
  msgstr ""
603
 
604
+ #: includes/integrations/class-wc-correios-integration.php:96
605
  msgid "Enable Autofill Addresses"
606
  msgstr ""
607
 
608
+ #: includes/integrations/class-wc-correios-integration.php:100
609
  msgid "Postcodes Validity"
610
  msgstr ""
611
 
612
+ #: includes/integrations/class-wc-correios-integration.php:104
613
  msgid ""
614
  "Defines how long a postcode will stay saved in the database before a new "
615
  "query."
616
  msgstr ""
617
 
618
+ #: includes/integrations/class-wc-correios-integration.php:106
619
  msgid "1 month"
620
  msgstr ""
621
 
622
+ #: includes/integrations/class-wc-correios-integration.php:107
623
+ #: includes/integrations/class-wc-correios-integration.php:108
624
  #: includes/integrations/class-wc-correios-integration.php:109
625
  #: includes/integrations/class-wc-correios-integration.php:110
626
  #: includes/integrations/class-wc-correios-integration.php:111
630
  #: includes/integrations/class-wc-correios-integration.php:115
631
  #: includes/integrations/class-wc-correios-integration.php:116
632
  #: includes/integrations/class-wc-correios-integration.php:117
 
 
633
  msgid "%d month"
634
  msgstr ""
635
 
636
+ #: includes/integrations/class-wc-correios-integration.php:118
637
  msgid "Forever"
638
  msgstr ""
639
 
640
+ #: includes/integrations/class-wc-correios-integration.php:122
641
  msgid "Force Autofill"
642
  msgstr ""
643
 
644
+ #: includes/integrations/class-wc-correios-integration.php:124
645
  msgid "Enable Force Autofill"
646
  msgstr ""
647
 
648
+ #: includes/integrations/class-wc-correios-integration.php:125
649
  msgid ""
650
  "When enabled will autofill all addresses after the user finish to fill the "
651
  "postcode, even if the addresses are already filled."
652
  msgstr ""
653
 
654
+ #: includes/integrations/class-wc-correios-integration.php:129
655
  #: includes/integrations/class-wc-correios-integration.php:131
 
656
  msgid "Empty Database"
657
  msgstr ""
658
 
659
+ #: includes/integrations/class-wc-correios-integration.php:132
660
  msgid ""
661
  "Delete all the saved postcodes in the database, use this option if you have "
662
  "issues with outdated postcodes."
663
  msgstr ""
664
 
665
+ #: includes/integrations/class-wc-correios-integration.php:137
666
  msgid "Enable logging for Autofill Addresses"
667
  msgstr ""
668
 
669
+ #: includes/integrations/class-wc-correios-integration.php:158
670
  msgid ""
671
  "It's required have installed the %s on your server in order to integrate "
672
  "with the services of the Correios!"
673
  msgstr ""
674
 
675
+ #: includes/integrations/class-wc-correios-integration.php:158
676
  msgid "SOAP module"
677
  msgstr ""
678
 
679
+ #: includes/integrations/class-wc-correios-integration.php:167
680
  msgid "Are you sure you want to delete all postcodes from the database?"
681
  msgstr ""
682
 
683
+ #: includes/integrations/class-wc-correios-integration.php:272
684
  msgid "Missing parameters!"
685
  msgstr ""
686
 
687
+ #: includes/integrations/class-wc-correios-integration.php:277
688
  msgid "Invalid nonce!"
689
  msgstr ""
690
 
691
+ #: includes/integrations/class-wc-correios-integration.php:286
692
  msgid "Postcode database emptied successfully!"
693
  msgstr ""
694
 
734
  msgstr ""
735
 
736
  #: includes/shipping/class-wc-correios-shipping-legacy.php:103
737
+ msgid "No"
738
  msgstr ""
739
 
740
  #: includes/shipping/class-wc-correios-shipping-legacy.php:107
885
  msgid "Area with delivery temporarily subjected to different periods."
886
  msgstr ""
887
 
888
+ #: includes/wc-correios-functions.php:189
889
  msgid "Added a Correios tracking code: %s"
890
  msgstr ""
891
 
892
+ #: includes/wc-correios-functions.php:208
893
+ msgid "Removed a Correios tracking code: %s"
894
+ msgstr ""
895
+
896
  #: templates/emails/correios-tracking-code.php:19
897
  #: templates/emails/plain/correios-tracking-code.php:18
898
  msgid "For your reference, your order details are shown below."
899
  msgstr ""
900
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
901
  #: templates/myaccount/tracking-history-table.php:15
 
 
 
 
902
  msgid "History for the tracking code:"
903
  msgstr ""
904
 
905
+ #: templates/myaccount/tracking-history-table.php:19
906
  msgid "Date"
907
  msgstr ""
908
 
909
+ #: templates/myaccount/tracking-history-table.php:20
910
  msgid "Location"
911
  msgstr ""
912
 
913
+ #: templates/myaccount/tracking-history-table.php:21
914
  msgid "Status"
915
  msgstr ""
916
 
917
+ #: templates/myaccount/tracking-history-table.php:32
918
  msgid "In transit to %s"
919
  msgstr ""
920
 
921
+ #: templates/myaccount/tracking-title.php:15
922
+ msgid "Correios Delivery History"
923
+ msgstr ""
924
+
925
  #. Plugin URI of the plugin/theme
926
  msgid "https://github.com/claudiosanches/woocommerce-correios"
927
  msgstr ""
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.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -46,7 +46,7 @@ Confira o nosso guia de instalação e configuração do Correios na aba [Instal
46
 
47
  = Compatibilidade =
48
 
49
- Compatível com a versão 2.6.x do WooCommerce.
50
 
51
  = Dúvidas? =
52
 
@@ -203,6 +203,14 @@ 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.7 - 2017/01/10 =
207
 
208
  - Corrigido o link de rastreio nas notas do pedido.
@@ -284,6 +292,10 @@ Em caso de dúvidas, basta abrir um tópico no [fórum de suporte do plugin](htt
284
 
285
  == Upgrade Notice ==
286
 
287
- = 3.1.7 =
288
 
289
- - Corrigido o link de rastreio nas notas do pedido.
 
 
 
 
4
  Tags: shipping, delivery, woocommerce, correios
5
  Requires at least: 4.0
6
  Tested up to: 4.7
7
+ Stable tag: 3.2.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
46
 
47
  = Compatibilidade =
48
 
49
+ Compatível com a versão 2.6.x e 2.7.x do WooCommerce.
50
 
51
  = Dúvidas? =
52
 
203
 
204
  == Changelog ==
205
 
206
+ = 3.2.0 - 2017/03/07 =
207
+
208
+ - Adicionado suporte para o WooCommerce 2.7.
209
+ - Atualizados os valores do Impresso Normal e Impresso Urgente (Obrigado Alex Koti).
210
+ - Adicionado suporte para vários códigos de rastreamento para cara pedido.
211
+ - Adicionado suporte a classes de entrega para todos os métodos de entrega.
212
+ - Corrigida compatibilidade com PHP 7.1.
213
+
214
  = 3.1.7 - 2017/01/10 =
215
 
216
  - Corrigido o link de rastreio nas notas do pedido.
292
 
293
  == Upgrade Notice ==
294
 
295
+ = 3.2.0 =
296
 
297
+ - Adicionado suporte para o WooCommerce 2.7.
298
+ - Atualizados os valores do Impresso Normal e Impresso Urgente (Obrigado Alex Koti).
299
+ - Adicionado suporte para vários códigos de rastreamento para cara pedido.
300
+ - Adicionado suporte a classes de entrega para todos os métodos de entrega.
301
+ - Corrigida compatibilidade com PHP 7.1.
templates/emails/correios-tracking-code.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Claudio_Sanches
6
  * @package WooCommerce_Correios/Templates
7
- * @version 3.0.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
@@ -12,61 +12,26 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  }
13
  ?>
14
 
15
- <?php do_action( 'woocommerce_email_header', $email_heading ); ?>
16
 
17
  <?php echo wptexturize( wpautop( $tracking_message ) ); ?>
18
 
19
  <p><?php esc_html_e( 'For your reference, your order details are shown below.', 'woocommerce-correios' ); ?></p>
20
 
21
- <?php do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text ); ?>
22
-
23
- <h2><?php echo esc_html( __( 'Order:', 'woocommerce-correios' ) . ' ' . $order->get_order_number() ); ?></h2>
24
-
25
- <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
26
- <thead>
27
- <tr>
28
- <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php esc_html_e( 'Product', 'woocommerce-correios' ); ?></th>
29
- <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php esc_html_e( 'Quantity', 'woocommerce-correios' ); ?></th>
30
- <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php esc_html_e( 'Price', 'woocommerce-correios' ); ?></th>
31
- </tr>
32
- </thead>
33
- <tbody>
34
- <?php
35
- if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.5', '>=' ) ) {
36
- echo $order->email_order_items_table( array(
37
- 'plain_text' => false,
38
- ) );
39
- } else {
40
- echo $order->email_order_items_table( true, false, true );
41
- }
42
- ?>
43
- </tbody>
44
- <tfoot>
45
- <?php if ( $totals = $order->get_order_item_totals() ) :
46
- $i = 0;
47
- foreach ( $totals as $total ) :
48
- $i++;
49
- ?>
50
- <tr>
51
- <th scope="row" colspan="2" style="text-align: left; border: 1px solid #eee; <?php echo ( 1 == $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['label']; ?></th>
52
- <td style="text-align: left; border: 1px solid #eee; <?php echo ( 1 == $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['value']; ?></td>
53
- </tr>
54
- <?php
55
- endforeach;
56
- endif; ?>
57
- </tfoot>
58
- </table>
59
-
60
- <?php do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text ); ?>
61
-
62
  <?php
 
 
 
 
 
 
63
 
64
  /**
65
  * Order meta.
66
  *
67
  * @hooked WC_Emails::order_meta() Shows order meta data.
68
  */
69
- do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );
70
 
71
  /**
72
  * Customer details.
@@ -74,11 +39,11 @@ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text )
74
  * @hooked WC_Emails::customer_details() Shows customer details
75
  * @hooked WC_Emails::email_address() Shows email address
76
  */
77
- do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text );
78
 
79
  /**
80
  * Email footer.
81
  *
82
  * @hooked WC_Emails::email_footer() Output the email footer.
83
  */
84
- do_action( 'woocommerce_email_footer' );
4
  *
5
  * @author Claudio_Sanches
6
  * @package WooCommerce_Correios/Templates
7
+ * @version 3.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
12
  }
13
  ?>
14
 
15
+ <?php do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
16
 
17
  <?php echo wptexturize( wpautop( $tracking_message ) ); ?>
18
 
19
  <p><?php esc_html_e( 'For your reference, your order details are shown below.', 'woocommerce-correios' ); ?></p>
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  <?php
22
+ /**
23
+ * @hooked WC_Emails::order_details() Shows the order details table.
24
+ * @hooked WC_Structured_Data::generate_order_data() Generates structured data.
25
+ * @hooked WC_Structured_Data::output_structured_data() Outputs structured data.
26
+ */
27
+ do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );
28
 
29
  /**
30
  * Order meta.
31
  *
32
  * @hooked WC_Emails::order_meta() Shows order meta data.
33
  */
34
+ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );
35
 
36
  /**
37
  * Customer details.
39
  * @hooked WC_Emails::customer_details() Shows customer details
40
  * @hooked WC_Emails::email_address() Shows email address
41
  */
42
+ do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
43
 
44
  /**
45
  * Email footer.
46
  *
47
  * @hooked WC_Emails::email_footer() Output the email footer.
48
  */
49
+ do_action( 'woocommerce_email_footer', $email );
templates/emails/plain/correios-tracking-code.php CHANGED
@@ -4,14 +4,14 @@
4
  *
5
  * @author Claudio_Sanches
6
  * @package WooCommerce_Correios/Templates
7
- * @version 3.0.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
11
  exit;
12
  }
13
 
14
- echo '= ' . $email_heading . " =\n\n";
15
 
16
  echo wptexturize( $tracking_message ) . "\n\n";
17
 
@@ -19,49 +19,26 @@ echo __( 'For your reference, your order details are shown below.', 'woocommerce
19
 
20
  echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
21
 
22
- do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text );
23
-
24
- printf( __( 'Order number: %s', 'woocommerce-correios' ), $order->get_order_number() ) . "\n";
25
- printf( __( 'Order date: %s', 'woocommerce-correios' ), date_i18n( wc_date_format(), strtotime( $order->order_date ) ) ) . "\n";
26
-
27
- do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );
28
-
29
- if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.5', '>=' ) ) {
30
- $order_items = $order->email_order_items_table( array(
31
- 'plain_text' => true,
32
- ) );
33
- } else {
34
- $order_items = $order->email_order_items_table( true, false, true, '', '', true );
35
- }
36
-
37
- echo "\n" . $order_items;
38
-
39
- echo "----------\n\n";
40
-
41
- if ( $totals = $order->get_order_item_totals() ) {
42
- foreach ( $totals as $total ) {
43
- echo $total['label'] . "\t " . $total['value'] . "\n";
44
- }
45
- }
46
-
47
- do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text );
48
 
49
  echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
50
 
51
  /**
52
- * Order meta.
53
- *
54
  * @hooked WC_Emails::order_meta() Shows order meta data.
55
  */
56
- do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text );
57
 
58
  /**
59
- * Customer details.
60
- *
61
- * @hooked WC_Emails::customer_details() Shows customer details.
62
- * @hooked WC_Emails::email_address() Shows email address.
63
  */
64
- do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text );
65
 
66
  echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
67
 
4
  *
5
  * @author Claudio_Sanches
6
  * @package WooCommerce_Correios/Templates
7
+ * @version 3.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
11
  exit;
12
  }
13
 
14
+ echo "= " . $email_heading . " =\n\n";
15
 
16
  echo wptexturize( $tracking_message ) . "\n\n";
17
 
19
 
20
  echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
21
 
22
+ /**
23
+ * @hooked WC_Emails::order_details() Shows the order details table.
24
+ * @hooked WC_Structured_Data::generate_order_data() Generates structured data.
25
+ * @hooked WC_Structured_Data::output_structured_data() Outputs structured data.
26
+ * @since 2.5.0
27
+ */
28
+ do_action( 'woocommerce_email_order_details', $order, $sent_to_admin, $plain_text, $email );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
31
 
32
  /**
 
 
33
  * @hooked WC_Emails::order_meta() Shows order meta data.
34
  */
35
+ do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );
36
 
37
  /**
38
+ * @hooked WC_Emails::customer_details() Shows customer details
39
+ * @hooked WC_Emails::email_address() Shows email address
 
 
40
  */
41
+ do_action( 'woocommerce_email_customer_details', $order, $sent_to_admin, $plain_text, $email );
42
 
43
  echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
44
 
templates/myaccount/tracking-code.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
- /**
3
- * Tracking code.
4
- *
5
- * @author Claudio_Sanches
6
- * @package WooCommerce_Correios/Templates
7
- * @version 2.2.0
8
- */
9
-
10
- if ( ! defined( 'ABSPATH' ) ) {
11
- exit;
12
- }
13
- ?>
14
-
15
- <div id="wc-correios-tracking" class="woocommerce-info">
16
- <strong><?php esc_html_e( 'Correios', 'woocommerce-correios' ); ?>:</strong> <?php esc_html_e( 'Your the tracking code:', 'woocommerce-correios' ); ?> <a href="http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=<?php echo esc_attr( $code ); ?>" target="_blank"><?php echo esc_html( $code ) ?></a>.
17
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/myaccount/tracking-codes.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tracking codes.
4
+ *
5
+ * @author Claudio_Sanches
6
+ * @package WooCommerce_Correios/Templates
7
+ * @version 3.2.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+ ?>
14
+
15
+ <p class="wc-correios-tracking__description"><?php echo esc_html( _n( 'Tracking code:', 'Tracking codes:', count( $codes ), 'woocommerce-correios' ) ); ?></p>
16
+
17
+ <ul class="wc-correios-tracking__list">
18
+ <?php foreach ( $codes as $code ) : ?>
19
+ <li><a href="http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=<?php echo esc_attr( $code ); ?>" target="_blank"><?php echo esc_html( $code ) ?></a></li>
20
+ <?php endforeach; ?>
21
+ </ul>
templates/myaccount/tracking-history-table.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * @author Claudio_Sanches
6
  * @package WooCommerce_Correios/Templates
7
- * @version 2.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
@@ -12,11 +12,9 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  }
13
  ?>
14
 
15
- <h2 id="wc-correios-tracking"><?php esc_html_e( 'Correios Delivery History', 'woocommerce-correios' ); ?></h2>
16
 
17
- <p><?php esc_html_e( 'History for the tracking code:', 'woocommerce-correios' ); ?> <a href="http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=<?php echo esc_attr( $code ); ?>" target="_blank"><?php echo esc_html( $code ) ?></a>.</p>
18
-
19
- <table class="shop_table shop_table_responsive">
20
  <tr>
21
  <th><?php esc_html_e( 'Date', 'woocommerce-correios' ); ?></th>
22
  <th><?php esc_html_e( 'Location', 'woocommerce-correios' ); ?></th>
4
  *
5
  * @author Claudio_Sanches
6
  * @package WooCommerce_Correios/Templates
7
+ * @version 3.2.0
8
  */
9
 
10
  if ( ! defined( 'ABSPATH' ) ) {
12
  }
13
  ?>
14
 
15
+ <p class="wc-correios-tracking__description"><?php esc_html_e( 'History for the tracking code:', 'woocommerce-correios' ); ?> <a href="http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=<?php echo esc_attr( $code ); ?>" target="_blank"><?php echo esc_html( $code ) ?></a></p>
16
 
17
+ <table class="wc-correios-tracking__table woocommerce-table shop_table shop_table_responsive">
 
 
18
  <tr>
19
  <th><?php esc_html_e( 'Date', 'woocommerce-correios' ); ?></th>
20
  <th><?php esc_html_e( 'Location', 'woocommerce-correios' ); ?></th>
templates/myaccount/tracking-title.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Tracking title.
4
+ *
5
+ * @author Claudio_Sanches
6
+ * @package WooCommerce_Correios/Templates
7
+ * @version 3.2.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+ ?>
14
+
15
+ <h2 id="#wc-correios-tracking" class="wc-correios-tracking__title"><?php esc_html_e( 'Correios Delivery History', 'woocommerce-correios' ); ?></h2>
wc-correios.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- /**
3
- * Update main file for legacy from installations.
4
- *
5
- * @package WooCommerce_Correios
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- // Update the main file.
13
- $active_plugins = get_option( 'active_plugins', array() );
14
-
15
- foreach ( $active_plugins as $key => $active_plugin ) {
16
- if ( strstr( $active_plugin, '/wc-correios.php' ) ) {
17
- $active_plugins[ $key ] = str_replace( '/wc-correios.php', '/woocommerce-correios.php', $active_plugin );
18
- }
19
- }
20
-
21
- update_option( 'active_plugins', $active_plugins );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.7
9
  * License: GPLv2 or later
10
  * Text Domain: woocommerce-correios
11
  * Domain Path: /languages
@@ -43,7 +43,7 @@ if ( ! class_exists( 'WC_Correios' ) ) :
43
  *
44
  * @var string
45
  */
46
- const VERSION = '3.1.7';
47
 
48
  /**
49
  * Instance of this class.
@@ -122,7 +122,7 @@ if ( ! class_exists( 'WC_Correios' ) ) :
122
  }
123
 
124
  // Update settings to 3.0.0 when using WooCommerce 2.6.0.
125
- WC_Correios_Install::upgrade_300_to_wc_260();
126
  } else {
127
  include_once dirname( __FILE__ ) . '/includes/shipping/class-wc-correios-shipping-legacy.php';
128
  }
5
  * Description: Adds Correios shipping methods to your WooCommerce store.
6
  * Author: Claudio Sanches
7
  * Author URI: https://claudiosmweb.com
8
+ * Version: 3.2.0
9
  * License: GPLv2 or later
10
  * Text Domain: woocommerce-correios
11
  * Domain Path: /languages
43
  *
44
  * @var string
45
  */
46
+ const VERSION = '3.2.0';
47
 
48
  /**
49
  * Instance of this class.
122
  }
123
 
124
  // Update settings to 3.0.0 when using WooCommerce 2.6.0.
125
+ WC_Correios_Install::upgrade_300_from_wc_260();
126
  } else {
127
  include_once dirname( __FILE__ ) . '/includes/shipping/class-wc-correios-shipping-legacy.php';
128
  }