Ydral_Correos - Version 1.0.3

Version Notes

Correos

Download this release

Release Info

Developer Ydral
Extension Ydral_Correos
Version 1.0.3
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.3

app/code/local/Ydral/Correos/Model/Ydral/Shipment.php CHANGED
@@ -24,7 +24,7 @@ class Ydral_Correos_Model_Ydral_Shipment extends Mage_Sales_Model_Order_Shipment
24
  curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlSend);
25
 
26
  curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE);
27
- curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml", "SOAPAction: \"Preregistro\""));
28
  curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
29
 
30
 
@@ -155,7 +155,7 @@ class Ydral_Correos_Model_Ydral_Shipment extends Mage_Sales_Model_Order_Shipment
155
 
156
  /**
157
  * validacion de datos para adaptarlos al requerido por correos
158
- */
159
  $_destinatarioNombre = substr($_order->getShippingAddress()->getFirstname(), 0, 50); // se coge por el tamano max de correos
160
  $_destinatarioApellidos = substr($_order->getShippingAddress()->getLastname(), 0, 50);
161
  $_destinatarioDireccion = substr($_order->getShippingAddress()->getStreetFull(), 0, 50);
@@ -167,7 +167,9 @@ class Ydral_Correos_Model_Ydral_Shipment extends Mage_Sales_Model_Order_Shipment
167
  $_destinatarioTelefono = substr($_order->getShippingAddress()->getTelephone(), 0, 12);
168
  $_destinatarioSMS = substr($_order->getShippingAddress()->getTelephone(), -9); // las ultimas 9 por si pone +,0...
169
 
 
170
 
 
171
  if (
172
  (strlen(trim($_destinatarioSMS)) == 0) ||
173
  ( (substr($_destinatarioSMS, 0, 1) != 6) && (substr($_destinatarioSMS, 0, 1) != 7) )
@@ -185,6 +187,7 @@ class Ydral_Correos_Model_Ydral_Shipment extends Mage_Sales_Model_Order_Shipment
185
  * xml de peticion
186
  */
187
  $xmlSend = <<<XML
 
188
  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://www.correos.es/iris6/services/preregistroetiquetas">
189
  <soapenv:Header/>
190
  <soapenv:Body>
@@ -267,6 +270,7 @@ class Ydral_Correos_Model_Ydral_Shipment extends Mage_Sales_Model_Order_Shipment
267
  XML;
268
 
269
 
 
270
  // peticion
271
  $peticionCorreos = $this->preregistroCorreos($xmlSend);
272
 
24
  curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlSend);
25
 
26
  curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE);
27
+ curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml; charset=utf-8", "SOAPAction: \"Preregistro\""));
28
  curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
29
 
30
 
155
 
156
  /**
157
  * validacion de datos para adaptarlos al requerido por correos
158
+ */
159
  $_destinatarioNombre = substr($_order->getShippingAddress()->getFirstname(), 0, 50); // se coge por el tamano max de correos
160
  $_destinatarioApellidos = substr($_order->getShippingAddress()->getLastname(), 0, 50);
161
  $_destinatarioDireccion = substr($_order->getShippingAddress()->getStreetFull(), 0, 50);
167
  $_destinatarioTelefono = substr($_order->getShippingAddress()->getTelephone(), 0, 12);
168
  $_destinatarioSMS = substr($_order->getShippingAddress()->getTelephone(), -9); // las ultimas 9 por si pone +,0...
169
 
170
+
171
 
