Version Description
2017/05/13 =
Adicionado novamente links para os cdigos de rastreamento na detalhes do pedido no admin.
Adicionado novos links com cdigo de rastreamneto na lista de pedidos no admin.
Corrigido cdigos de rastreamento que ainda no foram atualizados na pgina de detalhes do pedido em "Minha conta".
Download this release
Release Info
Developer | claudiosanches |
Plugin | WooCommerce Correios |
Version | 3.4.0 |
Comparing to | |
See all releases |
Code changes from version 3.3.0 to 3.4.0
- assets/js/admin/integration.min.js +1 -1
- assets/js/admin/open-tracking-code.js +42 -0
- assets/js/admin/open-tracking-code.min.js +1 -0
- includes/admin/class-wc-correios-admin-orders.php +45 -1
- includes/admin/views/html-list-table-tracking-code.php +18 -0
- includes/admin/views/html-meta-box-tracking-code.php +1 -1
- includes/class-wc-correios-tracking-history.php +8 -6
- languages/woocommerce-correios.pot +10 -8
- readme.txt +11 -4
- woocommerce-correios.php +2 -2
assets/js/admin/integration.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(a){
|
1 |
+
jQuery(function(a){({init:function(){a(document.body).on("click","#woocommerce_correios-integration_autofill_empty_database",this.empty_database)},empty_database:function(){window.confirm(WCCorreiosIntegrationAdminParams.i18n_confirm_message)&&(a("#mainform").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),a.ajax({type:"POST",url:ajaxurl,data:{action:"correios_autofill_addresses_empty_database",nonce:WCCorreiosIntegrationAdminParams.empty_database_nonce},success:function(b){window.alert(b.data.message),a("#mainform").unblock()}}))}}).init()});
|
assets/js/admin/open-tracking-code.js
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery( function( $ ) {
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Admin class.
|
5 |
+
*
|
6 |
+
* @type {Object}
|
7 |
+
*/
|
8 |
+
var WCCorreiosOpenTrackingCode = {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Initialize actions.
|
12 |
+
*/
|
13 |
+
init: function() {
|
14 |
+
$( document.body )
|
15 |
+
.on( 'click', '.correios-tracking-code a', this.openTrackingLink );
|
16 |
+
},
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Open tracking link into Correios.
|
20 |
+
*
|
21 |
+
* @param {Object} evt Current event.
|
22 |
+
*/
|
23 |
+
openTrackingLink: function( evt ) {
|
24 |
+
evt.preventDefault();
|
25 |
+
|
26 |
+
// Remove old form.
|
27 |
+
$( '#wc-correios-tracking__form' ).remove();
|
28 |
+
|
29 |
+
var code = $( this ).text();
|
30 |
+
var form = '<form id="wc-correios-tracking__form" method="post" action="http://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm" target="_blank" style="display: none;">';
|
31 |
+
form += '<input type="hidden" name="objetos" value="' + code + '" />';
|
32 |
+
form += '</form>';
|
33 |
+
|
34 |
+
$( 'body' ).prepend( form );
|
35 |
+
|
36 |
+
// Submit form.
|
37 |
+
$( '#wc-correios-tracking__form' ).submit();
|
38 |
+
}
|
39 |
+
};
|
40 |
+
|
41 |
+
WCCorreiosOpenTrackingCode.init();
|
42 |
+
});
|
assets/js/admin/open-tracking-code.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(function(a){({init:function(){a(document.body).on("click",".correios-tracking-code a",this.openTrackingLink)},openTrackingLink:function(b){b.preventDefault(),a("#wc-correios-tracking__form").remove();var c=a(this).text(),d='<form id="wc-correios-tracking__form" method="post" action="http://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm" target="_blank" style="display: none;">';d+='<input type="hidden" name="objetos" value="'+c+'" />',d+="</form>",a("body").prepend(d),a("#wc-correios-tracking__form").submit()}}).init()});
|
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.
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -24,6 +24,49 @@ class WC_Correios_Admin_Orders {
|
|
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 |
/**
|
@@ -50,6 +93,7 @@ class WC_Correios_Admin_Orders {
|
|
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',
|
4 |
*
|
5 |
* @package WooCommerce_Correios/Admin/Orders
|
6 |
* @since 3.0.0
|
7 |
+
* @version 3.4.0
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
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 |
+
if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '3.0.0', '>=' ) ) {
|
29 |
+
add_action( 'manage_shop_order_posts_custom_column', array( $this, 'tracking_code_orders_list' ), 100 );
|
30 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'orders_list_scripts' ) );
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Display tracking code into orders list.
|
36 |
+
*
|
37 |
+
* @param string $column Current column.
|
38 |
+
*/
|
39 |
+
public function tracking_code_orders_list( $column ) {
|
40 |
+
global $post, $the_order;
|
41 |
+
|
42 |
+
if ( 'shipping_address' === $column ) {
|
43 |
+
if ( empty( $the_order ) || $the_order->get_id() !== $post->ID ) {
|
44 |
+
$the_order = wc_get_order( $post->ID );
|
45 |
+
}
|
46 |
+
|
47 |
+
$codes = wc_correios_get_tracking_codes( $the_order );
|
48 |
+
if ( ! empty( $codes ) ) {
|
49 |
+
$tracking_codes = array();
|
50 |
+
foreach ( $codes as $code ) {
|
51 |
+
$tracking_codes[] = '<a href="#" aria-label="' . esc_attr__( 'Tracking code', 'woocommerce-correios' ) . '">' . esc_html( $code ) . '</a>';
|
52 |
+
}
|
53 |
+
|
54 |
+
include dirname( __FILE__ ) . '/views/html-list-table-tracking-code.php';
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Load order list scripts.
|
61 |
+
*/
|
62 |
+
public function orders_list_scripts() {
|
63 |
+
$screen = get_current_screen();
|
64 |
+
|
65 |
+
if ( 'edit-shop_order' === $screen->id ) {
|
66 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
67 |
+
|
68 |
+
wp_enqueue_script( 'woocommerce-correios-open-tracking-code', plugins_url( 'assets/js/admin/open-tracking-code' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery' ), WC_Correios::VERSION, true );
|
69 |
+
}
|
70 |
}
|
71 |
|
72 |
/**
|
93 |
|
94 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
95 |
wp_enqueue_style( 'woocommerce-correios-orders-admin', plugins_url( 'assets/css/admin/orders' . $suffix . '.css', WC_Correios::get_main_file() ), array(), WC_Correios::VERSION );
|
96 |
+
wp_enqueue_script( 'woocommerce-correios-open-tracking-code', plugins_url( 'assets/js/admin/open-tracking-code' . $suffix . '.js', WC_Correios::get_main_file() ), array( 'jquery' ), WC_Correios::VERSION, true );
|
97 |
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 );
|
98 |
wp_localize_script(
|
99 |
'woocommerce-correios-orders-admin',
|
includes/admin/views/html-list-table-tracking-code.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* List table - 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 |
+
<small class="meta">
|
15 |
+
<?php echo esc_html( _n( 'Tracking code:', 'Tracking codes:', count( $tracking_codes ), 'woocommerce-correios' ) ); ?>
|
16 |
+
<?php echo implode( ' | ', $tracking_codes ); ?>
|
17 |
+
</small>
|
18 |
+
</div>
|
includes/admin/views/html-meta-box-tracking-code.php
CHANGED
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
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><
|
20 |
<?php endforeach; ?>
|
21 |
</ul>
|
22 |
</div>
|
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="#" aria-label="<?php esc_attr_e( 'Tracking code', 'woocommerce-correios' ); ?>"><?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>
|
includes/class-wc-correios-tracking-history.php
CHANGED
@@ -96,14 +96,15 @@ class WC_Correios_Tracking_History {
|
|
96 |
$objects = (array) $response->return->objeto;
|
97 |
|
98 |
// Fix when return only last event for each object.
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
|
|
104 |
}
|
105 |
-
$objects = $new_objects;
|
106 |
}
|
|
|
107 |
|
108 |
// Handle single object.
|
109 |
} elseif ( is_object( $response->return->objeto ) ) {
|
@@ -115,6 +116,7 @@ class WC_Correios_Tracking_History {
|
|
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 |
}
|
96 |
$objects = (array) $response->return->objeto;
|
97 |
|
98 |
// Fix when return only last event for each object.
|
99 |
+
$_objects = array();
|
100 |
+
foreach ( $objects as $key => $object ) {
|
101 |
+
$_objects[ $key ] = $object;
|
102 |
+
|
103 |
+
if ( is_object( $object->evento ) ) {
|
104 |
+
$_objects[ $key ]->evento = array( $_objects[ $key ]->evento );
|
105 |
}
|
|
|
106 |
}
|
107 |
+
$objects = $_objects;
|
108 |
|
109 |
// Handle single object.
|
110 |
} elseif ( is_object( $response->return->objeto ) ) {
|
116 |
}
|
117 |
}
|
118 |
}
|
119 |
+
|
120 |
} catch ( Exception $e ) {
|
121 |
$this->logger( sprintf( 'An error occurred while trying to fetch the tracking history for "%s": %s', implode( ', ', $tracking_codes ), $e->getMessage() ) );
|
122 |
}
|
languages/woocommerce-correios.pot
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
# This file is distributed under the GPLv2 or later.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WooCommerce Correios 3.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-correios\n"
|
8 |
-
"POT-Creation-Date: 2017-05-
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -397,7 +397,13 @@ msgstr ""
|
|
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:
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
msgid "Are you sure you want to remove this tracking code?"
|
402 |
msgstr ""
|
403 |
|
@@ -435,6 +441,7 @@ msgstr ""
|
|
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:37
|
440 |
#: templates/myaccount/tracking-codes.php:15
|
@@ -443,11 +450,6 @@ 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 "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"
|
2 |
# This file is distributed under the GPLv2 or later.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce Correios 3.4.0\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/woocommerce-correios\n"
|
8 |
+
"POT-Creation-Date: 2017-05-13 20:38:04+00:00\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
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:51
|
401 |
+
#: includes/admin/views/html-meta-box-tracking-code.php:19
|
402 |
+
#: includes/admin/views/html-meta-box-tracking-code.php:41
|
403 |
+
msgid "Tracking code"
|
404 |
+
msgstr ""
|
405 |
+
|
406 |
+
#: includes/admin/class-wc-correios-admin-orders.php:104
|
407 |
msgid "Are you sure you want to remove this tracking code?"
|
408 |
msgstr ""
|
409 |
|
441 |
msgid "More about %s."
|
442 |
msgstr ""
|
443 |
|
444 |
+
#: includes/admin/views/html-list-table-tracking-code.php:15
|
445 |
#: includes/admin/views/html-meta-box-tracking-code.php:16
|
446 |
#: includes/admin/views/html-meta-box-tracking-code.php:37
|
447 |
#: templates/myaccount/tracking-codes.php:15
|
450 |
msgstr[0] ""
|
451 |
msgstr[1] ""
|
452 |
|
|
|
|
|
|
|
|
|
|
|
453 |
#: includes/admin/views/html-meta-box-tracking-code.php:19
|
454 |
#: includes/admin/views/html-meta-box-tracking-code.php:41
|
455 |
msgid "Remove tracking code"
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -203,6 +203,12 @@ Em caso de dúvidas, basta abrir um tópico no [fórum de suporte do plugin](htt
|
|
203 |
|
204 |
== Changelog ==
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
= 3.3.0 - 2017/05/05 =
|
207 |
|
208 |
- Atualizados os códigos do PAC e Sedex.
|
@@ -306,7 +312,8 @@ Em caso de dúvidas, basta abrir um tópico no [fórum de suporte do plugin](htt
|
|
306 |
|
307 |
== Upgrade Notice ==
|
308 |
|
309 |
-
= 3.
|
310 |
|
311 |
-
-
|
312 |
-
-
|
|
4 |
Tags: shipping, delivery, woocommerce, correios
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.7
|
7 |
+
Stable tag: 3.4.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
203 |
|
204 |
== Changelog ==
|
205 |
|
206 |
+
= 3.4.0 - 2017/05/13 =
|
207 |
+
|
208 |
+
- Adicionado novamente links para os códigos de rastreamento na detalhes do pedido no admin.
|
209 |
+
- Adicionado novos links com código de rastreamneto na lista de pedidos no admin.
|
210 |
+
- Corrigido códigos de rastreamento que ainda não foram atualizados na página de detalhes do pedido em "Minha conta".
|
211 |
+
|
212 |
= 3.3.0 - 2017/05/05 =
|
213 |
|
214 |
- Atualizados os códigos do PAC e Sedex.
|
312 |
|
313 |
== Upgrade Notice ==
|
314 |
|
315 |
+
= 3.4.0 =
|
316 |
|
317 |
+
- Adicionado novamente links para os códigos de rastreamento na detalhes do pedido no admin.
|
318 |
+
- Adicionado novos links com código de rastreamneto na lista de pedidos no admin.
|
319 |
+
- Corrigido códigos de rastreamento que ainda não foram atualizados na página de detalhes do pedido em "Minha conta".
|
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.
|
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.
|
47 |
|
48 |
/**
|
49 |
* Instance of this class.
|
5 |
* Description: Adds Correios shipping methods to your WooCommerce store.
|
6 |
* Author: Claudio Sanches
|
7 |
* Author URI: https://claudiosmweb.com
|
8 |
+
* Version: 3.4.0
|
9 |
* License: GPLv2 or later
|
10 |
* Text Domain: woocommerce-correios
|
11 |
* Domain Path: /languages
|
43 |
*
|
44 |
* @var string
|
45 |
*/
|
46 |
+
const VERSION = '3.4.0';
|
47 |
|
48 |
/**
|
49 |
* Instance of this class.
|