Version Description
2016/06/28 =
Adicionado novo mtodo de Carta Registrada seguindo a tabela dos Correios e com suporte a classes de entrega.
Download this release
Release Info
| Developer | claudiosanches |
| Plugin | |
| Version | 3.0.2 |
| Comparing to | |
| See all releases | |
Code changes from version 3.0.1 to 3.0.2
- includes/abstracts/abstract-wc-correios-international-shipping.php +81 -86
- includes/abstracts/abstract-wc-correios-shipping.php +158 -172
- includes/shipping/class-wc-correios-shipping-carta-registrada.php +312 -11
- languages/woocommerce-correios.pot +109 -77
- readme.txt +8 -3
- woocommerce-correios.php +2 -2
includes/abstracts/abstract-wc-correios-international-shipping.php
CHANGED
|
@@ -44,11 +44,6 @@ abstract class WC_Correios_International_Shipping extends WC_Correios_Shipping {
|
|
| 44 |
$this->automatic_insurance = $this->get_option( 'automatic_insurance' );
|
| 45 |
$this->debug = $this->get_option( 'debug' );
|
| 46 |
|
| 47 |
-
// Active logs.
|
| 48 |
-
if ( 'yes' == $this->debug ) {
|
| 49 |
-
$this->log = new WC_Logger();
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
// Save admin options.
|
| 53 |
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
|
| 54 |
}
|
|
@@ -57,88 +52,88 @@ abstract class WC_Correios_International_Shipping extends WC_Correios_Shipping {
|
|
| 57 |
* Admin options fields.
|
| 58 |
*/
|
| 59 |
public function init_form_fields() {
|
| 60 |
-
$this->instance_form_fields = array(
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
),
|
| 100 |
-
);
|
| 101 |
-
$this->instance_form_fields['show_delivery_time'] = array(
|
| 102 |
-
'title' => __( 'Delivery Time', 'woocommerce-correios' ),
|
| 103 |
-
'type' => 'checkbox',
|
| 104 |
-
'label' => __( 'Show estimated delivery time', 'woocommerce-correios' ),
|
| 105 |
-
'description' => __( 'Display the estimated delivery time in working days.', 'woocommerce-correios' ),
|
| 106 |
-
'desc_tip' => true,
|
| 107 |
-
'default' => 'no',
|
| 108 |
-
);
|
| 109 |
-
$this->instance_form_fields['fee'] = array(
|
| 110 |
-
'title' => __( 'Handling Fee', 'woocommerce-correios' ),
|
| 111 |
-
'type' => 'price',
|
| 112 |
-
'description' => __( 'Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woocommerce-correios' ),
|
| 113 |
-
'desc_tip' => true,
|
| 114 |
-
'placeholder' => '0.00',
|
| 115 |
-
'default' => '',
|
| 116 |
-
);
|
| 117 |
-
$this->instance_form_fields['optional_services'] = array(
|
| 118 |
-
'title' => __( 'Optional Services', 'woocommerce-correios' ),
|
| 119 |
-
'type' => 'title',
|
| 120 |
-
'description' => __( 'Use these options to add the value of each service provided by the Correios.', 'woocommerce-correios' ),
|
| 121 |
-
'default' => '',
|
| 122 |
-
);
|
| 123 |
-
$this->instance_form_fields['automatic_insurance'] = array(
|
| 124 |
-
'title' => __( 'Automatic Insurance', 'woocommerce-correios' ),
|
| 125 |
-
'type' => 'checkbox',
|
| 126 |
-
'label' => __( 'Enable automatic insurance', 'woocommerce-correios' ),
|
| 127 |
-
'description' => __( 'This controls if need to apply insurance to the order.', 'woocommerce-correios' ),
|
| 128 |
-
'desc_tip' => true,
|
| 129 |
-
'default' => 'yes',
|
| 130 |
-
);
|
| 131 |
-
$this->instance_form_fields['testing'] = array(
|
| 132 |
-
'title' => __( 'Testing', 'woocommerce-correios' ),
|
| 133 |
-
'type' => 'title',
|
| 134 |
-
'default' => '',
|
| 135 |
-
);
|
| 136 |
-
$this->instance_form_fields['debug'] = array(
|
| 137 |
-
'title' => __( 'Debug Log', 'woocommerce-correios' ),
|
| 138 |
-
'type' => 'checkbox',
|
| 139 |
-
'label' => __( 'Enable logging', 'woocommerce-correios' ),
|
| 140 |
-
'default' => 'no',
|
| 141 |
-
'description' => sprintf( __( 'Log %s events, such as WebServices requests.', 'woocommerce-correios' ), $this->method_title ) . $this->get_log_link(),
|
| 142 |
);
|
| 143 |
}
|
| 144 |
|
| 44 |
$this->automatic_insurance = $this->get_option( 'automatic_insurance' );
|
| 45 |
$this->debug = $this->get_option( 'debug' );
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
// Save admin options.
|
| 48 |
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
|
| 49 |
}
|
| 52 |
* Admin options fields.
|
| 53 |
*/
|
| 54 |
public function init_form_fields() {
|
| 55 |
+
$this->instance_form_fields = array(
|
| 56 |
+
'enabled' => array(
|
| 57 |
+
'title' => __( 'Enable/Disable', 'woocommerce-correios' ),
|
| 58 |
+
'type' => 'checkbox',
|
| 59 |
+
'label' => __( 'Enable this shipping method', 'woocommerce-correios' ),
|
| 60 |
+
'default' => 'yes',
|
| 61 |
+
),
|
| 62 |
+
'title' => array(
|
| 63 |
+
'title' => __( 'Title', 'woocommerce-correios' ),
|
| 64 |
+
'type' => 'text',
|
| 65 |
+
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-correios' ),
|
| 66 |
+
'desc_tip' => true,
|
| 67 |
+
'default' => $this->method_title,
|
| 68 |
+
),
|
| 69 |
+
'behavior_options' => array(
|
| 70 |
+
'title' => __( 'Behavior Options', 'woocommerce-correios' ),
|
| 71 |
+
'type' => 'title',
|
| 72 |
+
'default' => '',
|
| 73 |
+
),
|
| 74 |
+
'origin_state' => array(
|
| 75 |
+
'title' => __( 'Origin State', 'woocommerce-correios' ),
|
| 76 |
+
'type' => 'select',
|
| 77 |
+
'description' => __( 'The UF of the location your packages are delivered from.', 'woocommerce-correios' ),
|
| 78 |
+
'desc_tip' => true,
|
| 79 |
+
'default' => '',
|
| 80 |
+
'class' => 'wc-enhanced-select',
|
| 81 |
+
'options' => WC()->countries->get_states( 'BR' ),
|
| 82 |
+
),
|
| 83 |
+
'origin_location' => array(
|
| 84 |
+
'title' => __( 'Origin Locale', 'woocommerce-correios' ),
|
| 85 |
+
'type' => 'select',
|
| 86 |
+
'description' => __( 'The location of your packages are delivered from.', 'woocommerce-correios' ),
|
| 87 |
+
'desc_tip' => true,
|
| 88 |
+
'default' => 'C',
|
| 89 |
+
'class' => 'wc-enhanced-select',
|
| 90 |
+
'options' => array(
|
| 91 |
+
'C' => __( 'Capital', 'woocommerce-correios' ),
|
| 92 |
+
'I' => __( 'Interior', 'woocommerce-correios' ),
|
| 93 |
+
),
|
| 94 |
+
),
|
| 95 |
+
'show_delivery_time' => array(
|
| 96 |
+
'title' => __( 'Delivery Time', 'woocommerce-correios' ),
|
| 97 |
+
'type' => 'checkbox',
|
| 98 |
+
'label' => __( 'Show estimated delivery time', 'woocommerce-correios' ),
|
| 99 |
+
'description' => __( 'Display the estimated delivery time in working days.', 'woocommerce-correios' ),
|
| 100 |
+
'desc_tip' => true,
|
| 101 |
+
'default' => 'no',
|
| 102 |
+
),
|
| 103 |
+
'fee' => array(
|
| 104 |
+
'title' => __( 'Handling Fee', 'woocommerce-correios' ),
|
| 105 |
+
'type' => 'price',
|
| 106 |
+
'description' => __( 'Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woocommerce-correios' ),
|
| 107 |
+
'desc_tip' => true,
|
| 108 |
+
'placeholder' => '0.00',
|
| 109 |
+
'default' => '',
|
| 110 |
+
),
|
| 111 |
+
'optional_services' => array(
|
| 112 |
+
'title' => __( 'Optional Services', 'woocommerce-correios' ),
|
| 113 |
+
'type' => 'title',
|
| 114 |
+
'description' => __( 'Use these options to add the value of each service provided by the Correios.', 'woocommerce-correios' ),
|
| 115 |
+
'default' => '',
|
| 116 |
+
),
|
| 117 |
+
'automatic_insurance' => array(
|
| 118 |
+
'title' => __( 'Automatic Insurance', 'woocommerce-correios' ),
|
| 119 |
+
'type' => 'checkbox',
|
| 120 |
+
'label' => __( 'Enable automatic insurance', 'woocommerce-correios' ),
|
| 121 |
+
'description' => __( 'This controls if need to apply insurance to the order.', 'woocommerce-correios' ),
|
| 122 |
+
'desc_tip' => true,
|
| 123 |
+
'default' => 'yes',
|
| 124 |
+
),
|
| 125 |
+
'testing' => array(
|
| 126 |
+
'title' => __( 'Testing', 'woocommerce-correios' ),
|
| 127 |
+
'type' => 'title',
|
| 128 |
+
'default' => '',
|
| 129 |
+
),
|
| 130 |
+
'debug' => array(
|
| 131 |
+
'title' => __( 'Debug Log', 'woocommerce-correios' ),
|
| 132 |
+
'type' => 'checkbox',
|
| 133 |
+
'label' => __( 'Enable logging', 'woocommerce-correios' ),
|
| 134 |
+
'default' => 'no',
|
| 135 |
+
'description' => sprintf( __( 'Log %s events, such as WebServices requests.', 'woocommerce-correios' ), $this->method_title ) . $this->get_log_link(),
|
| 136 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
);
|
| 138 |
}
|
| 139 |
|
includes/abstracts/abstract-wc-correios-shipping.php
CHANGED
|
@@ -67,11 +67,6 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
|
|
| 67 |
$this->minimum_length = $this->get_option( 'minimum_length' );
|
| 68 |
$this->debug = $this->get_option( 'debug' );
|
| 69 |
|
| 70 |
-
// Active logs.
|
| 71 |
-
if ( 'yes' == $this->debug ) {
|
| 72 |
-
$this->log = new WC_Logger();
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
// Save admin options.
|
| 76 |
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
|
| 77 |
}
|
|
@@ -87,178 +82,169 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
|
|
| 87 |
}
|
| 88 |
}
|
| 89 |
|
| 90 |
-
/**
|
| 91 |
-
* Get behavior options.
|
| 92 |
-
*
|
| 93 |
-
* @return array
|
| 94 |
-
*/
|
| 95 |
-
protected function get_behavior_options() {
|
| 96 |
-
return array();
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
/**
|
| 100 |
* Admin options fields.
|
| 101 |
*/
|
| 102 |
public function init_form_fields() {
|
| 103 |
-
$this->instance_form_fields = array(
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
),
|
| 209 |
-
);
|
| 210 |
-
$this->instance_form_fields['login'] = array(
|
| 211 |
-
'title' => __( 'Administrative Code', 'woocommerce-correios' ),
|
| 212 |
-
'type' => 'text',
|
| 213 |
-
'description' => __( 'Your Correios login. It\'s usually your CNPJ.', 'woocommerce-correios' ),
|
| 214 |
-
'desc_tip' => true,
|
| 215 |
-
'default' => '',
|
| 216 |
-
);
|
| 217 |
-
$this->instance_form_fields['password'] = array(
|
| 218 |
-
'title' => __( 'Administrative Password', 'woocommerce-correios' ),
|
| 219 |
-
'type' => 'text',
|
| 220 |
-
'description' => __( 'Your Correios password.', 'woocommerce-correios' ),
|
| 221 |
-
'desc_tip' => true,
|
| 222 |
-
'default' => '',
|
| 223 |
-
);
|
| 224 |
-
$this->instance_form_fields['package_standard'] = array(
|
| 225 |
-
'title' => __( 'Package Standard', 'woocommerce-correios' ),
|
| 226 |
-
'type' => 'title',
|
| 227 |
-
'description' => __( 'Minimum measure for your shipping packages.', 'woocommerce-correios' ),
|
| 228 |
-
'default' => '',
|
| 229 |
-
);
|
| 230 |
-
$this->instance_form_fields['minimum_height'] = array(
|
| 231 |
-
'title' => __( 'Minimum Height', 'woocommerce-correios' ),
|
| 232 |
-
'type' => 'text',
|
| 233 |
-
'description' => __( 'Minimum height of your shipping packages. Correios needs at least 2cm.', 'woocommerce-correios' ),
|
| 234 |
-
'desc_tip' => true,
|
| 235 |
-
'default' => '2',
|
| 236 |
-
);
|
| 237 |
-
$this->instance_form_fields['minimum_width'] = array(
|
| 238 |
-
'title' => __( 'Minimum Width', 'woocommerce-correios' ),
|
| 239 |
-
'type' => 'text',
|
| 240 |
-
'description' => __( 'Minimum width of your shipping packages. Correios needs at least 11cm.', 'woocommerce-correios' ),
|
| 241 |
-
'desc_tip' => true,
|
| 242 |
-
'default' => '11',
|
| 243 |
-
);
|
| 244 |
-
$this->instance_form_fields['minimum_length'] = array(
|
| 245 |
-
'title' => __( 'Minimum Length', 'woocommerce-correios' ),
|
| 246 |
-
'type' => 'text',
|
| 247 |
-
'description' => __( 'Minimum length of your shipping packages. Correios needs at least 16cm.', 'woocommerce-correios' ),
|
| 248 |
-
'desc_tip' => true,
|
| 249 |
-
'default' => '16',
|
| 250 |
-
);
|
| 251 |
-
$this->instance_form_fields['testing'] = array(
|
| 252 |
-
'title' => __( 'Testing', 'woocommerce-correios' ),
|
| 253 |
-
'type' => 'title',
|
| 254 |
-
'default' => '',
|
| 255 |
-
);
|
| 256 |
-
$this->instance_form_fields['debug'] = array(
|
| 257 |
-
'title' => __( 'Debug Log', 'woocommerce-correios' ),
|
| 258 |
-
'type' => 'checkbox',
|
| 259 |
-
'label' => __( 'Enable logging', 'woocommerce-correios' ),
|
| 260 |
-
'default' => 'no',
|
| 261 |
-
'description' => sprintf( __( 'Log %s events, such as WebServices requests.', 'woocommerce-correios' ), $this->method_title ) . $this->get_log_link(),
|
| 262 |
);
|
| 263 |
}
|
| 264 |
|
| 67 |
$this->minimum_length = $this->get_option( 'minimum_length' );
|
| 68 |
$this->debug = $this->get_option( 'debug' );
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
// Save admin options.
|
| 71 |
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
|
| 72 |
}
|
| 82 |
}
|
| 83 |
}
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
/**
|
| 86 |
* Admin options fields.
|
| 87 |
*/
|
| 88 |
public function init_form_fields() {
|
| 89 |
+
$this->instance_form_fields = array(
|
| 90 |
+
'enabled' => array(
|
| 91 |
+
'title' => __( 'Enable/Disable', 'woocommerce-correios' ),
|
| 92 |
+
'type' => 'checkbox',
|
| 93 |
+
'label' => __( 'Enable this shipping method', 'woocommerce-correios' ),
|
| 94 |
+
'default' => 'yes',
|
| 95 |
+
),
|
| 96 |
+
'title' => array(
|
| 97 |
+
'title' => __( 'Title', 'woocommerce-correios' ),
|
| 98 |
+
'type' => 'text',
|
| 99 |
+
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-correios' ),
|
| 100 |
+
'desc_tip' => true,
|
| 101 |
+
'default' => $this->method_title,
|
| 102 |
+
),
|
| 103 |
+
'behavior_options' => array(
|
| 104 |
+
'title' => __( 'Behavior Options', 'woocommerce-correios' ),
|
| 105 |
+
'type' => 'title',
|
| 106 |
+
'default' => '',
|
| 107 |
+
),
|
| 108 |
+
'origin_postcode' => array(
|
| 109 |
+
'title' => __( 'Origin Postcode', 'woocommerce-correios' ),
|
| 110 |
+
'type' => 'text',
|
| 111 |
+
'description' => __( 'The postcode of the location your packages are delivered from.', 'woocommerce-correios' ),
|
| 112 |
+
'desc_tip' => true,
|
| 113 |
+
'placeholder' => '00000-000',
|
| 114 |
+
'default' => '',
|
| 115 |
+
),
|
| 116 |
+
'show_delivery_time' => array(
|
| 117 |
+
'title' => __( 'Delivery Time', 'woocommerce-correios' ),
|
| 118 |
+
'type' => 'checkbox',
|
| 119 |
+
'label' => __( 'Show estimated delivery time', 'woocommerce-correios' ),
|
| 120 |
+
'description' => __( 'Display the estimated delivery time in working days.', 'woocommerce-correios' ),
|
| 121 |
+
'desc_tip' => true,
|
| 122 |
+
'default' => 'no',
|
| 123 |
+
),
|
| 124 |
+
'additional_time' => array(
|
| 125 |
+
'title' => __( 'Additional Days', 'woocommerce-correios' ),
|
| 126 |
+
'type' => 'text',
|
| 127 |
+
'description' => __( 'Additional working days to the estimated delivery.', 'woocommerce-correios' ),
|
| 128 |
+
'desc_tip' => true,
|
| 129 |
+
'default' => '0',
|
| 130 |
+
'placeholder' => '0',
|
| 131 |
+
),
|
| 132 |
+
'fee' => array(
|
| 133 |
+
'title' => __( 'Handling Fee', 'woocommerce-correios' ),
|
| 134 |
+
'type' => 'price',
|
| 135 |
+
'description' => __( 'Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woocommerce-correios' ),
|
| 136 |
+
'desc_tip' => true,
|
| 137 |
+
'placeholder' => '0.00',
|
| 138 |
+
'default' => '',
|
| 139 |
+
),
|
| 140 |
+
'optional_services' => array(
|
| 141 |
+
'title' => __( 'Optional Services', 'woocommerce-correios' ),
|
| 142 |
+
'type' => 'title',
|
| 143 |
+
'description' => __( 'Use these options to add the value of each service provided by the Correios.', 'woocommerce-correios' ),
|
| 144 |
+
'default' => '',
|
| 145 |
+
),
|
| 146 |
+
'receipt_notice' => array(
|
| 147 |
+
'title' => __( 'Receipt Notice', 'woocommerce-correios' ),
|
| 148 |
+
'type' => 'checkbox',
|
| 149 |
+
'label' => __( 'Enable receipt notice', 'woocommerce-correios' ),
|
| 150 |
+
'description' => __( 'This controls whether to add costs of the receipt notice service.', 'woocommerce-correios' ),
|
| 151 |
+
'desc_tip' => true,
|
| 152 |
+
'default' => 'no',
|
| 153 |
+
),
|
| 154 |
+
'own_hands' => array(
|
| 155 |
+
'title' => __( 'Own Hands', 'woocommerce-correios' ),
|
| 156 |
+
'type' => 'checkbox',
|
| 157 |
+
'label' => __( 'Enable own hands', 'woocommerce-correios' ),
|
| 158 |
+
'description' => __( 'This controls whether to add costs of the own hands service', 'woocommerce-correios' ),
|
| 159 |
+
'desc_tip' => true,
|
| 160 |
+
'default' => 'no',
|
| 161 |
+
),
|
| 162 |
+
'declare_value' => array(
|
| 163 |
+
'title' => __( 'Declare Value for Insurance', 'woocommerce-correios' ),
|
| 164 |
+
'type' => 'checkbox',
|
| 165 |
+
'label' => __( 'Enable declared value', 'woocommerce-correios' ),
|
| 166 |
+
'description' => __( 'This controls if the price of the package must be declared for insurance purposes.', 'woocommerce-correios' ),
|
| 167 |
+
'desc_tip' => true,
|
| 168 |
+
'default' => 'yes',
|
| 169 |
+
),
|
| 170 |
+
'service_options' => array(
|
| 171 |
+
'title' => __( 'Service Options', 'woocommerce-correios' ),
|
| 172 |
+
'type' => 'title',
|
| 173 |
+
'default' => '',
|
| 174 |
+
),
|
| 175 |
+
'custom_code' => array(
|
| 176 |
+
'title' => __( 'Service Code', 'woocommerce-correios' ),
|
| 177 |
+
'type' => 'text',
|
| 178 |
+
'description' => __( 'Service code, use this for custom codes.', 'woocommerce-correios' ),
|
| 179 |
+
'desc_tip' => true,
|
| 180 |
+
'placeholder' => $this->code,
|
| 181 |
+
'default' => '',
|
| 182 |
+
),
|
| 183 |
+
'service_type' => array(
|
| 184 |
+
'title' => __( 'Service Type', 'woocommerce-correios' ),
|
| 185 |
+
'type' => 'select',
|
| 186 |
+
'description' => __( 'Choose between conventional or corporate service.', 'woocommerce-correios' ),
|
| 187 |
+
'desc_tip' => true,
|
| 188 |
+
'default' => 'conventional',
|
| 189 |
+
'class' => 'wc-enhanced-select',
|
| 190 |
+
'options' => array(
|
| 191 |
+
'conventional' => __( 'Conventional', 'woocommerce-correios' ),
|
| 192 |
+
'corporate' => __( 'Corporate', 'woocommerce-correios' ),
|
| 193 |
+
),
|
| 194 |
+
),
|
| 195 |
+
'login' => array(
|
| 196 |
+
'title' => __( 'Administrative Code', 'woocommerce-correios' ),
|
| 197 |
+
'type' => 'text',
|
| 198 |
+
'description' => __( 'Your Correios login. It\'s usually your CNPJ.', 'woocommerce-correios' ),
|
| 199 |
+
'desc_tip' => true,
|
| 200 |
+
'default' => '',
|
| 201 |
+
),
|
| 202 |
+
'password' => array(
|
| 203 |
+
'title' => __( 'Administrative Password', 'woocommerce-correios' ),
|
| 204 |
+
'type' => 'text',
|
| 205 |
+
'description' => __( 'Your Correios password.', 'woocommerce-correios' ),
|
| 206 |
+
'desc_tip' => true,
|
| 207 |
+
'default' => '',
|
| 208 |
+
),
|
| 209 |
+
'package_standard' => array(
|
| 210 |
+
'title' => __( 'Package Standard', 'woocommerce-correios' ),
|
| 211 |
+
'type' => 'title',
|
| 212 |
+
'description' => __( 'Minimum measure for your shipping packages.', 'woocommerce-correios' ),
|
| 213 |
+
'default' => '',
|
| 214 |
+
),
|
| 215 |
+
'minimum_height' => array(
|
| 216 |
+
'title' => __( 'Minimum Height', 'woocommerce-correios' ),
|
| 217 |
+
'type' => 'text',
|
| 218 |
+
'description' => __( 'Minimum height of your shipping packages. Correios needs at least 2cm.', 'woocommerce-correios' ),
|
| 219 |
+
'desc_tip' => true,
|
| 220 |
+
'default' => '2',
|
| 221 |
+
),
|
| 222 |
+
'minimum_width' => array(
|
| 223 |
+
'title' => __( 'Minimum Width', 'woocommerce-correios' ),
|
| 224 |
+
'type' => 'text',
|
| 225 |
+
'description' => __( 'Minimum width of your shipping packages. Correios needs at least 11cm.', 'woocommerce-correios' ),
|
| 226 |
+
'desc_tip' => true,
|
| 227 |
+
'default' => '11',
|
| 228 |
+
),
|
| 229 |
+
'minimum_length' => array(
|
| 230 |
+
'title' => __( 'Minimum Length', 'woocommerce-correios' ),
|
| 231 |
+
'type' => 'text',
|
| 232 |
+
'description' => __( 'Minimum length of your shipping packages. Correios needs at least 16cm.', 'woocommerce-correios' ),
|
| 233 |
+
'desc_tip' => true,
|
| 234 |
+
'default' => '16',
|
| 235 |
+
),
|
| 236 |
+
'testing' => array(
|
| 237 |
+
'title' => __( 'Testing', 'woocommerce-correios' ),
|
| 238 |
+
'type' => 'title',
|
| 239 |
+
'default' => '',
|
| 240 |
+
),
|
| 241 |
+
'debug' => array(
|
| 242 |
+
'title' => __( 'Debug Log', 'woocommerce-correios' ),
|
| 243 |
+
'type' => 'checkbox',
|
| 244 |
+
'label' => __( 'Enable logging', 'woocommerce-correios' ),
|
| 245 |
+
'default' => 'no',
|
| 246 |
+
'description' => sprintf( __( 'Log %s events, such as WebServices requests.', 'woocommerce-correios' ), $this->method_title ) . $this->get_log_link(),
|
| 247 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
);
|
| 249 |
}
|
| 250 |
|
includes/shipping/class-wc-correios-shipping-carta-registrada.php
CHANGED
|
@@ -17,23 +17,324 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
| 17 |
class WC_Correios_Shipping_Carta_Registrada extends WC_Correios_Shipping {
|
| 18 |
|
| 19 |
/**
|
| 20 |
-
*
|
| 21 |
-
* 10014 - Carta Registrada.
|
| 22 |
*
|
| 23 |
-
* @
|
| 24 |
*/
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
/**
|
| 28 |
-
*
|
| 29 |
*
|
| 30 |
-
* @
|
| 31 |
*/
|
| 32 |
-
|
| 33 |
-
$
|
| 34 |
-
$
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
|
|
|
| 38 |
}
|
| 39 |
}
|
| 17 |
class WC_Correios_Shipping_Carta_Registrada extends WC_Correios_Shipping {
|
| 18 |
|
| 19 |
/**
|
| 20 |
+
* Initialize Carta Registrada.
|
|
|
|
| 21 |
*
|
| 22 |
+
* @param int $instance_id Shipping zone instance.
|
| 23 |
*/
|
| 24 |
+
public function __construct( $instance_id = 0 ) {
|
| 25 |
+
$this->id = 'correios-carta-registrada';
|
| 26 |
+
$this->instance_id = absint( $instance_id );
|
| 27 |
+
$this->method_title = __( 'Carta Registrada', 'woocommerce-correios' );
|
| 28 |
+
$this->method_description = sprintf( __( '%s is a shipping method from Correios.', 'woocommerce-correios' ), $this->method_title );
|
| 29 |
+
$this->more_link = 'http://www.correios.com.br/para-voce/correios-de-a-a-z/carta-comercial';
|
| 30 |
+
$this->supports = array(
|
| 31 |
+
'shipping-zones',
|
| 32 |
+
'instance-settings',
|
| 33 |
+
);
|
| 34 |
+
|
| 35 |
+
// Load the form fields.
|
| 36 |
+
$this->init_form_fields();
|
| 37 |
+
|
| 38 |
+
// Define user set variables.
|
| 39 |
+
$this->enabled = $this->get_option( 'enabled' );
|
| 40 |
+
$this->title = $this->get_option( 'title' );
|
| 41 |
+
$this->shipping_class = $this->get_option( 'shipping_class' );
|
| 42 |
+
$this->fee = $this->get_option( 'fee' );
|
| 43 |
+
$this->receipt_notice = $this->get_option( 'receipt_notice' );
|
| 44 |
+
$this->own_hands = $this->get_option( 'own_hands' );
|
| 45 |
+
$this->debug = $this->get_option( 'debug' );
|
| 46 |
+
|
| 47 |
+
// Active logs.
|
| 48 |
+
if ( 'yes' == $this->debug ) {
|
| 49 |
+
$this->log = new WC_Logger();
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
// Save admin options.
|
| 53 |
+
add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
|
| 54 |
+
}
|
| 55 |
|
| 56 |
/**
|
| 57 |
+
* Get shipping classes options.
|
| 58 |
*
|
| 59 |
+
* @return array
|
| 60 |
*/
|
| 61 |
+
protected function get_shipping_classes_options() {
|
| 62 |
+
$shipping_classes = WC()->shipping->get_shipping_classes();
|
| 63 |
+
$options = array(
|
| 64 |
+
'' => __( '-- Select a shipping class --', 'woocommerce-correios' ),
|
| 65 |
+
);
|
| 66 |
+
|
| 67 |
+
if ( ! empty( $shipping_classes ) ) {
|
| 68 |
+
$options += wp_list_pluck( $shipping_classes, 'name', 'slug' );
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
return $options;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Admin options fields.
|
| 76 |
+
*/
|
| 77 |
+
public function init_form_fields() {
|
| 78 |
+
$this->instance_form_fields = array(
|
| 79 |
+
'enabled' => array(
|
| 80 |
+
'title' => __( 'Enable/Disable', 'woocommerce-correios' ),
|
| 81 |
+
'type' => 'checkbox',
|
| 82 |
+
'label' => __( 'Enable this shipping method', 'woocommerce-correios' ),
|
| 83 |
+
'default' => 'yes',
|
| 84 |
+
),
|
| 85 |
+
'title' => array(
|
| 86 |
+
'title' => __( 'Title', 'woocommerce-correios' ),
|
| 87 |
+
'type' => 'text',
|
| 88 |
+
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-correios' ),
|
| 89 |
+
'desc_tip' => true,
|
| 90 |
+
'default' => $this->method_title,
|
| 91 |
+
),
|
| 92 |
+
'behavior_options' => array(
|
| 93 |
+
'title' => __( 'Behavior Options', 'woocommerce-correios' ),
|
| 94 |
+
'type' => 'title',
|
| 95 |
+
'default' => '',
|
| 96 |
+
),
|
| 97 |
+
'shipping_class' => array(
|
| 98 |
+
'title' => __( 'Shipping Class', 'woocommerce-correios' ),
|
| 99 |
+
'type' => 'select',
|
| 100 |
+
'description' => __( 'Select for which shipping class this method will be applied.', 'woocommerce-correios' ),
|
| 101 |
+
'desc_tip' => true,
|
| 102 |
+
'default' => '',
|
| 103 |
+
'class' => 'wc-enhanced-select',
|
| 104 |
+
'options' => $this->get_shipping_classes_options(),
|
| 105 |
+
),
|
| 106 |
+
'fee' => array(
|
| 107 |
+
'title' => __( 'Handling Fee', 'woocommerce-correios' ),
|
| 108 |
+
'type' => 'price',
|
| 109 |
+
'description' => __( 'Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woocommerce-correios' ),
|
| 110 |
+
'desc_tip' => true,
|
| 111 |
+
'placeholder' => '0.00',
|
| 112 |
+
'default' => '',
|
| 113 |
+
),
|
| 114 |
+
'optional_services' => array(
|
| 115 |
+
'title' => __( 'Optional Services', 'woocommerce-correios' ),
|
| 116 |
+
'type' => 'title',
|
| 117 |
+
'description' => __( 'Use these options to add the value of each service provided by the Correios.', 'woocommerce-correios' ),
|
| 118 |
+
'default' => '',
|
| 119 |
+
),
|
| 120 |
+
'receipt_notice' => array(
|
| 121 |
+
'title' => __( 'Receipt Notice', 'woocommerce-correios' ),
|
| 122 |
+
'type' => 'checkbox',
|
| 123 |
+
'label' => __( 'Enable receipt notice', 'woocommerce-correios' ),
|
| 124 |
+
'description' => __( 'This controls whether to add costs of the receipt notice service.', 'woocommerce-correios' ),
|
| 125 |
+
'desc_tip' => true,
|
| 126 |
+
'default' => 'no',
|
| 127 |
+
),
|
| 128 |
+
'own_hands' => array(
|
| 129 |
+
'title' => __( 'Own Hands', 'woocommerce-correios' ),
|
| 130 |
+
'type' => 'checkbox',
|
| 131 |
+
'label' => __( 'Enable own hands', 'woocommerce-correios' ),
|
| 132 |
+
'description' => __( 'This controls whether to add costs of the own hands service', 'woocommerce-correios' ),
|
| 133 |
+
'desc_tip' => true,
|
| 134 |
+
'default' => 'no',
|
| 135 |
+
),
|
| 136 |
+
'testing' => array(
|
| 137 |
+
'title' => __( 'Testing', 'woocommerce-correios' ),
|
| 138 |
+
'type' => 'title',
|
| 139 |
+
'default' => '',
|
| 140 |
+
),
|
| 141 |
+
'debug' => array(
|
| 142 |
+
'title' => __( 'Debug Log', 'woocommerce-correios' ),
|
| 143 |
+
'type' => 'checkbox',
|
| 144 |
+
'label' => __( 'Enable logging', 'woocommerce-correios' ),
|
| 145 |
+
'default' => 'no',
|
| 146 |
+
'description' => sprintf( __( 'Log %s events, such as WebServices requests.', 'woocommerce-correios' ), $this->method_title ) . $this->get_log_link(),
|
| 147 |
+
),
|
| 148 |
+
);
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
/**
|
| 152 |
+
* Get costs.
|
| 153 |
+
* Costs based in 14/12/2015 from:
|
| 154 |
+
* http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/carta
|
| 155 |
+
*
|
| 156 |
+
* @return array
|
| 157 |
+
*/
|
| 158 |
+
protected function get_costs() {
|
| 159 |
+
return apply_filters( 'woocommerce_correios_carta_registrada_costs', array(
|
| 160 |
+
'20' => array(
|
| 161 |
+
'R' => '5.40',
|
| 162 |
+
'AR' => '9.30',
|
| 163 |
+
'MP' => '10.40',
|
| 164 |
+
'AR+MP' => '14.30',
|
| 165 |
+
),
|
| 166 |
+
'50' => array(
|
| 167 |
+
'R' => '6.00',
|
| 168 |
+
'AR' => '9.90',
|
| 169 |
+
'MP' => '11.00',
|
| 170 |
+
'AR+MP' => '14.90',
|
| 171 |
+
),
|
| 172 |
+
'100' => array(
|
| 173 |
+
'R' => '6.85',
|
| 174 |
+
'AR' => '10.75',
|
| 175 |
+
'MP' => '11.85',
|
| 176 |
+
'AR+MP' => '15.75',
|
| 177 |
+
),
|
| 178 |
+
'150' => array(
|
| 179 |
+
'R' => '7.50',
|
| 180 |
+
'AR' => '11.40',
|
| 181 |
+
'MP' => '12.50',
|
| 182 |
+
'AR+MP' => '16.40',
|
| 183 |
+
),
|
| 184 |
+
'200' => array(
|
| 185 |
+
'R' => '8.15',
|
| 186 |
+
'AR' => '12.05',
|
| 187 |
+
'MP' => '13.15',
|
| 188 |
+
'AR+MP' => '17.05',
|
| 189 |
+
),
|
| 190 |
+
'250' => array(
|
| 191 |
+
'R' => '8.80',
|
| 192 |
+
'AR' => '12.70',
|
| 193 |
+
'MP' => '13.80',
|
| 194 |
+
'AR+MP' => '17.70',
|
| 195 |
+
),
|
| 196 |
+
'300' => array(
|
| 197 |
+
'R' => '9.50',
|
| 198 |
+
'AR' => '13.40',
|
| 199 |
+
'MP' => '14.50',
|
| 200 |
+
'AR+MP' => '18.40',
|
| 201 |
+
),
|
| 202 |
+
'350' => array(
|
| 203 |
+
'R' => '10.15',
|
| 204 |
+
'AR' => '14.05',
|
| 205 |
+
'MP' => '15.15',
|
| 206 |
+
'AR+MP' => '19.05',
|
| 207 |
+
),
|
| 208 |
+
'400' => array(
|
| 209 |
+
'R' => '10.80',
|
| 210 |
+
'AR' => '14.70',
|
| 211 |
+
'MP' => '15.80',
|
| 212 |
+
'AR+MP' => '19.70',
|
| 213 |
+
),
|
| 214 |
+
'450' => array(
|
| 215 |
+
'R' => '11.45',
|
| 216 |
+
'AR' => '15.35',
|
| 217 |
+
'MP' => '16.45',
|
| 218 |
+
'AR+MP' => '20.35',
|
| 219 |
+
),
|
| 220 |
+
'500' => array(
|
| 221 |
+
'R' => '12.10',
|
| 222 |
+
'AR' => '16.00',
|
| 223 |
+
'MP' => '17.10',
|
| 224 |
+
'AR+MP' => '21.00',
|
| 225 |
+
),
|
| 226 |
+
), $this->id, $this->instance_id );
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
/**
|
| 230 |
+
* Get type of cost.
|
| 231 |
+
*
|
| 232 |
+
* @return string
|
| 233 |
+
*/
|
| 234 |
+
protected function get_type_of_cost() {
|
| 235 |
+
if ( 'yes' === $this->receipt_notice && 'yes' === $this->own_hands ) {
|
| 236 |
+
return 'AR+MP';
|
| 237 |
+
} elseif ( 'yes' === $this->receipt_notice ) {
|
| 238 |
+
return 'AR';
|
| 239 |
+
} elseif ( 'yes' === $this->own_hands ) {
|
| 240 |
+
return 'MP';
|
| 241 |
+
} else {
|
| 242 |
+
return 'R';
|
| 243 |
+
}
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
/**
|
| 247 |
+
* Get shipping cost.
|
| 248 |
+
*
|
| 249 |
+
* @param array $package Order package.
|
| 250 |
+
*
|
| 251 |
+
* @return float
|
| 252 |
+
*/
|
| 253 |
+
protected function get_shipping_cost( $package ) {
|
| 254 |
+
$type = $this->get_type_of_cost();
|
| 255 |
+
$cost = 0;
|
| 256 |
+
$total_weight = 0;
|
| 257 |
+
|
| 258 |
+
if ( 'yes' == $this->debug ) {
|
| 259 |
+
$this->log->add( $this->id, 'Calculating cost for Carta Registrada' );
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
if ( '' === $this->shipping_class ) {
|
| 263 |
+
if ( 'yes' == $this->debug ) {
|
| 264 |
+
$this->log->add( $this->id, 'Error: No shipping class has been configured!' );
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
return 0;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
foreach ( $package['contents'] as $value ) {
|
| 271 |
+
$product = $value['data'];
|
| 272 |
+
$qty = $value['quantity'];
|
| 273 |
+
$weight = 0;
|
| 274 |
+
|
| 275 |
+
// Check if all or some items in the cart don't supports this shipping method.
|
| 276 |
+
if ( $this->shipping_class !== $product->get_shipping_class() ) {
|
| 277 |
+
if ( 'yes' == $this->debug ) {
|
| 278 |
+
$this->log->add( $this->id, 'One or all items in the cart do not supports the configured shipping class' );
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
return 0;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
if ( $qty > 0 && $product->needs_shipping() ) {
|
| 285 |
+
$weight = wc_get_weight( str_replace( ',', '.', $product->weight ), 'g' );
|
| 286 |
+
|
| 287 |
+
if ( $qty > 1 ) {
|
| 288 |
+
$weight *= $qty;
|
| 289 |
+
}
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
$total_weight += $weight;
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
foreach ( $this->get_costs() as $cost_weight => $costs ) {
|
| 296 |
+
if ( $total_weight <= $cost_weight ) {
|
| 297 |
+
$cost = $costs[ $type ];
|
| 298 |
+
break;
|
| 299 |
+
}
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
if ( 'yes' == $this->debug ) {
|
| 303 |
+
$this->log->add( $this->id, sprintf( 'Total cost for %sg%s: %s', $total_weight, 'R' !== $type ? ' and ' . $type : '', $cost ) );
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
return $cost;
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
/**
|
| 310 |
+
* Calculates the shipping rate.
|
| 311 |
+
*
|
| 312 |
+
* @param array $package Order package.
|
| 313 |
+
*/
|
| 314 |
+
public function calculate_shipping( $package = array() ) {
|
| 315 |
+
// Check if valid to be calculeted.
|
| 316 |
+
if ( '' === $package['destination']['postcode'] || 'BR' !== $package['destination']['country'] ) {
|
| 317 |
+
return;
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
// Cost.
|
| 321 |
+
$cost = $this->get_shipping_cost( $package );
|
| 322 |
+
|
| 323 |
+
if ( 0 === $cost ) {
|
| 324 |
+
return;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
// Apply fees.
|
| 328 |
+
$fee = $this->get_fee( $this->fee, $cost );
|
| 329 |
+
|
| 330 |
+
// Create the rate and apply filters.
|
| 331 |
+
$rate = apply_filters( 'woocommerce_correios_' . $this->id . '_rate', array(
|
| 332 |
+
'id' => $this->id . $this->instance_id,
|
| 333 |
+
'label' => $this->title,
|
| 334 |
+
'cost' => $cost + $fee,
|
| 335 |
+
), $this->instance_id );
|
| 336 |
|
| 337 |
+
// Add rate to WooCommerce.
|
| 338 |
+
$this->add_rate( $rate );
|
| 339 |
}
|
| 340 |
}
|
languages/woocommerce-correios.pot
CHANGED
|
@@ -2,9 +2,9 @@
|
|
| 2 |
# This file is distributed under the GPLv2 or later.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
-
"Project-Id-Version: WooCommerce Correios 3.0.
|
| 6 |
"Report-Msgid-Bugs-To: https://wordpress.org/plugins/woocommerce-domination/\n"
|
| 7 |
-
"POT-Creation-Date: 2016-06-
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
|
@@ -17,286 +17,306 @@ msgstr ""
|
|
| 17 |
msgid "%s is a international shipping method from Correios."
|
| 18 |
msgstr ""
|
| 19 |
|
| 20 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 21 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 22 |
#: includes/emails/class-wc-correios-tracking-email.php:50
|
| 23 |
#: includes/integrations/class-wc-correios-integration.php:78
|
| 24 |
#: includes/integrations/class-wc-correios-integration.php:96
|
|
|
|
| 25 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:79
|
| 26 |
msgid "Enable/Disable"
|
| 27 |
msgstr ""
|
| 28 |
|
| 29 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 30 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 31 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:81
|
| 32 |
msgid "Enable this shipping method"
|
| 33 |
msgstr ""
|
| 34 |
|
| 35 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 36 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 37 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:85
|
| 38 |
msgid "Title"
|
| 39 |
msgstr ""
|
| 40 |
|
| 41 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 42 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 43 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:87
|
| 44 |
msgid "This controls the title which the user sees during checkout."
|
| 45 |
msgstr ""
|
| 46 |
|
| 47 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 48 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 49 |
msgid "Behavior Options"
|
| 50 |
msgstr ""
|
| 51 |
|
| 52 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 53 |
msgid "Origin State"
|
| 54 |
msgstr ""
|
| 55 |
|
| 56 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 57 |
msgid "The UF of the location your packages are delivered from."
|
| 58 |
msgstr ""
|
| 59 |
|
| 60 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 61 |
msgid "Origin Locale"
|
| 62 |
msgstr ""
|
| 63 |
|
| 64 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 65 |
msgid "The location of your packages are delivered from."
|
| 66 |
msgstr ""
|
| 67 |
|
| 68 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 69 |
msgid "Capital"
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 73 |
msgid "Interior"
|
| 74 |
msgstr ""
|
| 75 |
|
| 76 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 77 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 78 |
msgid "Delivery Time"
|
| 79 |
msgstr ""
|
| 80 |
|
| 81 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 82 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 83 |
msgid "Show estimated delivery time"
|
| 84 |
msgstr ""
|
| 85 |
|
| 86 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 87 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 88 |
msgid "Display the estimated delivery time in working days."
|
| 89 |
msgstr ""
|
| 90 |
|
| 91 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 92 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 93 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:123
|
| 94 |
msgid "Handling Fee"
|
| 95 |
msgstr ""
|
| 96 |
|
| 97 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 98 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 99 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:125
|
| 100 |
msgid ""
|
| 101 |
"Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to "
|
| 102 |
"disable."
|
| 103 |
msgstr ""
|
| 104 |
|
| 105 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 106 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 107 |
msgid "Optional Services"
|
| 108 |
msgstr ""
|
| 109 |
|
| 110 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 111 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 112 |
msgid "Use these options to add the value of each service provided by the Correios."
|
| 113 |
msgstr ""
|
| 114 |
|
| 115 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 116 |
msgid "Automatic Insurance"
|
| 117 |
msgstr ""
|
| 118 |
|
| 119 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 120 |
msgid "Enable automatic insurance"
|
| 121 |
msgstr ""
|
| 122 |
|
| 123 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 124 |
msgid "This controls if need to apply insurance to the order."
|
| 125 |
msgstr ""
|
| 126 |
|
| 127 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 128 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 129 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:224
|
| 130 |
msgid "Testing"
|
| 131 |
msgstr ""
|
| 132 |
|
| 133 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 134 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 135 |
#: includes/integrations/class-wc-correios-integration.php:84
|
| 136 |
#: includes/integrations/class-wc-correios-integration.php:137
|
|
|
|
| 137 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:228
|
| 138 |
msgid "Debug Log"
|
| 139 |
msgstr ""
|
| 140 |
|
| 141 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 142 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 143 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:230
|
| 144 |
msgid "Enable logging"
|
| 145 |
msgstr ""
|
| 146 |
|
| 147 |
-
#: includes/abstracts/abstract-wc-correios-international-shipping.php:
|
| 148 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 149 |
#: includes/integrations/class-wc-correios-integration.php:88
|
| 150 |
#: includes/integrations/class-wc-correios-integration.php:141
|
|
|
|
| 151 |
msgid "Log %s events, such as WebServices requests."
|
| 152 |
msgstr ""
|
| 153 |
|
| 154 |
#: includes/abstracts/abstract-wc-correios-shipping.php:42
|
|
|
|
| 155 |
msgid "%s is a shipping method from Correios."
|
| 156 |
msgstr ""
|
| 157 |
|
| 158 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 159 |
#: includes/integrations/class-wc-correios-integration.php:63
|
| 160 |
msgid "View logs."
|
| 161 |
msgstr ""
|
| 162 |
|
| 163 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 164 |
msgid "Origin Postcode"
|
| 165 |
msgstr ""
|
| 166 |
|
| 167 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 168 |
msgid "The postcode of the location your packages are delivered from."
|
| 169 |
msgstr ""
|
| 170 |
|
| 171 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 172 |
msgid "Additional Days"
|
| 173 |
msgstr ""
|
| 174 |
|
| 175 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 176 |
msgid "Additional working days to the estimated delivery."
|
| 177 |
msgstr ""
|
| 178 |
|
| 179 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 180 |
msgid "Receipt Notice"
|
| 181 |
msgstr ""
|
| 182 |
|
| 183 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 184 |
msgid "Enable receipt notice"
|
| 185 |
msgstr ""
|
| 186 |
|
| 187 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 188 |
msgid "This controls whether to add costs of the receipt notice service."
|
| 189 |
msgstr ""
|
| 190 |
|
| 191 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 192 |
msgid "Own Hands"
|
| 193 |
msgstr ""
|
| 194 |
|
| 195 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 196 |
msgid "Enable own hands"
|
| 197 |
msgstr ""
|
| 198 |
|
| 199 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
|
|
|
| 200 |
msgid "This controls whether to add costs of the own hands service"
|
| 201 |
msgstr ""
|
| 202 |
|
| 203 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 204 |
msgid "Declare Value for Insurance"
|
| 205 |
msgstr ""
|
| 206 |
|
| 207 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 208 |
msgid "Enable declared value"
|
| 209 |
msgstr ""
|
| 210 |
|
| 211 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 212 |
msgid ""
|
| 213 |
"This controls if the price of the package must be declared for insurance "
|
| 214 |
"purposes."
|
| 215 |
msgstr ""
|
| 216 |
|
| 217 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 218 |
msgid "Service Options"
|
| 219 |
msgstr ""
|
| 220 |
|
| 221 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 222 |
msgid "Service Code"
|
| 223 |
msgstr ""
|
| 224 |
|
| 225 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 226 |
msgid "Service code, use this for custom codes."
|
| 227 |
msgstr ""
|
| 228 |
|
| 229 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 230 |
msgid "Service Type"
|
| 231 |
msgstr ""
|
| 232 |
|
| 233 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 234 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:136
|
| 235 |
msgid "Choose between conventional or corporate service."
|
| 236 |
msgstr ""
|
| 237 |
|
| 238 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 239 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:140
|
| 240 |
msgid "Conventional"
|
| 241 |
msgstr ""
|
| 242 |
|
| 243 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 244 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:141
|
| 245 |
msgid "Corporate"
|
| 246 |
msgstr ""
|
| 247 |
|
| 248 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 249 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:145
|
| 250 |
msgid "Administrative Code"
|
| 251 |
msgstr ""
|
| 252 |
|
| 253 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 254 |
msgid "Your Correios login. It's usually your CNPJ."
|
| 255 |
msgstr ""
|
| 256 |
|
| 257 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 258 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:151
|
| 259 |
msgid "Administrative Password"
|
| 260 |
msgstr ""
|
| 261 |
|
| 262 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 263 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:153
|
| 264 |
msgid "Your Correios password."
|
| 265 |
msgstr ""
|
| 266 |
|
| 267 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 268 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:197
|
| 269 |
msgid "Package Standard"
|
| 270 |
msgstr ""
|
| 271 |
|
| 272 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 273 |
msgid "Minimum measure for your shipping packages."
|
| 274 |
msgstr ""
|
| 275 |
|
| 276 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 277 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:203
|
| 278 |
msgid "Minimum Height"
|
| 279 |
msgstr ""
|
| 280 |
|
| 281 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 282 |
msgid "Minimum height of your shipping packages. Correios needs at least 2cm."
|
| 283 |
msgstr ""
|
| 284 |
|
| 285 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 286 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:210
|
| 287 |
msgid "Minimum Width"
|
| 288 |
msgstr ""
|
| 289 |
|
| 290 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 291 |
msgid "Minimum width of your shipping packages. Correios needs at least 11cm."
|
| 292 |
msgstr ""
|
| 293 |
|
| 294 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 295 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:217
|
| 296 |
msgid "Minimum Length"
|
| 297 |
msgstr ""
|
| 298 |
|
| 299 |
-
#: includes/abstracts/abstract-wc-correios-shipping.php:
|
| 300 |
msgid "Minimum length of your shipping packages. Correios needs at least 16cm."
|
| 301 |
msgstr ""
|
| 302 |
|
|
@@ -561,10 +581,22 @@ msgstr ""
|
|
| 561 |
msgid "Postcode database emptied successfully!"
|
| 562 |
msgstr ""
|
| 563 |
|
| 564 |
-
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:
|
| 565 |
msgid "Carta Registrada"
|
| 566 |
msgstr ""
|
| 567 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 568 |
#: includes/shipping/class-wc-correios-shipping-esedex.php:34
|
| 569 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:189
|
| 570 |
msgid "e-SEDEX"
|
| 2 |
# This file is distributed under the GPLv2 or later.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
+
"Project-Id-Version: WooCommerce Correios 3.0.2\n"
|
| 6 |
"Report-Msgid-Bugs-To: https://wordpress.org/plugins/woocommerce-domination/\n"
|
| 7 |
+
"POT-Creation-Date: 2016-06-28 03:55:58+00:00\n"
|
| 8 |
"MIME-Version: 1.0\n"
|
| 9 |
"Content-Type: text/plain; charset=utf-8\n"
|
| 10 |
"Content-Transfer-Encoding: 8bit\n"
|
| 17 |
msgid "%s is a international shipping method from Correios."
|
| 18 |
msgstr ""
|
| 19 |
|
| 20 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:57
|
| 21 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:91
|
| 22 |
#: includes/emails/class-wc-correios-tracking-email.php:50
|
| 23 |
#: includes/integrations/class-wc-correios-integration.php:78
|
| 24 |
#: includes/integrations/class-wc-correios-integration.php:96
|
| 25 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:80
|
| 26 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:79
|
| 27 |
msgid "Enable/Disable"
|
| 28 |
msgstr ""
|
| 29 |
|
| 30 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:59
|
| 31 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:93
|
| 32 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:82
|
| 33 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:81
|
| 34 |
msgid "Enable this shipping method"
|
| 35 |
msgstr ""
|
| 36 |
|
| 37 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:63
|
| 38 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:97
|
| 39 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:86
|
| 40 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:85
|
| 41 |
msgid "Title"
|
| 42 |
msgstr ""
|
| 43 |
|
| 44 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:65
|
| 45 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:99
|
| 46 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:88
|
| 47 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:87
|
| 48 |
msgid "This controls the title which the user sees during checkout."
|
| 49 |
msgstr ""
|
| 50 |
|
| 51 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:70
|
| 52 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:104
|
| 53 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:93
|
| 54 |
msgid "Behavior Options"
|
| 55 |
msgstr ""
|
| 56 |
|
| 57 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:75
|
| 58 |
msgid "Origin State"
|
| 59 |
msgstr ""
|
| 60 |
|
| 61 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:77
|
| 62 |
msgid "The UF of the location your packages are delivered from."
|
| 63 |
msgstr ""
|
| 64 |
|
| 65 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:84
|
| 66 |
msgid "Origin Locale"
|
| 67 |
msgstr ""
|
| 68 |
|
| 69 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:86
|
| 70 |
msgid "The location of your packages are delivered from."
|
| 71 |
msgstr ""
|
| 72 |
|
| 73 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:91
|
| 74 |
msgid "Capital"
|
| 75 |
msgstr ""
|
| 76 |
|
| 77 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:92
|
| 78 |
msgid "Interior"
|
| 79 |
msgstr ""
|
| 80 |
|
| 81 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:96
|
| 82 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:117
|
| 83 |
msgid "Delivery Time"
|
| 84 |
msgstr ""
|
| 85 |
|
| 86 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:98
|
| 87 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:119
|
| 88 |
msgid "Show estimated delivery time"
|
| 89 |
msgstr ""
|
| 90 |
|
| 91 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:99
|
| 92 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:120
|
| 93 |
msgid "Display the estimated delivery time in working days."
|
| 94 |
msgstr ""
|
| 95 |
|
| 96 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:104
|
| 97 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:133
|
| 98 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:107
|
| 99 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:123
|
| 100 |
msgid "Handling Fee"
|
| 101 |
msgstr ""
|
| 102 |
|
| 103 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:106
|
| 104 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:135
|
| 105 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:109
|
| 106 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:125
|
| 107 |
msgid ""
|
| 108 |
"Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to "
|
| 109 |
"disable."
|
| 110 |
msgstr ""
|
| 111 |
|
| 112 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:112
|
| 113 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:141
|
| 114 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:115
|
| 115 |
msgid "Optional Services"
|
| 116 |
msgstr ""
|
| 117 |
|
| 118 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:114
|
| 119 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:143
|
| 120 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:117
|
| 121 |
msgid "Use these options to add the value of each service provided by the Correios."
|
| 122 |
msgstr ""
|
| 123 |
|
| 124 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:118
|
| 125 |
msgid "Automatic Insurance"
|
| 126 |
msgstr ""
|
| 127 |
|
| 128 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:120
|
| 129 |
msgid "Enable automatic insurance"
|
| 130 |
msgstr ""
|
| 131 |
|
| 132 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:121
|
| 133 |
msgid "This controls if need to apply insurance to the order."
|
| 134 |
msgstr ""
|
| 135 |
|
| 136 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:126
|
| 137 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:237
|
| 138 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:137
|
| 139 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:224
|
| 140 |
msgid "Testing"
|
| 141 |
msgstr ""
|
| 142 |
|
| 143 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:131
|
| 144 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:242
|
| 145 |
#: includes/integrations/class-wc-correios-integration.php:84
|
| 146 |
#: includes/integrations/class-wc-correios-integration.php:137
|
| 147 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:142
|
| 148 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:228
|
| 149 |
msgid "Debug Log"
|
| 150 |
msgstr ""
|
| 151 |
|
| 152 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:133
|
| 153 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:244
|
| 154 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:144
|
| 155 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:230
|
| 156 |
msgid "Enable logging"
|
| 157 |
msgstr ""
|
| 158 |
|
| 159 |
+
#: includes/abstracts/abstract-wc-correios-international-shipping.php:135
|
| 160 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:246
|
| 161 |
#: includes/integrations/class-wc-correios-integration.php:88
|
| 162 |
#: includes/integrations/class-wc-correios-integration.php:141
|
| 163 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:146
|
| 164 |
msgid "Log %s events, such as WebServices requests."
|
| 165 |
msgstr ""
|
| 166 |
|
| 167 |
#: includes/abstracts/abstract-wc-correios-shipping.php:42
|
| 168 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:28
|
| 169 |
msgid "%s is a shipping method from Correios."
|
| 170 |
msgstr ""
|
| 171 |
|
| 172 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:81
|
| 173 |
#: includes/integrations/class-wc-correios-integration.php:63
|
| 174 |
msgid "View logs."
|
| 175 |
msgstr ""
|
| 176 |
|
| 177 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:109
|
| 178 |
msgid "Origin Postcode"
|
| 179 |
msgstr ""
|
| 180 |
|
| 181 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:111
|
| 182 |
msgid "The postcode of the location your packages are delivered from."
|
| 183 |
msgstr ""
|
| 184 |
|
| 185 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:125
|
| 186 |
msgid "Additional Days"
|
| 187 |
msgstr ""
|
| 188 |
|
| 189 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:127
|
| 190 |
msgid "Additional working days to the estimated delivery."
|
| 191 |
msgstr ""
|
| 192 |
|
| 193 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:147
|
| 194 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:121
|
| 195 |
msgid "Receipt Notice"
|
| 196 |
msgstr ""
|
| 197 |
|
| 198 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:149
|
| 199 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:123
|
| 200 |
msgid "Enable receipt notice"
|
| 201 |
msgstr ""
|
| 202 |
|
| 203 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:150
|
| 204 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:124
|
| 205 |
msgid "This controls whether to add costs of the receipt notice service."
|
| 206 |
msgstr ""
|
| 207 |
|
| 208 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:155
|
| 209 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:129
|
| 210 |
msgid "Own Hands"
|
| 211 |
msgstr ""
|
| 212 |
|
| 213 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:157
|
| 214 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:131
|
| 215 |
msgid "Enable own hands"
|
| 216 |
msgstr ""
|
| 217 |
|
| 218 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:158
|
| 219 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:132
|
| 220 |
msgid "This controls whether to add costs of the own hands service"
|
| 221 |
msgstr ""
|
| 222 |
|
| 223 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:163
|
| 224 |
msgid "Declare Value for Insurance"
|
| 225 |
msgstr ""
|
| 226 |
|
| 227 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:165
|
| 228 |
msgid "Enable declared value"
|
| 229 |
msgstr ""
|
| 230 |
|
| 231 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:166
|
| 232 |
msgid ""
|
| 233 |
"This controls if the price of the package must be declared for insurance "
|
| 234 |
"purposes."
|
| 235 |
msgstr ""
|
| 236 |
|
| 237 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:171
|
| 238 |
msgid "Service Options"
|
| 239 |
msgstr ""
|
| 240 |
|
| 241 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:176
|
| 242 |
msgid "Service Code"
|
| 243 |
msgstr ""
|
| 244 |
|
| 245 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:178
|
| 246 |
msgid "Service code, use this for custom codes."
|
| 247 |
msgstr ""
|
| 248 |
|
| 249 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:184
|
| 250 |
msgid "Service Type"
|
| 251 |
msgstr ""
|
| 252 |
|
| 253 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:186
|
| 254 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:136
|
| 255 |
msgid "Choose between conventional or corporate service."
|
| 256 |
msgstr ""
|
| 257 |
|
| 258 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:191
|
| 259 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:140
|
| 260 |
msgid "Conventional"
|
| 261 |
msgstr ""
|
| 262 |
|
| 263 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:192
|
| 264 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:141
|
| 265 |
msgid "Corporate"
|
| 266 |
msgstr ""
|
| 267 |
|
| 268 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:196
|
| 269 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:145
|
| 270 |
msgid "Administrative Code"
|
| 271 |
msgstr ""
|
| 272 |
|
| 273 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:198
|
| 274 |
msgid "Your Correios login. It's usually your CNPJ."
|
| 275 |
msgstr ""
|
| 276 |
|
| 277 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:203
|
| 278 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:151
|
| 279 |
msgid "Administrative Password"
|
| 280 |
msgstr ""
|
| 281 |
|
| 282 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:205
|
| 283 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:153
|
| 284 |
msgid "Your Correios password."
|
| 285 |
msgstr ""
|
| 286 |
|
| 287 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:210
|
| 288 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:197
|
| 289 |
msgid "Package Standard"
|
| 290 |
msgstr ""
|
| 291 |
|
| 292 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:212
|
| 293 |
msgid "Minimum measure for your shipping packages."
|
| 294 |
msgstr ""
|
| 295 |
|
| 296 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:216
|
| 297 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:203
|
| 298 |
msgid "Minimum Height"
|
| 299 |
msgstr ""
|
| 300 |
|
| 301 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:218
|
| 302 |
msgid "Minimum height of your shipping packages. Correios needs at least 2cm."
|
| 303 |
msgstr ""
|
| 304 |
|
| 305 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:223
|
| 306 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:210
|
| 307 |
msgid "Minimum Width"
|
| 308 |
msgstr ""
|
| 309 |
|
| 310 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:225
|
| 311 |
msgid "Minimum width of your shipping packages. Correios needs at least 11cm."
|
| 312 |
msgstr ""
|
| 313 |
|
| 314 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:230
|
| 315 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:217
|
| 316 |
msgid "Minimum Length"
|
| 317 |
msgstr ""
|
| 318 |
|
| 319 |
+
#: includes/abstracts/abstract-wc-correios-shipping.php:232
|
| 320 |
msgid "Minimum length of your shipping packages. Correios needs at least 16cm."
|
| 321 |
msgstr ""
|
| 322 |
|
| 581 |
msgid "Postcode database emptied successfully!"
|
| 582 |
msgstr ""
|
| 583 |
|
| 584 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:27
|
| 585 |
msgid "Carta Registrada"
|
| 586 |
msgstr ""
|
| 587 |
|
| 588 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:64
|
| 589 |
+
msgid "-- Select a shipping class --"
|
| 590 |
+
msgstr ""
|
| 591 |
+
|
| 592 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:98
|
| 593 |
+
msgid "Shipping Class"
|
| 594 |
+
msgstr ""
|
| 595 |
+
|
| 596 |
+
#: includes/shipping/class-wc-correios-shipping-carta-registrada.php:100
|
| 597 |
+
msgid "Select for which shipping class this method will be applied."
|
| 598 |
+
msgstr ""
|
| 599 |
+
|
| 600 |
#: includes/shipping/class-wc-correios-shipping-esedex.php:34
|
| 601 |
#: includes/shipping/class-wc-correios-shipping-legacy.php:189
|
| 602 |
msgid "e-SEDEX"
|
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.5
|
| 7 |
-
Stable tag: 3.0.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -68,7 +68,7 @@ Você pode esclarecer suas dúvidas usando:
|
|
| 68 |
|
| 69 |
= Configurações do plugin: =
|
| 70 |
|
| 71 |
-
[youtube https://www.youtube.com/watch?v=
|
| 72 |
|
| 73 |
= Configurações dos produtos =
|
| 74 |
|
|
@@ -199,6 +199,10 @@ Em caso de dúvidas, basta abrir um tópico no [fórum de suporte do plugin](htt
|
|
| 199 |
|
| 200 |
== Changelog ==
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
= 3.0.1 - 2016/06/26 =
|
| 203 |
|
| 204 |
- Corrigido o calculo da taxa de manuseio.
|
|
@@ -217,7 +221,7 @@ Em caso de dúvidas, basta abrir um tópico no [fórum de suporte do plugin](htt
|
|
| 217 |
|
| 218 |
== Upgrade Notice ==
|
| 219 |
|
| 220 |
-
= 3.0.
|
| 221 |
|
| 222 |
- Reformulação geral de todos o código do plugin.
|
| 223 |
- Adicionado suporte as áreas de entrega do WooCommerce 2.6.
|
|
@@ -228,4 +232,5 @@ Em caso de dúvidas, basta abrir um tópico no [fórum de suporte do plugin](htt
|
|
| 228 |
- Removida a opção de simulador de frete na página do produto.
|
| 229 |
- Integrado o campo de "correios_tracking_code" dos pedidos com a API REST do WooCommerce.
|
| 230 |
- Corrigido o calculo da taxa de manuseio.
|
|
|
|
| 231 |
- E mais outras várias alterações que podem ser verificadas pelo [GitHub](https://github.com/claudiosmweb/woocommerce-correios/compare/2.3.0...3.0.0).
|
| 4 |
Tags: shipping, delivery, woocommerce, correios
|
| 5 |
Requires at least: 4.0
|
| 6 |
Tested up to: 4.5
|
| 7 |
+
Stable tag: 3.0.2
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 68 |
|
| 69 |
= Configurações do plugin: =
|
| 70 |
|
| 71 |
+
[youtube https://www.youtube.com/watch?v=IWjLAy9i--I]
|
| 72 |
|
| 73 |
= Configurações dos produtos =
|
| 74 |
|
| 199 |
|
| 200 |
== Changelog ==
|
| 201 |
|
| 202 |
+
= 3.0.2 - 2016/06/28 =
|
| 203 |
+
|
| 204 |
+
- Adicionado novo método de Carta Registrada seguindo a tabela dos Correios e com suporte a classes de entrega.
|
| 205 |
+
|
| 206 |
= 3.0.1 - 2016/06/26 =
|
| 207 |
|
| 208 |
- Corrigido o calculo da taxa de manuseio.
|
| 221 |
|
| 222 |
== Upgrade Notice ==
|
| 223 |
|
| 224 |
+
= 3.0.2 =
|
| 225 |
|
| 226 |
- Reformulação geral de todos o código do plugin.
|
| 227 |
- Adicionado suporte as áreas de entrega do WooCommerce 2.6.
|
| 232 |
- Removida a opção de simulador de frete na página do produto.
|
| 233 |
- Integrado o campo de "correios_tracking_code" dos pedidos com a API REST do WooCommerce.
|
| 234 |
- Corrigido o calculo da taxa de manuseio.
|
| 235 |
+
- Adicionado método de Carta Registrada seguindo a tabela dos Correios e com suporte a classes de entrega.
|
| 236 |
- E mais outras várias alterações que podem ser verificadas pelo [GitHub](https://github.com/claudiosmweb/woocommerce-correios/compare/2.3.0...3.0.0).
|
woocommerce-correios.php
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
* Description: Correios para WooCommerce
|
| 6 |
* Author: Claudio Sanches
|
| 7 |
* Author URI: http://claudiosmweb.com/
|
| 8 |
-
* Version: 3.0.
|
| 9 |
* License: GPLv2 or later
|
| 10 |
* Text Domain: woocommerce-correios
|
| 11 |
* Domain Path: languages/
|
|
@@ -29,7 +29,7 @@ if ( ! class_exists( 'WC_Correios' ) ) :
|
|
| 29 |
*
|
| 30 |
* @var string
|
| 31 |
*/
|
| 32 |
-
const VERSION = '3.0.
|
| 33 |
|
| 34 |
/**
|
| 35 |
* Instance of this class.
|
| 5 |
* Description: Correios para WooCommerce
|
| 6 |
* Author: Claudio Sanches
|
| 7 |
* Author URI: http://claudiosmweb.com/
|
| 8 |
+
* Version: 3.0.2
|
| 9 |
* License: GPLv2 or later
|
| 10 |
* Text Domain: woocommerce-correios
|
| 11 |
* Domain Path: languages/
|
| 29 |
*
|
| 30 |
* @var string
|
| 31 |
*/
|
| 32 |
+
const VERSION = '3.0.2';
|
| 33 |
|
| 34 |
/**
|
| 35 |
* Instance of this class.
|