172
+
173
  if (
174
  (strlen(trim($_destinatarioSMS)) == 0) ||
175
  ( (substr($_destinatarioSMS, 0, 1) != 6) && (substr($_destinatarioSMS, 0, 1) != 7) )
187
  * xml de peticion
188
  */
189
  $xmlSend = <<<XML
190
+ <?xml version="1.0" encoding="utf-8"?>
191
  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://www.correos.es/iris6/services/preregistroetiquetas">
192
  <soapenv:Header/>
193
  <soapenv:Body>
270
  XML;
271
 
272
 
273
+
274
  // peticion
275
  $peticionCorreos = $this->preregistroCorreos($xmlSend);
276
 
app/design/frontend/base/default/layout/correos.xml CHANGED
@@ -6,6 +6,7 @@
6
  <reference name="head" ifconfig="carriers/recogeroficina/active">
7
  <action method="addItem"><type>skin_js</type><name>js/correos.js</name></action>
8
  <action method="addCss"><stylesheet>css/correos.css</stylesheet></action>
 
9
  </reference>
10
  </default>
11
  <!-- </checkout_onepage_index> -->
6
  <reference name="head" ifconfig="carriers/recogeroficina/active">
7
  <action method="addItem"><type>skin_js</type><name>js/correos.js</name></action>
8
  <action method="addCss"><stylesheet>css/correos.css</stylesheet></action>
9
+ <block type="core/template" name="correosHead" template="correos/head.phtml"/>
10
  </reference>
11
  </default>
12
  <!-- </checkout_onepage_index> -->
app/design/frontend/base/default/template/correos/head.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <script type="text/javascript">
2
+ var BASE_URL_CORREOS = '<?php echo $this->getBaseUrl(); ?>';
3
+ </script>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ydral_Correos</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Modulo para Magento para integrar Correos.</description>
11
  <notes>Correos</notes>
12
  <authors><author><name>Ydral</name><user>Ydral</user><email>webmaster@ydral.com</email></author></authors>
13
- <date>2012-12-17</date>
14
- <time>12:02:40</time>
15
- <contents><target name="magelocal"><dir name="Ydral"><dir name="Correos"><dir><dir name="Block"><file name="Correos.php" hash="1b0b7449fe4fc1a490beb2731d808833"/><dir name="Onepage"><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="f3eee1d370e15385a7ad0660388318e8"/></dir></dir></dir><dir name="Order"><file name="Info.php" hash="e91c0bbf5f12c5417aaa7cb9a016d53e"/><file name="Shipment.php" hash="92af0ea6e466b5c3ba3e03d87099676b"/><file name="View.php" hash="2ba78931ba3627861a4c3a0b313eeeea"/></dir><dir name="System"><dir name="Export"><file name="Envio.php" hash="bcbf6fd994d10dd15252e8e0cd1137d9"/><file name="Recoger.php" hash="8ab14c0214077967088913a050eac011"/></dir></dir><dir name="Tracking"><file name="Popup.php" hash="90ad75e9c0f8d59093f6c0f10c2c403d"/></dir></dir><dir name="Helper"><file name="Data.php" hash="d5142bf6837fcee9fa6b95363397af3f"/><file name="Onestepcheckout.php" hash="73c35d649ba8a1982059049b2069d37c"/></dir><dir name="Model"><file name="Correos.php" hash="7d7329d6e15391e58d01eb68b1cc1f34"/><dir name="Mysql4"><dir name="Carrier"><dir name="Correos"><file name="Collection.php" hash="8acd4f14cbbfa3266672f80df90dd8eb"/></dir><file name="Correos.php" hash="67a8a823c9f9164780e50e4592b4113f"/></dir><dir name="Correos"><file name="Collection.php" hash="5d3d9c496b804a813aba6d4b8ada21b4"/></dir><file name="Correos.php" hash="2a7507d51e478a42404dc3da39caec0f"/></dir><file name="Pesos.php" hash="5a0eb95ca645de30602fa2ab96bd468b"/><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Shipping.php" hash="d9e5185a891d850f6d8aaa56a6f89c06"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Shipping"><file name="Correos.php" hash="19b624f09bde0493ff1da9c8d7032756"/><file name="Recoger.php" hash="7fa2ecf29152181778df237c377adaa5"/></dir></dir></dir></dir><dir name="Type"><file name="Onepage.php" hash="bccdfd5d4fcedaf4f6564a31634ad8f6"/></dir><dir name="Ydral"><file name="Correos.php" hash="32b9596c9903b43c2571e411a791b83f"/><file name="Recogeroficina.php" hash="143959a68ec994587d9d4fa1684b456d"/><file name="Shipment.php" hash="003fb5d141d986b640056c8e856c8c06"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="45abd73fe238454c2426460d39afefed"/><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="e3b714b819b870a931d037b2b5668dcb"/></dir></dir><file name="TrackingController.php" hash="ec71e387dc85055ba34c19a07c4aad78"/></dir><dir name="etc"><file name="config.xml" hash="f2ebc69266a0a30ef11888b60b937959"/><file name="system.xml" hash="7ccbf79ef19675932c0b0352c575aba4"/></dir><dir name="sql"><dir name="correos_setup"><file name="mysql4-install-0.1.0.php" hash="4e95daa44dbacf3ba1d02bb73018786e"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="a91ac4d35130ff6d11d876c711f810e2"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="a91ac4d35130ff6d11d876c711f810e2"/></dir></dir></dir><file name="log.txt" hash="fa236e6e523e9d696a222fb7f5f51ae1"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ydral_Correos.xml" hash="0958431d8cb3d9423baa51c3e10baf48"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="correos.css" hash="d6fde38ba7d7f768dea0b161b190d5ab"/></dir><dir name="js"><file name="correos.js" hash="437470394526c567639e29d16244cd75"/></dir><dir name="images"><file name="correos_4872.png" hash="06096525a173118a8f3199c402688c48"/><file name="logo_entregadomicilio.jpg" hash="0d2b9aa305b92a7ea53bd2d6f2daa9e3"/><file name="logo_recogeroficina.jpg" hash="50a6906d1a4ef364e21f838a0cd5ade6"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="css"><file name="correos.css" hash="d6fde38ba7d7f768dea0b161b190d5ab"/></dir><dir name="js"><file name="correos.js" hash="437470394526c567639e29d16244cd75"/></dir><dir name="images"><file name="logo_entregadomicilio.jpg" hash="0d2b9aa305b92a7ea53bd2d6f2daa9e3"/><file name="logo_recogeroficina.jpg" hash="50a6906d1a4ef364e21f838a0cd5ade6"/><file name="correos_4872.png" hash="06096525a173118a8f3199c402688c48"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="correos-section.png" hash="6715309b92e7dc1599cc043975272624"/></dir><file name="correos.css" hash="e27bc86c5ea27d00c13e5c2589fd89e4"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="correos.xml" hash="c1d4ca19d9c9d3eee7c8f8367113d1b4"/></dir><dir name="template"><dir name="correos"><file name="tab_info.phtml" hash="fc7ba70d82c60497fe5c01068fdb2a3c"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="correos.xml" hash="67aa5520799d6212cd757724849b67a2"/></dir><dir name="template"><dir name="correos"><file name="order_info.phtml" hash="ca29af9d43da164b17e7c59cb7d5c577"/><file name="order_shipment.phtml" hash="ddef55d58d33c172d7b497efb24cceef"/><file name="order_shipment_items.phtml" hash="d250b704263f57791e5d1dd30f53f9a8"/><file name="order_view.phtml" hash="74d03f2e4e9479d2fd46b8ebd8edec68"/><file name="popup.phtml" hash="98621c39582463a00292c871b6d37d82"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ydral_Correos</name>
4
+ <version>1.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
7
  <channel>community</channel>
10
  <description>Modulo para Magento para integrar Correos.</description>
11
  <notes>Correos</notes>
12
  <authors><author><name>Ydral</name><user>Ydral</user><email>webmaster@ydral.com</email></author></authors>
13
+ <date>2013-02-13</date>
14
+ <time>17:58:14</time>
15
+ <contents><target name="magelocal"><dir name="Ydral"><dir name="Correos"><dir><dir name="Block"><file name="Correos.php" hash="1b0b7449fe4fc1a490beb2731d808833"/><dir name="Onepage"><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="f3eee1d370e15385a7ad0660388318e8"/></dir></dir></dir><dir name="Order"><file name="Info.php" hash="e91c0bbf5f12c5417aaa7cb9a016d53e"/><file name="Shipment.php" hash="92af0ea6e466b5c3ba3e03d87099676b"/><file name="View.php" hash="2ba78931ba3627861a4c3a0b313eeeea"/></dir><dir name="System"><dir name="Export"><file name="Envio.php" hash="bcbf6fd994d10dd15252e8e0cd1137d9"/><file name="Recoger.php" hash="8ab14c0214077967088913a050eac011"/></dir></dir><dir name="Tracking"><file name="Popup.php" hash="90ad75e9c0f8d59093f6c0f10c2c403d"/></dir></dir><dir name="Helper"><file name="Data.php" hash="d5142bf6837fcee9fa6b95363397af3f"/><file name="Onestepcheckout.php" hash="73c35d649ba8a1982059049b2069d37c"/></dir><dir name="Model"><file name="Correos.php" hash="7d7329d6e15391e58d01eb68b1cc1f34"/><dir name="Mysql4"><dir name="Carrier"><dir name="Correos"><file name="Collection.php" hash="8acd4f14cbbfa3266672f80df90dd8eb"/></dir><file name="Correos.php" hash="67a8a823c9f9164780e50e4592b4113f"/></dir><dir name="Correos"><file name="Collection.php" hash="5d3d9c496b804a813aba6d4b8ada21b4"/></dir><file name="Correos.php" hash="2a7507d51e478a42404dc3da39caec0f"/></dir><file name="Pesos.php" hash="5a0eb95ca645de30602fa2ab96bd468b"/><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Shipping.php" hash="d9e5185a891d850f6d8aaa56a6f89c06"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Shipping"><file name="Correos.php" hash="19b624f09bde0493ff1da9c8d7032756"/><file name="Recoger.php" hash="7fa2ecf29152181778df237c377adaa5"/></dir></dir></dir></dir><dir name="Type"><file name="Onepage.php" hash="bccdfd5d4fcedaf4f6564a31634ad8f6"/></dir><dir name="Ydral"><file name="Correos.php" hash="32b9596c9903b43c2571e411a791b83f"/><file name="Recogeroficina.php" hash="143959a68ec994587d9d4fa1684b456d"/><file name="Shipment.php" hash="3131929853c48313da7d7fb2df6f1970"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="45abd73fe238454c2426460d39afefed"/><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="e3b714b819b870a931d037b2b5668dcb"/></dir></dir><file name="TrackingController.php" hash="ec71e387dc85055ba34c19a07c4aad78"/></dir><dir name="etc"><file name="config.xml" hash="f2ebc69266a0a30ef11888b60b937959"/><file name="system.xml" hash="7ccbf79ef19675932c0b0352c575aba4"/></dir><dir name="sql"><dir name="correos_setup"><file name="mysql4-install-0.1.0.php" hash="4e95daa44dbacf3ba1d02bb73018786e"/><file name="mysql4-upgrade-0.1.0-0.2.0.php" hash="a91ac4d35130ff6d11d876c711f810e2"/><file name="mysql4-upgrade-0.2.0-0.3.0.php" hash="a91ac4d35130ff6d11d876c711f810e2"/></dir></dir></dir><file name="log.txt" hash="fa236e6e523e9d696a222fb7f5f51ae1"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ydral_Correos.xml" hash="0958431d8cb3d9423baa51c3e10baf48"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="correos.css" hash="d6fde38ba7d7f768dea0b161b190d5ab"/></dir><dir name="js"><file name="correos.js" hash="9488e274935706a07bd5ab2df45000d8"/></dir><dir name="images"><file name="correos_4872.png" hash="06096525a173118a8f3199c402688c48"/><file name="logo_entregadomicilio.jpg" hash="0d2b9aa305b92a7ea53bd2d6f2daa9e3"/><file name="logo_recogeroficina.jpg" hash="50a6906d1a4ef364e21f838a0cd5ade6"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="css"><file name="correos.css" hash="d6fde38ba7d7f768dea0b161b190d5ab"/></dir><dir name="js"><file name="correos.js" hash="437470394526c567639e29d16244cd75"/></dir><dir name="images"><file name="logo_entregadomicilio.jpg" hash="0d2b9aa305b92a7ea53bd2d6f2daa9e3"/><file name="logo_recogeroficina.jpg" hash="50a6906d1a4ef364e21f838a0cd5ade6"/><file name="correos_4872.png" hash="06096525a173118a8f3199c402688c48"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="correos-section.png" hash="6715309b92e7dc1599cc043975272624"/></dir><file name="correos.css" hash="e27bc86c5ea27d00c13e5c2589fd89e4"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="correos.xml" hash="c1d4ca19d9c9d3eee7c8f8367113d1b4"/></dir><dir name="template"><dir name="correos"><file name="tab_info.phtml" hash="fc7ba70d82c60497fe5c01068fdb2a3c"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="correos.xml" hash="a654a2a7e05d4c17242c5e546dd9a357"/></dir><dir name="template"><dir name="correos"><file name="head.phtml" hash="34ba4373fd627f763e71ce75386c80b7"/><file name="order_info.phtml" hash="ca29af9d43da164b17e7c59cb7d5c577"/><file name="order_shipment.phtml" hash="ddef55d58d33c172d7b497efb24cceef"/><file name="order_shipment_items.phtml" hash="d250b704263f57791e5d1dd30f53f9a8"/><file name="order_view.phtml" hash="74d03f2e4e9479d2fd46b8ebd8edec68"/><file name="popup.phtml" hash="98621c39582463a00292c871b6d37d82"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
skin/frontend/default/default/js/correos.js CHANGED
@@ -65,7 +65,8 @@ PuntosCorreos.prototype = {
65
  Element.show('shipping-method-please-wait');
66
  }
67
 
68
- this.reloadurl = '/correos/index/getdata/';
 
69
  new Ajax.Request(this.reloadurl, {
70
  method: 'post',
71
  parameters: {codigoPostal: codPostal},
65
  Element.show('shipping-method-please-wait');
66
  }
67
 
68
+
69
+ this.reloadurl = BASE_URL_CORREOS+'/correos/index/getdata/';
70
  new Ajax.Request(this.reloadurl, {
71
  method: 'post',
72
  parameters: {codigoPostal: codPostal},