PedroTeixeira_Correios - Version 4.5.0

Version Notes

Bugfix:

- Correção de prazo para mapeamentos recentes dos Correios
- Corrige exceção no caso de falha na comunicação com os Correios

Feature:

- Adiciona suporte a Perfil Recorrente (Recurring Profile)
- Licença utilizada visível na documentação
- Atualização dos preços da carta comercial e carta comercial registrada
- Adiciona mensagem especial para CEPs com área de risco
- Adiciona explicação de novos campos no README
- Adiciona informação sobre compilação no README
- Possibilidade de acrescentar dias nos prazos dos Correios por produto

Download this release

Release Info

Developer Pedro Teixeira
Extension PedroTeixeira_Correios
Version 4.5.0
Comparing to
See all releases


Code changes from version 4.4.0 to 4.5.0

app/code/community/PedroTeixeira/Correios/Model/Cache.php CHANGED
@@ -202,25 +202,44 @@ class PedroTeixeira_Correios_Model_Cache
202
 
203
  /**
204
  * Validate the response data from Correios.
 
 
 
 
 
 
 
 
 
205
  *
206
  * @param string $data XML Content
 
 
207
  *
208
  * @return boolean
209
  */
210
  protected function _isValidCache($data)
211
  {
212
- $response = Zend_Http_Response::fromString($data);
213
- $content = $response->getBody();
214
- $pattern = $this->getConfigData('pattern_nocache');
215
- if ($pattern != '' && preg_match($pattern, $content, $matches)) {
216
- return false;
 
217
  }
 
218
  if (empty($content)) {
219
- return false;
220
  }
221
  libxml_use_internal_errors(true);
222
  $xml = simplexml_load_string($content);
223
  if (!$xml || !isset($xml->cServico)) {
 
 
 
 
 
 
224
  return false;
225
  }
226
  return true;
@@ -231,19 +250,16 @@ class PedroTeixeira_Correios_Model_Cache
231
  *
232
  * @param string $data XML Content
233
  *
234
- * @throws Exception
235
- *
236
- * @return PedroTeixeira_Correios_Model_Cache
237
  */
238
  public function save($data)
239
  {
240
- if (!$this->_isValidCache($data)) {
241
- return false; // Invalid for the Cache only
242
- }
243
- $id = $this->_getId();
244
- $tags = $this->getCacheTags();
245
- if ($this->getCache()->save($data, $id, $tags)) {
246
- Mage::log("{$this->_code} [cache]: mode={$this->getConfigData('cache_mode')} status=write key={$id}");
247
  }
248
  return $this;
249
  }
@@ -263,4 +279,4 @@ class PedroTeixeira_Correios_Model_Cache
263
  $path = 'carriers/' . $this->_code . '/' . $field;
264
  return Mage::getStoreConfig($path);
265
  }
266
- }
202
 
203
  /**
204
  * Validate the response data from Correios.
205
+ * This method will choose between Request Cache or Save in Cache
206
+ *
207
+ * Step 1:
208
+ * Invalid responses must call the Cache load.
209
+ * Cache loading is requested by throwing adapter exception.
210
+ *
211
+ * Step 2:
212
+ * To save valid responses, it must contain no errors.
213
+ * Errors are detected by pattern_nocache and returns false.
214
  *
215
  * @param string $data XML Content
216
+ *
217
+ * @throws Zend_Http_Client_Adapter_Exception
218
  *
219
  * @return boolean
220
  */
221
  protected function _isValidCache($data)
222
  {
223
+ // Step 1
224
+ try {
225
+ $response = Zend_Http_Response::fromString($data);
226
+ $content = $response->getBody();
227
+ } catch (Zend_Http_Exception $e) {
228
+ throw new Zend_Http_Client_Adapter_Exception($e->getMessage());
229
  }
230
+
231
  if (empty($content)) {
232
+ throw new Zend_Http_Client_Adapter_Exception();
233
  }
234
  libxml_use_internal_errors(true);
235
  $xml = simplexml_load_string($content);
236
  if (!$xml || !isset($xml->cServico)) {
237
+ throw new Zend_Http_Client_Adapter_Exception();
238
+ }
239
+
240
+ // Step 2
241
+ $pattern = $this->getConfigData('pattern_nocache');
242
+ if ($pattern != '' && preg_match($pattern, $content, $matches)) {
243
  return false;
244
  }
245
  return true;
250
  *
251
  * @param string $data XML Content
252
  *
253
+ * @return boolean|PedroTeixeira_Correios_Model_Cache
 
 
254
  */
255
  public function save($data)
256
  {
257
+ if ($this->_isValidCache($data)) {
258
+ $id = $this->_getId();
259
+ $tags = $this->getCacheTags();
260
+ if ($this->getCache()->save($data, $id, $tags)) {
261
+ Mage::log("{$this->_code} [cache]: mode={$this->getConfigData('cache_mode')} status=write key={$id}");
262
+ }
 
263
  }
264
  return $this;
265
  }
279
  $path = 'carriers/' . $this->_code . '/' . $field;
280
  return Mage::getStoreConfig($path);
281
  }
282
+ }
app/code/community/PedroTeixeira/Correios/Model/Carrier/CorreiosMethod.php CHANGED
@@ -21,6 +21,7 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
21
  * @var string
22
  */
23
  protected $_code = 'pedroteixeira_correios';
 
24
 
25
  /**
26
  * _result property
@@ -44,6 +45,7 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
44
  protected $_freeMethodWeight = null;
45
  protected $_midSize = null;
46
  protected $_splitUp = 0;
 
47
 
48
  /**
49
  * Post methods
@@ -86,7 +88,10 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
86
  return $this->_result;
87
  }
88
 
89
- // Fix weight
 
 
 
90
  if ($this->getConfigData('weight_type') == PedroTeixeira_Correios_Model_Source_WeightType::WEIGHT_GR) {
91
  $this->_packageWeight = number_format($this->_packageWeight / 1000, 2, '.', '');
92
  }
@@ -117,6 +122,27 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
117
 
118
  return $this->_result;
119
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  /**
122
  * Get shipping quote
@@ -153,6 +179,9 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
153
  }
154
 
155
  $this->_appendShippingReturn((string) $servicos->Codigo, $shippingPrice, $shippingDelivery);
 
 
 
156
  $existReturn = true;
157
  }
158
 
@@ -343,7 +372,7 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
343
  sprintf(
344
  $this->getConfigData('msgprazo'),
345
  $shippingData[0],
346
- (int) ($correiosDelivery + $this->getConfigData('add_prazo'))
347
  )
348
  );
349
  } else {
@@ -351,7 +380,7 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
351
  sprintf(
352
  $this->getConfigData('msgprazo'),
353
  $shippingData[0],
354
- (int) ($shippingData[1] + $this->getConfigData('add_prazo'))
355
  )
356
  );
357
  }
@@ -458,6 +487,8 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
458
  $itemAltura = $this->_getFitHeight($item);
459
  $pesoCubicoTotal += (($itemAltura * $itemLargura * $itemComprimento) *
460
  $item->getQty()) / $this->getConfigData('coeficiente_volume');
 
 
461
  }
462
 
463
  $this->_volumeWeight = number_format($pesoCubicoTotal, 2, '.', '');
@@ -687,21 +718,11 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
687
  */
688
  protected function _removeInvalidServices()
689
  {
690
- $this->_loadMidSize();
691
  $tmpMethods = $this->_postMethodsExplode;
692
- foreach ($tmpMethods as $key => $method) {
693
- $isOverSize = ($this->_midSize > $this->getConfigData("validate/serv_{$method}/max/size"));
694
- $isOverSize |= ($this->_midSize * 3 > $this->getConfigData("validate/serv_{$method}/max/sum"));
695
- $isOverWeight = ($this->_packageWeight > $this->getConfigData("validate/serv_{$method}/max/weight"));
696
-
697
- if ($isOverSize || $isOverWeight) {
698
- unset($tmpMethods[$key]);
699
- }
700
- }
701
-
702
- $isDivisible = (count($tmpMethods) == 0);
703
- $isLoopBreakable = (count($this->_postMethodsExplode) > 0);
704
- if ($isDivisible && $isLoopBreakable) {
705
  return $this->_splitPack();
706
  }
707
 
@@ -739,24 +760,28 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
739
  */
740
  protected function _addPostMethods($cServico)
741
  {
742
- $i = 0;
743
- while (!is_null($this->getConfigData("add_method_{$i}"))) {
744
  $isValid = true;
745
- $isValid &= $this->_packageWeight >= $this->getConfigData("add_method_{$i}/from/weight");
746
- $isValid &= $this->_packageWeight <= $this->getConfigData("add_method_{$i}/to/weight");
747
- $isValid &= $this->_midSize >= $this->getConfigData("add_method_{$i}/from/size");
748
- $isValid &= $this->_midSize <= $this->getConfigData("add_method_{$i}/to/size");
749
- $isValid &= $this->_toZip >= $this->getConfigData("add_method_{$i}/from/zip");
750
- $isValid &= $this->_toZip <= $this->getConfigData("add_method_{$i}/to/zip");
751
 
752
  if ($isValid) {
753
- $price = $this->getConfigData("add_method_{$i}/price");
754
- $days = $this->getConfigData("add_method_{$i}/days");
755
- $method = $this->getConfigData("add_method_{$i}/code");
756
  foreach ($cServico as $servico) {
757
  if ($servico->Codigo == $method) {
758
- $servico->Valor = number_format($price, 2, ',', '');
759
- $servico->PrazoEntrega = $days;
 
 
 
 
760
  $servico->EntregaDomiciliar = 'S';
761
  $servico->EntregaSabado = 'S';
762
  $servico->Erro = '0';
@@ -764,8 +789,6 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
764
  }
765
  }
766
  }
767
-
768
- $i++;
769
  }
770
 
771
  return $cServico;
@@ -849,7 +872,9 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
849
  */
850
  protected function _splitPack()
851
  {
852
- if ($this->getConfigFlag('split_pack')) {
 
 
853
  $this->_splitUp++;
854
  $this->_volumeWeight /= 2;
855
  $this->_packageWeight /= 2;
@@ -858,4 +883,74 @@ class PedroTeixeira_Correios_Model_Carrier_CorreiosMethod
858
  }
859
  return false;
860
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
861
  }
21
  * @var string
22
  */
23
  protected $_code = 'pedroteixeira_correios';
24
+ protected $_isFixed = true;
25
 
26
  /**
27
  * _result property
45
  protected $_freeMethodWeight = null;
46
  protected $_midSize = null;
47
  protected $_splitUp = 0;
48
+ protected $_postingDays = 0;
49
 
50
  /**
51
  * Post methods
88
  return $this->_result;
89
  }
90
 
91
+ if ($this->_packageWeight == 0) {
92
+ $this->_packageWeight = $this->_getNominalWeight();
93
+ }
94
+
95
  if ($this->getConfigData('weight_type') == PedroTeixeira_Correios_Model_Source_WeightType::WEIGHT_GR) {
96
  $this->_packageWeight = number_format($this->_packageWeight / 1000, 2, '.', '');
97
  }
122
 
123
  return $this->_result;
124
  }
125
+
126
+ /**
127
+ * Gets Nominal Weight
128
+ *
129
+ * @return number
130
+ */
131
+ protected function _getNominalWeight()
132
+ {
133
+ $weight = 0;
134
+ $quote = Mage::getSingleton('checkout/cart')->getQuote();
135
+ if (count($quote->getAllVisibleItems()) == 0) {
136
+ $quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
137
+ }
138
+ if ($quote->isNominal()) {
139
+ foreach ($quote->getAllVisibleItems() as $item) {
140
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
141
+ $weight += $product->getWeight();
142
+ }
143
+ }
144
+ return $weight;
145
+ }
146
 
147
  /**
148
  * Get shipping quote
179
  }
180
 
181
  $this->_appendShippingReturn((string) $servicos->Codigo, $shippingPrice, $shippingDelivery);
182
+ if ($this->getConfigFlag('show_soft_errors') && !isset($isWarnAppended)) {
183
+ $isWarnAppended = $this->_appendShippingWarning($servicos);
184
+ }
185
  $existReturn = true;
186
  }
187
 
372
  sprintf(
373
  $this->getConfigData('msgprazo'),
374
  $shippingData[0],
375
+ (int) ($correiosDelivery + $this->getConfigData('add_prazo') + $this->_postingDays)
376
  )
377
  );
378
  } else {
380
  sprintf(
381
  $this->getConfigData('msgprazo'),
382
  $shippingData[0],
383
+ (int) ($shippingData[1] + $this->getConfigData('add_prazo') + $this->_postingDays)
384
  )
385
  );
386
  }
487
  $itemAltura = $this->_getFitHeight($item);
488
  $pesoCubicoTotal += (($itemAltura * $itemLargura * $itemComprimento) *
489
  $item->getQty()) / $this->getConfigData('coeficiente_volume');
490
+
491
+ $this->_postingDays = max($this->_postingDays, (int) $_product->getData('posting_days'));
492
  }
493
 
494
  $this->_volumeWeight = number_format($pesoCubicoTotal, 2, '.', '');
718
  */
719
  protected function _removeInvalidServices()
720
  {
 
721
  $tmpMethods = $this->_postMethodsExplode;
722
+ $tmpMethods = $this->_filterMethodByConfigRestriction($tmpMethods);
723
+ $isDivisible = (count($tmpMethods) == 0);
724
+
725
+ if ($isDivisible) {
 
 
 
 
 
 
 
 
 
726
  return $this->_splitPack();
727
  }
728
 
760
  */
761
  protected function _addPostMethods($cServico)
762
  {
763
+ $addMethods = $this->getConfigData("add_postmethods");
764
+ foreach ($addMethods as $configData) {
765
  $isValid = true;
766
+ $isValid &= $this->_packageWeight >= $configData['from']['weight'];
767
+ $isValid &= $this->_packageWeight <= $configData['to']['weight'];
768
+ $isValid &= $this->_midSize >= $configData['from']['size'];
769
+ $isValid &= $this->_midSize <= $configData['to']['size'];
770
+ $isValid &= $this->_toZip >= $configData['from']['zip'];
771
+ $isValid &= $this->_toZip <= $configData['to']['zip'];
772
 
773
  if ($isValid) {
774
+ $price = $configData['price'];
775
+ $days = $configData['days'];
776
+ $method = $configData['code'];
777
  foreach ($cServico as $servico) {
778
  if ($servico->Codigo == $method) {
779
+ if (!empty($price)) {
780
+ $servico->Valor = number_format($price, 2, ',', '');
781
+ }
782
+ if (!empty($days)) {
783
+ $servico->PrazoEntrega = $days;
784
+ }
785
  $servico->EntregaDomiciliar = 'S';
786
  $servico->EntregaSabado = 'S';
787
  $servico->Erro = '0';
789
  }
790
  }
791
  }
 
 
792
  }
793
 
794
  return $cServico;
872
  */
873
  protected function _splitPack()
874
  {
875
+ $isSplitEnabled = $this->getConfigFlag('split_pack');
876
+ $isMethodAvailable = (count($this->_postMethodsExplode) > 0);
877
+ if ($isSplitEnabled && $isMethodAvailable) {
878
  $this->_splitUp++;
879
  $this->_volumeWeight /= 2;
880
  $this->_packageWeight /= 2;
883
  }
884
  return false;
885
  }
886
+
887
+ /**
888
+ * Receive a list of methods, and validate one-by-one using the config settings.
889
+ * Returns a list of valid methods or empty.
890
+ *
891
+ * @param array $postmethods Services List
892
+ *
893
+ * @return array
894
+ */
895
+ protected function _filterMethodByConfigRestriction($postmethods)
896
+ {
897
+ $validMethods = array();
898
+ $this->_loadMidSize();
899
+ foreach ($postmethods as $key => $method) {
900
+ $isOverSize = ($this->_midSize > $this->getConfigData("validate/serv_{$method}/max/size"));
901
+ $isOverSize |= ($this->_midSize * 3 > $this->getConfigData("validate/serv_{$method}/max/sum"));
902
+ $isOverWeight = ($this->_packageWeight > $this->getConfigData("validate/serv_{$method}/max/weight"));
903
+ $isOverCubic = ($this->_volumeWeight > $this->getConfigData("validate/serv_{$method}/max/volume_weight"));
904
+ $isZipAllowed = $this->_validateZipRestriction($method);
905
+
906
+ if (!$isOverSize && !$isOverWeight && !$isOverCubic && $isZipAllowed) {
907
+ $validMethods[] = $method;
908
+ }
909
+ }
910
+ return $validMethods;
911
+ }
912
+
913
+ /**
914
+ * Loads the zip range list.
915
+ * Returns TRUE only if zip target is included in the range.
916
+ *
917
+ * @param array $method Current Post Method
918
+ *
919
+ * @return boolean
920
+ */
921
+ protected function _validateZipRestriction($method)
922
+ {
923
+ $zipConfig = $this->getConfigData("validate/serv_{$method}/zips");
924
+ foreach ($zipConfig as $data) {
925
+ $zipRange = explode(',', $data);
926
+ $isBetweenRange = true;
927
+ $isBetweenRange &= ($this->_toZip >= $zipRange[0]);
928
+ $isBetweenRange &= ($this->_toZip <= $zipRange[1]);
929
+ if ($isBetweenRange) {
930
+ return true;
931
+ }
932
+ }
933
+ return false;
934
+ }
935
+
936
+ /**
937
+ * Add a warning message at the top of the shipping method list.
938
+ *
939
+ * @param SimpleXMLElement $servico Post Method
940
+ *
941
+ * @return boolean
942
+ */
943
+ protected function _appendShippingWarning(SimpleXMLElement $servico)
944
+ {
945
+ $id = (string) $servico->Erro;
946
+ $ids = explode(',', $this->getConfigData('soft_errors'));
947
+ if (in_array($id, $ids)) {
948
+ $error = Mage::getModel('shipping/rate_result_error');
949
+ $error->setCarrier($this->_code);
950
+ $error->setErrorMessage($servico->MsgErro);
951
+ $this->_result->append($error);
952
+ return true;
953
+ }
954
+ return false;
955
+ }
956
  }
app/code/community/PedroTeixeira/Correios/etc/config.xml CHANGED
@@ -15,7 +15,7 @@
15
  <config>
16
  <modules>
17
  <PedroTeixeira_Correios>
18
- <version>4.4.0</version>
19
  <depends>
20
  <Mage_Shipping/>
21
  </depends>
@@ -31,6 +31,7 @@
31
  <volume_largura/>
32
  <postmethods/>
33
  <fit_size/>
 
34
  </product_attributes>
35
  </item>
36
  </quote>
@@ -84,6 +85,7 @@
84
  <title>Correios</title>
85
  <postmethods>40010</postmethods>
86
  <soft_errors>009,010,011</soft_errors>
 
87
  <prazo_entrega>0</prazo_entrega>
88
  <check_dimensions>1</check_dimensions>
89
  <min_order_value>0</min_order_value>
@@ -108,77 +110,261 @@
108
  <size>105</size>
109
  <sum>200</sum>
110
  <weight>30</weight>
 
111
  </max>
 
 
 
112
  </serv_40010>
113
  <serv_40096>
114
  <max>
115
  <size>105</size>
116
  <sum>200</sum>
117
  <weight>30</weight>
 
118
  </max>
 
 
 
119
  </serv_40096>
120
  <serv_81019>
121
  <max>
122
  <size>105</size>
123
  <sum>200</sum>
124
  <weight>15</weight>
 
125
  </max>
 
 
 
126
  </serv_81019>
127
  <serv_41106>
128
  <max>
129
  <size>105</size>
130
  <sum>200</sum>
131
  <weight>30</weight>
 
132
  </max>
 
 
 
133
  </serv_41106>
134
  <serv_41068>
135
  <max>
136
  <size>105</size>
137
  <sum>200</sum>
138
  <weight>30</weight>
 
139
  </max>
 
 
 
140
  </serv_41068>
141
  <serv_40215>
142
  <max>
143
  <size>105</size>
144
  <sum>200</sum>
145
  <weight>10</weight>
 
146
  </max>
 
 
 
147
  </serv_40215>
148
  <serv_40290>
149
  <max>
150
  <size>105</size>
151
  <sum>200</sum>
152
  <weight>10</weight>
 
153
  </max>
 
 
 
154
  </serv_40290>
155
  <serv_40045>
156
  <max>
157
  <size>105</size>
158
  <sum>200</sum>
159
  <weight>30</weight>
 
160
  </max>
 
 
 
161
  </serv_40045>
162
  <serv_41300>
163
  <max>
164
  <size>150</size>
165
  <sum>300</sum>
166
  <weight>30</weight>
 
167
  </max>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  </serv_41300>
169
  <serv_10065>
170
  <max>
171
  <size>30</size>
172
  <sum>50</sum>
173
  <weight>0.5</weight>
 
174
  </max>
 
 
 
175
  </serv_10065>
176
  <serv_10138>
177
  <max>
178
  <size>30</size>
179
  <sum>50</sum>
180
  <weight>0.5</weight>
 
181
  </max>
 
 
 
182
  </serv_10138>
183
  </validate>
184
 
@@ -230,7 +416,7 @@
230
  <!-- ADDITIONAL POST METHODS -->
231
  <add_method_0>
232
  <code>10065</code>
233
- <price>1.30</price>
234
  <days>5</days>
235
  <from>
236
  <zip>00000000</zip>
@@ -245,7 +431,7 @@
245
  </add_method_0>
246
  <add_method_1>
247
  <code>10065</code>
248
- <price>1.80</price>
249
  <days>5</days>
250
  <from>
251
  <zip>00000000</zip>
@@ -260,7 +446,7 @@
260
  </add_method_1>
261
  <add_method_2>
262
  <code>10065</code>
263
- <price>2.45</price>
264
  <days>5</days>
265
  <from>
266
  <zip>00000000</zip>
@@ -275,7 +461,7 @@
275
  </add_method_2>
276
  <add_method_3>
277
  <code>10065</code>
278
- <price>3.00</price>
279
  <days>5</days>
280
  <from>
281
  <zip>00000000</zip>
@@ -290,7 +476,7 @@
290
  </add_method_3>
291
  <add_method_4>
292
  <code>10065</code>
293
- <price>3.60</price>
294
  <days>5</days>
295
  <from>
296
  <zip>00000000</zip>
@@ -305,7 +491,7 @@
305
  </add_method_4>
306
  <add_method_5>
307
  <code>10065</code>
308
- <price>4.15</price>
309
  <days>5</days>
310
  <from>
311
  <zip>00000000</zip>
@@ -320,7 +506,7 @@
320
  </add_method_5>
321
  <add_method_6>
322
  <code>10065</code>
323
- <price>4.70</price>
324
  <days>5</days>
325
  <from>
326
  <zip>00000000</zip>
@@ -335,7 +521,7 @@
335
  </add_method_6>
336
  <add_method_7>
337
  <code>10065</code>
338
- <price>5.25</price>
339
  <days>5</days>
340
  <from>
341
  <zip>00000000</zip>
@@ -350,7 +536,7 @@
350
  </add_method_7>
351
  <add_method_8>
352
  <code>10065</code>
353
- <price>5.80</price>
354
  <days>5</days>
355
  <from>
356
  <zip>00000000</zip>
@@ -365,7 +551,7 @@
365
  </add_method_8>
366
  <add_method_9>
367
  <code>10065</code>
368
- <price>6.35</price>
369
  <days>5</days>
370
  <from>
371
  <zip>00000000</zip>
@@ -380,7 +566,7 @@
380
  </add_method_9>
381
  <add_method_10>
382
  <code>10065</code>
383
- <price>6.90</price>
384
  <days>5</days>
385
  <from>
386
  <zip>00000000</zip>
@@ -395,7 +581,7 @@
395
  </add_method_10>
396
  <add_method_11>
397
  <code>10138</code>
398
- <price>4.50</price>
399
  <days>5</days>
400
  <from>
401
  <zip>00000000</zip>
@@ -410,7 +596,7 @@
410
  </add_method_11>
411
  <add_method_12>
412
  <code>10138</code>
413
- <price>5.00</price>
414
  <days>5</days>
415
  <from>
416
  <zip>00000000</zip>
@@ -425,7 +611,7 @@
425
  </add_method_12>
426
  <add_method_13>
427
  <code>10138</code>
428
- <price>5.65</price>
429
  <days>5</days>
430
  <from>
431
  <zip>00000000</zip>
@@ -440,7 +626,7 @@
440
  </add_method_13>
441
  <add_method_14>
442
  <code>10138</code>
443
- <price>6.20</price>
444
  <days>5</days>
445
  <from>
446
  <zip>00000000</zip>
@@ -455,7 +641,7 @@
455
  </add_method_14>
456
  <add_method_15>
457
  <code>10138</code>
458
- <price>6.80</price>
459
  <days>5</days>
460
  <from>
461
  <zip>00000000</zip>
@@ -470,7 +656,7 @@
470
  </add_method_15>
471
  <add_method_16>
472
  <code>10138</code>
473
- <price>7.35</price>
474
  <days>5</days>
475
  <from>
476
  <zip>00000000</zip>
@@ -485,7 +671,7 @@
485
  </add_method_16>
486
  <add_method_17>
487
  <code>10138</code>
488
- <price>7.90</price>
489
  <days>5</days>
490
  <from>
491
  <zip>00000000</zip>
@@ -500,7 +686,7 @@
500
  </add_method_17>
501
  <add_method_18>
502
  <code>10138</code>
503
- <price>8.45</price>
504
  <days>5</days>
505
  <from>
506
  <zip>00000000</zip>
@@ -515,7 +701,7 @@
515
  </add_method_18>
516
  <add_method_19>
517
  <code>10138</code>
518
- <price>9.00</price>
519
  <days>5</days>
520
  <from>
521
  <zip>00000000</zip>
@@ -530,7 +716,7 @@
530
  </add_method_19>
531
  <add_method_20>
532
  <code>10138</code>
533
- <price>9.55</price>
534
  <days>5</days>
535
  <from>
536
  <zip>00000000</zip>
@@ -545,7 +731,7 @@
545
  </add_method_20>
546
  <add_method_21>
547
  <code>10138</code>
548
- <price>10.10</price>
549
  <days>5</days>
550
  <from>
551
  <zip>00000000</zip>
15
  <config>
16
  <modules>
17
  <PedroTeixeira_Correios>
18
+ <version>4.5.0</version>
19
  <depends>
20
  <Mage_Shipping/>
21
  </depends>
31
  <volume_largura/>
32
  <postmethods/>
33
  <fit_size/>
34
+ <posting_days/>
35
  </product_attributes>
36
  </item>
37
  </quote>
85
  <title>Correios</title>
86
  <postmethods>40010</postmethods>
87
  <soft_errors>009,010,011</soft_errors>
88
+ <show_soft_errors>0</show_soft_errors>
89
  <prazo_entrega>0</prazo_entrega>
90
  <check_dimensions>1</check_dimensions>
91
  <min_order_value>0</min_order_value>
110
  <size>105</size>
111
  <sum>200</sum>
112
  <weight>30</weight>
113
+ <volume_weight>50</volume_weight>
114
  </max>
115
+ <zips>
116
+ <brasil>00000000,99999999</brasil>
117
+ </zips>
118
  </serv_40010>
119
  <serv_40096>
120
  <max>
121
  <size>105</size>
122
  <sum>200</sum>
123
  <weight>30</weight>
124
+ <volume_weight>50</volume_weight>
125
  </max>
126
+ <zips>
127
+ <brasil>00000000,99999999</brasil>
128
+ </zips>
129
  </serv_40096>
130
  <serv_81019>
131
  <max>
132
  <size>105</size>
133
  <sum>200</sum>
134
  <weight>15</weight>
135
+ <volume_weight>50</volume_weight>
136
  </max>
137
+ <zips>
138
+ <brasil>00000000,99999999</brasil>
139
+ </zips>
140
  </serv_81019>
141
  <serv_41106>
142
  <max>
143
  <size>105</size>
144
  <sum>200</sum>
145
  <weight>30</weight>
146
+ <volume_weight>50</volume_weight>
147
  </max>
148
+ <zips>
149
+ <brasil>00000000,99999999</brasil>
150
+ </zips>
151
  </serv_41106>
152
  <serv_41068>
153
  <max>
154
  <size>105</size>
155
  <sum>200</sum>
156
  <weight>30</weight>
157
+ <volume_weight>50</volume_weight>
158
  </max>
159
+ <zips>
160
+ <brasil>00000000,99999999</brasil>
161
+ </zips>
162
  </serv_41068>
163
  <serv_40215>
164
  <max>
165
  <size>105</size>
166
  <sum>200</sum>
167
  <weight>10</weight>
168
+ <volume_weight>50</volume_weight>
169
  </max>
170
+ <zips>
171
+ <brasil>00000000,99999999</brasil>
172
+ </zips>
173
  </serv_40215>
174
  <serv_40290>
175
  <max>
176
  <size>105</size>
177
  <sum>200</sum>
178
  <weight>10</weight>
179
+ <volume_weight>50</volume_weight>
180
  </max>
181
+ <zips>
182
+ <brasil>00000000,99999999</brasil>
183
+ </zips>
184
  </serv_40290>
185
  <serv_40045>
186
  <max>
187
  <size>105</size>
188
  <sum>200</sum>
189
  <weight>30</weight>
190
+ <volume_weight>50</volume_weight>
191
  </max>
192
+ <zips>
193
+ <brasil>00000000,99999999</brasil>
194
+ </zips>
195
  </serv_40045>
196
  <serv_41300>
197
  <max>
198
  <size>150</size>
199
  <sum>300</sum>
200
  <weight>30</weight>
201
+ <volume_weight>125</volume_weight>
202
  </max>
203
+ <zips>
204
+ <sao_paulo_01000>01000000,01599999</sao_paulo_01000>
205
+ <sao_paulo_02000>02000000,05899999</sao_paulo_02000>
206
+ <sao_paulo_06000>06000000,06699999</sao_paulo_06000>
207
+ <sao_paulo_07000>07000000,07299999</sao_paulo_07000>
208
+ <sao_paulo_07700>07750000,07799999</sao_paulo_07700>
209
+ <sao_paulo_08000>08000000,08499999</sao_paulo_08000>
210
+ <sao_paulo_09000>09000000,09999999</sao_paulo_09000>
211
+ <santos>11010000,11099999</santos>
212
+ <taubate>12010010,12120999</taubate>
213
+ <sao_jose_dos_campos>12209000,12248999</sao_jose_dos_campos>
214
+ <pindamonhangaba>12400000,12449999</pindamonhangaba>
215
+ <roseira>12580000,12580999</roseira>
216
+ <campinas>13000000,13139999</campinas>
217
+ <paulinia>13140000,13149999</paulinia>
218
+ <sumare>13170000,13189999</sumare>
219
+ <jundiai>13200000,13219999</jundiai>
220
+ <itupeva>13295000,13299999</itupeva>
221
+ <cabreuva>13315000,13319999</cabreuva>
222
+ <piracicaba>13400000,13433050</piracicaba>
223
+ <saltinho>13440000,13449999</saltinho>
224
+ <santa_barbara_do_oeste>13450000,13459999</santa_barbara_do_oeste>
225
+ <nova_odessa>13460000,13460999</nova_odessa>
226
+ <americana>13465000,13479999</americana>
227
+ <limeira>13480000,13489999</limeira>
228
+ <iracemapolis>13495000,13499999</iracemapolis>
229
+ <sao_pedro>13520000,13524999</sao_pedro>
230
+ <aguas_de_santa_barbara>13525000,13529999</aguas_de_santa_barbara>
231
+ <sao_carlos>13560000,13579999</sao_carlos>
232
+ <ribeirao_preto>14000000,14114999</ribeirao_preto>
233
+ <franca>14400000,14414999</franca>
234
+ <araraguara>14800000,14811999</araraguara>
235
+ <sao_jose_do_rio_preto>15000000,15105999</sao_jose_do_rio_preto>
236
+ <aracatuba>16000000,16129999</aracatuba>
237
+ <bauru>17000000,17110999</bauru>
238
+ <sorocaba>18000000,18109999</sorocaba>
239
+ <presidente_prudente>19000000,19159999</presidente_prudente>
240
+ <presidente_bernardes>19300000,19349999</presidente_bernardes>
241
+ <rio_de_janeiro_20000>20000000,20099999</rio_de_janeiro_20000>
242
+ <rio_de_janeiro_20140>20140000,20599999</rio_de_janeiro_20140>
243
+ <rio_de_janeiro_20700>20700000,20999999</rio_de_janeiro_20700>
244
+ <rio_de_janeiro_20710>20710000,20745312</rio_de_janeiro_20710>
245
+ <rio_de_janeiro_20750>20750000,20766840</rio_de_janeiro_20750>
246
+ <rio_de_janeiro_20770>20770000,20785510</rio_de_janeiro_20770>
247
+ <rio_de_janeiro_20910>20910000,20943580</rio_de_janeiro_20910>
248
+ <rio_de_janeiro_20950>20950003,20975210</rio_de_janeiro_20950>
249
+ <rio_de_janeiro_21000>21000000,21099999</rio_de_janeiro_21000>
250
+ <rio_de_janeiro_21130>21130000,21149999</rio_de_janeiro_21130>
251
+ <rio_de_janeiro_21200>21200000,21599999</rio_de_janeiro_21200>
252
+ <rio_de_janeiro_21310>21310000,21341790</rio_de_janeiro_21310>
253
+ <rio_de_janeiro_21350>21350000,21557300</rio_de_janeiro_21350>
254
+ <rio_de_janeiro_21600>21600000,21999999</rio_de_janeiro_21600>
255
+ <rio_de_janeiro_21902>21902710,21941840</rio_de_janeiro_21902>
256
+ <rio_de_janeiro_22000>22000000,23799999</rio_de_janeiro_22000>
257
+ <niteroi>24000000,24799999</niteroi>
258
+ <petropolis>25600000,25779999</petropolis>
259
+ <volta_redonda_27165>27165000,27165999</volta_redonda_27165>
260
+ <volta_redonda_27197>27197000,27475999</volta_redonda_27197>
261
+ <macae>27900000,27999999</macae>
262
+ <campos_goytacazes>28000000,28154999</campos_goytacazes>
263
+ <vitoria>29000000,29099999</vitoria>
264
+ <cariacica>29130000,29130999</cariacica>
265
+ <belo_horizonte_30000>30000000,30599999</belo_horizonte_30000>
266
+ <belo_horizonte_30700>30700000,32199999</belo_horizonte_30700>
267
+ <belo_horizonte_32300>32300000,32399999</belo_horizonte_32300>
268
+ <belo_horizonte_32920>32920000,32920001</belo_horizonte_32920>
269
+ <belo_horizonte_34600>34600000,34749999</belo_horizonte_34600>
270
+ <gov_valadares>35000001,35099999</gov_valadares>
271
+ <ipatinga_35160>35160000,35164999</ipatinga_35160>
272
+ <ipatinga_35167>35167000,35167999</ipatinga_35167>
273
+ <coronel_fabriciano>35170000,35174999</coronel_fabriciano>
274
+ <timoteo>35180000,35184999</timoteo>
275
+ <juiz_de_fora_36010>36010000,36099999</juiz_de_fora_36010>
276
+ <juiz_de_fora_36105>36105000,36105001</juiz_de_fora_36105>
277
+ <varginha>37000000,37099999</varginha>
278
+ <uberaba>38000000,38099999</uberaba>
279
+ <uberlandia>38400000,38415999</uberlandia>
280
+ <montes_claros>39400001,39409999</montes_claros>
281
+ <salvador_40000>40000000,42499999</salvador_40000>
282
+ <salvador_42700>42700000,42705999</salvador_42700>
283
+ <feira_de_santana>44000000,44100999</feira_de_santana>
284
+ <vitoria_da_conquista>45000000,45104999</vitoria_da_conquista>
285
+ <aracaju>49000000,49099999</aracaju>
286
+ <recife_50000>50000000,50999999</recife_50000>
287
+ <recife_52000>52000000,53989998</recife_52000>
288
+ <recife_54700>54700000,54799999</recife_54700>
289
+ <jaboatao_dos_guararapes_51000>51000000,51999999</jaboatao_dos_guararapes_51000>
290
+ <jaboatao_dos_guararapes_54000>54000000,54699999</jaboatao_dos_guararapes_54000>
291
+ <jaboatao_dos_guararapes_54800>54800000,54999999</jaboatao_dos_guararapes_54800>
292
+ <jaboatao_dos_guararapes_55590>55590000,55599999</jaboatao_dos_guararapes_55590>
293
+ <maceio>57010000,57089999</maceio>
294
+ <joao_pessoa>58000001,58099999</joao_pessoa>
295
+ <campina_grande>58400001,58439999</campina_grande>
296
+ <natal>59000001,59139999</natal>
297
+ <fortaleza>60000000,60999999</fortaleza>
298
+ <teresina>64000000,64099999</teresina>
299
+ <sao_luis>65000000,65139999</sao_luis>
300
+ <belem>66000000,66599999</belem>
301
+ <cabanagem>66600000,67200999</cabanagem>
302
+ <macapa_68900>68900000,68911639</macapa_68900>
303
+ <macapa_68925>68925000,68939999</macapa_68925>
304
+ <manaus>69000000,69099999</manaus>
305
+ <boa_vista>69301000,69399999</boa_vista>
306
+ <rio_branco>69900001,69924999</rio_branco>
307
+ <brasilia>70000000,71689999</brasilia>
308
+ <nucleo_bandeirante>71700000,71799999</nucleo_bandeirante>
309
+ <taguatinga>71800000,72399999</taguatinga>
310
+ <goiania>74000000,74894999</goiania>
311
+ <aparecida_de_goiania>74900000,74999999</aparecida_de_goiania>
312
+ <porto_velho>76800001,76834999</porto_velho>
313
+ <palmas>77000000,77299999</palmas>
314
+ <cuiaba>78000000,78169999</cuiaba>
315
+ <campo_grande>79000000,79124999</campo_grande>
316
+ <curitiba_80000>80000000,81199999</curitiba_80000>
317
+ <curitiba_81300>81300000,81999999</curitiba_81300>
318
+ <curitiba_82100>82100000,82299999</curitiba_82100>
319
+ <curitiba_82500>82500000,83189999</curitiba_82500>
320
+ <curitiba_83400>83400000,83419999</curitiba_83400>
321
+ <ponta_grossa>84010000,84073999</ponta_grossa>
322
+ <cascavel>85800000,85820999</cascavel>
323
+ <foz_do_iguacu>85850000,85874999</foz_do_iguacu>
324
+ <londrina_86000>86000000,86099999</londrina_86000>
325
+ <londrina_86180>86180000,86199999</londrina_86180>
326
+ <maringa>87005000,87105999</maringa>
327
+ <florianopolis_88010>88010000,88123999</florianopolis_88010>
328
+ <florianopolis_88130>88130000,88140999</florianopolis_88130>
329
+ <florianopolis_88160>88160000,88169999</florianopolis_88160>
330
+ <itajai>88300000,88319999</itajai>
331
+ <balneario_camboriu>88330000,88349999</balneario_camboriu>
332
+ <navegantes>88375000,88375999</navegantes>
333
+ <blumenau>89000000,89099999</blumenau>
334
+ <joinville>89200000,89239999</joinville>
335
+ <porto_alegre_90001>90001000,90899999</porto_alegre_90001>
336
+ <porto_alegre_91000>91000000,91499999</porto_alegre_91000>
337
+ <canoas>92000000,92499999</canoas>
338
+ <sao_leopoldo>93000000,93179999</sao_leopoldo>
339
+ <sapucaia_do_sul>93200000,93299999</sapucaia_do_sul>
340
+ <novo_hamburgo>93300000,93599999</novo_hamburgo>
341
+ <caxias_do_sul>95000000,95124999</caxias_do_sul>
342
+ <pelotas>96000000,96099999</pelotas>
343
+ <santa_maria>97000000,97119999</santa_maria>
344
+ <passo_fundo>99000000,99100000</passo_fundo>
345
+ </zips>
346
  </serv_41300>
347
  <serv_10065>
348
  <max>
349
  <size>30</size>
350
  <sum>50</sum>
351
  <weight>0.5</weight>
352
+ <volume_weight>50</volume_weight>
353
  </max>
354
+ <zips>
355
+ <brasil>00000000,99999999</brasil>
356
+ </zips>
357
  </serv_10065>
358
  <serv_10138>
359
  <max>
360
  <size>30</size>
361
  <sum>50</sum>
362
  <weight>0.5</weight>
363
+ <volume_weight>50</volume_weight>
364
  </max>
365
+ <zips>
366
+ <brasil>00000000,99999999</brasil>
367
+ </zips>
368
  </serv_10138>
369
  </validate>
370
 
416
  <!-- ADDITIONAL POST METHODS -->
417
  <add_method_0>
418
  <code>10065</code>
419
+ <price>1.40</price>
420
  <days>5</days>
421
  <from>
422
  <zip>00000000</zip>
431
  </add_method_0>
432
  <add_method_1>
433
  <code>10065</code>
434
+ <price>1.95</price>
435
  <days>5</days>
436
  <from>
437
  <zip>00000000</zip>
446
  </add_method_1>
447
  <add_method_2>
448
  <code>10065</code>
449
+ <price>2.70</price>
450
  <days>5</days>
451
  <from>
452
  <zip>00000000</zip>
461
  </add_method_2>
462
  <add_method_3>
463
  <code>10065</code>
464
+ <price>3.30</price>
465
  <days>5</days>
466
  <from>
467
  <zip>00000000</zip>
476
  </add_method_3>
477
  <add_method_4>
478
  <code>10065</code>
479
+ <price>3.90</price>
480
  <days>5</days>
481
  <from>
482
  <zip>00000000</zip>
491
  </add_method_4>
492
  <add_method_5>
493
  <code>10065</code>
494
+ <price>4.50</price>
495
  <days>5</days>
496
  <from>
497
  <zip>00000000</zip>
506
  </add_method_5>
507
  <add_method_6>
508
  <code>10065</code>
509
+ <price>5.15</price>
510
  <days>5</days>
511
  <from>
512
  <zip>00000000</zip>
521
  </add_method_6>
522
  <add_method_7>
523
  <code>10065</code>
524
+ <price>5.75</price>
525
  <days>5</days>
526
  <from>
527
  <zip>00000000</zip>
536
  </add_method_7>
537
  <add_method_8>
538
  <code>10065</code>
539
+ <price>6.35</price>
540
  <days>5</days>
541
  <from>
542
  <zip>00000000</zip>
551
  </add_method_8>
552
  <add_method_9>
553
  <code>10065</code>
554
+ <price>6.95</price>
555
  <days>5</days>
556
  <from>
557
  <zip>00000000</zip>
566
  </add_method_9>
567
  <add_method_10>
568
  <code>10065</code>
569
+ <price>7.55</price>
570
  <days>5</days>
571
  <from>
572
  <zip>00000000</zip>
581
  </add_method_10>
582
  <add_method_11>
583
  <code>10138</code>
584
+ <price>5.00</price>
585
  <days>5</days>
586
  <from>
587
  <zip>00000000</zip>
596
  </add_method_11>
597
  <add_method_12>
598
  <code>10138</code>
599
+ <price>5.55</price>
600
  <days>5</days>
601
  <from>
602
  <zip>00000000</zip>
611
  </add_method_12>
612
  <add_method_13>
613
  <code>10138</code>
614
+ <price>6.30</price>
615
  <days>5</days>
616
  <from>
617
  <zip>00000000</zip>
626
  </add_method_13>
627
  <add_method_14>
628
  <code>10138</code>
629
+ <price>6.90</price>
630
  <days>5</days>
631
  <from>
632
  <zip>00000000</zip>
641
  </add_method_14>
642
  <add_method_15>
643
  <code>10138</code>
644
+ <price>7.50</price>
645
  <days>5</days>
646
  <from>
647
  <zip>00000000</zip>
656
  </add_method_15>
657
  <add_method_16>
658
  <code>10138</code>
659
+ <price>8.10</price>
660
  <days>5</days>
661
  <from>
662
  <zip>00000000</zip>
671
  </add_method_16>
672
  <add_method_17>
673
  <code>10138</code>
674
+ <price>8.75</price>
675
  <days>5</days>
676
  <from>
677
  <zip>00000000</zip>
686
  </add_method_17>
687
  <add_method_18>
688
  <code>10138</code>
689
+ <price>9.35</price>
690
  <days>5</days>
691
  <from>
692
  <zip>00000000</zip>
701
  </add_method_18>
702
  <add_method_19>
703
  <code>10138</code>
704
+ <price>9.95</price>
705
  <days>5</days>
706
  <from>
707
  <zip>00000000</zip>
716
  </add_method_19>
717
  <add_method_20>
718
  <code>10138</code>
719
+ <price>10.55</price>
720
  <days>5</days>
721
  <from>
722
  <zip>00000000</zip>
731
  </add_method_20>
732
  <add_method_21>
733
  <code>10138</code>
734
+ <price>11.15</price>
735
  <days>5</days>
736
  <from>
737
  <zip>00000000</zip>
app/code/community/PedroTeixeira/Correios/etc/system.xml CHANGED
@@ -334,6 +334,15 @@
334
  <show_in_store>1</show_in_store>
335
  <comment>O pacote é dividido, caso o carrinho exceda os limites de peso e tamanho, para todos os serviços. A divisão se repete até que os limites sejam válidos, para um ou mais serviços.</comment>
336
  </split_pack>
 
 
 
 
 
 
 
 
 
337
  <sort_order translate="label">
338
  <label>Ordenar Por</label>
339
  <frontend_type>text</frontend_type>
334
  <show_in_store>1</show_in_store>
335
  <comment>O pacote é dividido, caso o carrinho exceda os limites de peso e tamanho, para todos os serviços. A divisão se repete até que os limites sejam válidos, para um ou mais serviços.</comment>
336
  </split_pack>
337
+ <show_soft_errors translate="label">
338
+ <label>Exibir Alerta de Área de Risco</label>
339
+ <frontend_type>select</frontend_type>
340
+ <source_model>adminhtml/system_config_source_yesno</source_model>
341
+ <sort_order>269</sort_order>
342
+ <show_in_default>1</show_in_default>
343
+ <show_in_website>1</show_in_website>
344
+ <show_in_store>1</show_in_store>
345
+ </show_soft_errors>
346
  <sort_order translate="label">
347
  <label>Ordenar Por</label>
348
  <frontend_type>text</frontend_type>
app/code/community/PedroTeixeira/Correios/sql/pedroteixeira_correios_setup/install-4.5.0.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * This source file is subject to the MIT License.
5
+ * It is also available through http://opensource.org/licenses/MIT
6
+ *
7
+ * @category PedroTeixeira
8
+ * @package PedroTeixeira_Correios
9
+ * @author Pedro Teixeira <hello@pedroteixeira.io>
10
+ * @copyright 2015 Pedro Teixeira (http://pedroteixeira.io)
11
+ * @license http://opensource.org/licenses/MIT MIT
12
+ * @link https://github.com/pedro-teixeira/correios
13
+ */
14
+
15
+ /** @var $installer Mage_Core_Model_Resource_Setup */
16
+ $installer = $this;
17
+ $installer->startSetup();
18
+
19
+ /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
20
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
21
+
22
+ // Add volume to prduct attribute set
23
+ $codigo = 'volume_comprimento';
24
+ $config = array(
25
+ 'position' => 1,
26
+ 'required' => 0,
27
+ 'label' => 'Comprimento (cm)',
28
+ 'type' => 'int',
29
+ 'input' => 'text',
30
+ 'apply_to' => 'simple,bundle,grouped,configurable',
31
+ 'note' => 'Comprimento da embalagem do produto (Para cálculo dos Correios)'
32
+ );
33
+
34
+ $setup->addAttribute('catalog_product', $codigo, $config);
35
+
36
+ // Add volume to prduct attribute set
37
+ $codigo = 'volume_altura';
38
+ $config = array(
39
+ 'position' => 1,
40
+ 'required' => 0,
41
+ 'label' => 'Altura (cm)',
42
+ 'type' => 'int',
43
+ 'input' => 'text',
44
+ 'apply_to' => 'simple,bundle,grouped,configurable',
45
+ 'note' => 'Altura da embalagem do produto (Para cálculo dos Correios)'
46
+ );
47
+
48
+ $setup->addAttribute('catalog_product', $codigo, $config);
49
+
50
+ // Add volume to prduct attribute set
51
+ $codigo = 'volume_largura';
52
+ $config = array(
53
+ 'position' => 1,
54
+ 'required' => 0,
55
+ 'label' => 'Largura (cm)',
56
+ 'type' => 'int',
57
+ 'input' => 'text',
58
+ 'apply_to' => 'simple,bundle,grouped,configurable',
59
+ 'note' => 'Largura da embalagem do produto (Para cálculo dos Correios)'
60
+ );
61
+
62
+ $setup->addAttribute('catalog_product', $codigo, $config);
63
+
64
+ $codigo = 'postmethods';
65
+ $config = array(
66
+ 'position' => 1,
67
+ 'required' => 0,
68
+ 'label' => 'Serviços de Entrega',
69
+ 'type' => 'text',
70
+ 'input' => 'multiselect',
71
+ 'source' => 'pedroteixeira_correios/source_postMethods',
72
+ 'backend' => 'eav/entity_attribute_backend_array',
73
+ 'apply_to' => 'simple,bundle,grouped,configurable',
74
+ 'note' => 'Selecione os serviços apropriados para o produto.'
75
+ );
76
+
77
+ $setup->addAttribute('catalog_product', $codigo, $config);
78
+
79
+ $codigo = 'fit_size';
80
+ $config = array(
81
+ 'position' => 1,
82
+ 'required' => 0,
83
+ 'label' => 'Diferença do Encaixe (cm)',
84
+ 'type' => 'varchar',
85
+ 'input' => 'text',
86
+ 'apply_to' => 'simple,bundle,grouped,configurable',
87
+ 'note' => 'Exemplo: Se 1 item mede 10cm de altura, e 2 itens encaixados medem 11cm. A diferença é de 1cm.'
88
+ );
89
+
90
+ $setup->addAttribute('catalog_product', $codigo, $config);
91
+
92
+ $codigo = 'posting_days';
93
+ $config = array(
94
+ 'position' => 1,
95
+ 'required' => 0,
96
+ 'label' => 'Prazo de Postagem',
97
+ 'type' => 'int',
98
+ 'input' => 'text',
99
+ 'apply_to' => 'simple,bundle,grouped,configurable',
100
+ 'note' => 'O prazo total é o Prazo dos Correios acrescido do maior Prazo de Postagem dos produtos no carrinho.'
101
+ );
102
+
103
+ $setup->addAttribute('catalog_product', $codigo, $config);
104
+
105
+ $installer->endSetup();
app/code/community/PedroTeixeira/Correios/sql/pedroteixeira_correios_setup/upgrade-4.4.0-4.5.0.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * This source file is subject to the MIT License.
5
+ * It is also available through http://opensource.org/licenses/MIT
6
+ *
7
+ * @category PedroTeixeira
8
+ * @package PedroTeixeira_Correios
9
+ * @author Pedro Teixeira <hello@pedroteixeira.io>
10
+ * @copyright 2015 Pedro Teixeira (http://pedroteixeira.io)
11
+ * @license http://opensource.org/licenses/MIT MIT
12
+ * @link https://github.com/pedro-teixeira/correios
13
+ */
14
+
15
+ /** @var $installer Mage_Core_Model_Resource_Setup */
16
+ $installer = $this;
17
+ $installer->startSetup();
18
+
19
+ /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
20
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
21
+
22
+ $codigo = 'posting_days';
23
+ $config = array(
24
+ 'position' => 1,
25
+ 'required' => 0,
26
+ 'label' => 'Prazo de Postagem',
27
+ 'type' => 'int',
28
+ 'input' => 'text',
29
+ 'apply_to' => 'simple,bundle,grouped,configurable',
30
+ 'note' => 'O prazo total é o Prazo dos Correios acrescido do maior Prazo de Postagem dos produtos no carrinho.'
31
+ );
32
+
33
+ $setup->addAttribute('catalog_product', $codigo, $config);
34
+
35
+ $installer->endSetup();
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PedroTeixeira_Correios</name>
4
- <version>4.4.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/mit-license.php">MIT License</license>
7
  <channel>community</channel>
@@ -28,32 +28,22 @@ Conta com identifica&#xE7;&#xE3;o de erros dos Correios, m&#xE3;o pr&#xF3;pria,
28
  Mais informa&#xE7;&#xF5;es em https://pedroteixeira.io.</description>
29
  <notes>Bugfix:&#xD;
30
  &#xD;
31
- - Usar atributo para setar o carrier name e passar o encoding para htmlentities&#xD;
32
- - Erro 99 Input string was not in a correct format&#xD;
33
- - Peso c&#xFA;bico n&#xE3;o calculado no backend&#xD;
34
- - Corrige a leitura do valor de frete&#xD;
35
- - Frete de mil reais exibido por 1 real&#xD;
36
- - Problema com peso do E-SEDEX&#xD;
37
  &#xD;
38
  Feature:&#xD;
39
  &#xD;
40
- - Adiciona CONTRIBUTING.md&#xD;
41
- - Adiciona badges&#xD;
42
- - Integra&#xE7;&#xE3;o com Travis&#xD;
43
- - Testado em Magento 1.9.1.0&#xD;
44
- - Servi&#xE7;os por produto, valida&#xE7;&#xE3;o por servi&#xE7;o, grandes formatos, carta registrada, cache&#xD;
45
- - Considerar produtos encaixados&#xD;
46
- - Adicionar PAC grandes formatos aos servi&#xE7;os de postagem&#xD;
47
- - Valida&#xE7;&#xE3;o de peso e dimens&#xF5;es&#xD;
48
- - Selecionar servi&#xE7;os por produto&#xD;
49
- - Suporte para instala&#xE7;&#xF5;es modman&#xD;
50
- - Integrar carta registrada&#xD;
51
- - Implementar cache de respostas dos Correios&#xD;
52
- - Op&#xE7;&#xE3;o de dividir a entrega em mais de um pacote</notes>
53
  <authors><author><name>Pedro Teixeira</name><user>teixeirapedro</user><email>hello@pedroteixeira.io</email></author></authors>
54
- <date>2015-03-30</date>
55
- <time>17:47:09</time>
56
- <contents><target name="magecommunity"><dir name="PedroTeixeira"><dir name="Correios"><dir name="Helper"><file name="Data.php" hash="a030f07c60af40e9817054800096207f"/></dir><dir name="Model"><file name="Cache.php" hash="60a1fd3536bbeb00e4d2e67b8cc5ea94"/><dir name="Carrier"><file name="CorreiosMethod.php" hash="d3ddd84f037995c132467390fb019445"/></dir><dir name="Http"><dir name="Client"><dir name="Adapter"><file name="Socket.php" hash="76da85f117c3f9950164a5d90500d82f"/></dir></dir></dir><dir name="Source"><file name="CacheMode.php" hash="b34ae611b8bf913e4b646f4a156cc2a4"/><file name="PostMethods.php" hash="b251451bf944b1488c477d58c4c8985d"/><file name="WeightType.php" hash="4bf1608fb6b665dcc7d834ca35eee174"/></dir></dir><dir name="etc"><file name="config.xml" hash="c45f18929175ffc1f7d59dee0e88e34b"/><file name="system.xml" hash="6ffa11314b0bd87a521a69e508463a47"/></dir><dir name="sql"><dir name="pedroteixeira_correios_setup"><file name="install-4.0.0.php" hash="eda109c002d9130fc1ce807784aa60a3"/><file name="install-4.4.0.php" hash="889c7376ee7bdd30bf07616b4f365e3b"/><file name="upgrade-4.0.0-4.1.0.php" hash="ca42fdabb0975f60d8cf5ef5ab122acd"/><file name="upgrade-4.1.0-4.2.0.php" hash="319cd1c4ddaa745da9af4a5111aa1534"/><file name="upgrade-4.2.0-4.3.0.php" hash="783e854d19b0e4915360cc1ec8b4d2d0"/><file name="upgrade-4.3.0-4.4.0.php" hash="982f41d3a113d21c4008de7e63918e45"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PedroTeixeira_Correios.xml" hash="e714579bed97c85f2bcc3988dec271da"/></dir></target></contents>
57
  <compatible/>
58
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name/><channel>connect.magentocommerce.com/core</channel><min/><max/></package></required></dependencies>
59
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PedroTeixeira_Correios</name>
4
+ <version>4.5.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/mit-license.php">MIT License</license>
7
  <channel>community</channel>
28
  Mais informa&#xE7;&#xF5;es em https://pedroteixeira.io.</description>
29
  <notes>Bugfix:&#xD;
30
  &#xD;
31
+ - Corre&#xE7;&#xE3;o de prazo para mapeamentos recentes dos Correios&#xD;
32
+ - Corrige exce&#xE7;&#xE3;o no caso de falha na comunica&#xE7;&#xE3;o com os Correios&#xD;
 
 
 
 
33
  &#xD;
34
  Feature:&#xD;
35
  &#xD;
36
+ - Adiciona suporte a Perfil Recorrente (Recurring Profile)&#xD;
37
+ - Licen&#xE7;a utilizada vis&#xED;vel na documenta&#xE7;&#xE3;o&#xD;
38
+ - Atualiza&#xE7;&#xE3;o dos pre&#xE7;os da carta comercial e carta comercial registrada&#xD;
39
+ - Adiciona mensagem especial para CEPs com &#xE1;rea de risco&#xD;
40
+ - Adiciona explica&#xE7;&#xE3;o de novos campos no README&#xD;
41
+ - Adiciona informa&#xE7;&#xE3;o sobre compila&#xE7;&#xE3;o no README&#xD;
42
+ - Possibilidade de acrescentar dias nos prazos dos Correios por produto</notes>
 
 
 
 
 
 
43
  <authors><author><name>Pedro Teixeira</name><user>teixeirapedro</user><email>hello@pedroteixeira.io</email></author></authors>
44
+ <date>2015-07-13</date>
45
+ <time>09:08:57</time>
46
+ <contents><target name="magecommunity"><dir name="PedroTeixeira"><dir name="Correios"><dir name="Helper"><file name="Data.php" hash="a030f07c60af40e9817054800096207f"/></dir><dir name="Model"><file name="Cache.php" hash="63903ef57e86e2be3cd79787063f3946"/><dir name="Carrier"><file name="CorreiosMethod.php" hash="aedcce35a9b2a2b633ae2828681072a3"/></dir><dir name="Http"><dir name="Client"><dir name="Adapter"><file name="Socket.php" hash="76da85f117c3f9950164a5d90500d82f"/></dir></dir></dir><dir name="Source"><file name="CacheMode.php" hash="b34ae611b8bf913e4b646f4a156cc2a4"/><file name="PostMethods.php" hash="b251451bf944b1488c477d58c4c8985d"/><file name="WeightType.php" hash="4bf1608fb6b665dcc7d834ca35eee174"/></dir></dir><dir name="etc"><file name="config.xml" hash="03105f699463cf7df28eafb89a9bddf4"/><file name="system.xml" hash="a176657e9f5565ef20d101059cca833c"/></dir><dir name="sql"><dir name="pedroteixeira_correios_setup"><file name="install-4.0.0.php" hash="eda109c002d9130fc1ce807784aa60a3"/><file name="install-4.4.0.php" hash="889c7376ee7bdd30bf07616b4f365e3b"/><file name="install-4.5.0.php" hash="e0daaac3649b166a33928da3844ad965"/><file name="upgrade-4.0.0-4.1.0.php" hash="ca42fdabb0975f60d8cf5ef5ab122acd"/><file name="upgrade-4.1.0-4.2.0.php" hash="319cd1c4ddaa745da9af4a5111aa1534"/><file name="upgrade-4.2.0-4.3.0.php" hash="783e854d19b0e4915360cc1ec8b4d2d0"/><file name="upgrade-4.3.0-4.4.0.php" hash="982f41d3a113d21c4008de7e63918e45"/><file name="upgrade-4.4.0-4.5.0.php" hash="95dfd40fa6469a711b4b65a331f0b1b7"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PedroTeixeira_Correios.xml" hash="e714579bed97c85f2bcc3988dec271da"/></dir></target></contents>
47
  <compatible/>
48
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name/><channel>connect.magentocommerce.com/core</channel><min/><max/></package></required></dependencies>
49
  </package>